[RFC,2/4] Introduce maint set prefer-software-single-stepping on/off

Message ID 20231129203326.11952-2-tdevries@suse.de
State New
Series [RFC,1/4,gdb/tdep] Add dummy amd64_software_single_step |


Context Check Description
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 success Testing passed
linaro-tcwg-bot/tcwg_gdb_build--master-arm success Testing passed
linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 success Testing passed
linaro-tcwg-bot/tcwg_gdb_check--master-arm success Testing passed

Commit Message

Tom de Vries Nov. 29, 2023, 8:33 p.m. UTC
  Add a maintenance command that enables using software single-stepping on
targets that support this:
(gdb) maint set prefer-software-single-stepping on

By default, prefer-software-single-stepping is off, and behaviour is

Also, there are no users yet, the following patch will add one for amd64.

This is an RFC for the moment, so no docs yet.

Tested on x86_64-linux.
 gdb/breakpoint.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)


diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 60e795e1849..3d90e2a2159 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -13945,6 +13945,9 @@  insert_single_step_breakpoint (struct gdbarch *gdbarch,
   update_global_location_list (UGLL_INSERT);
+extern bool prefer_software_single_stepping;
+bool prefer_software_single_stepping;
 software_single_step_p (struct gdbarch *gdbarch)
@@ -15168,6 +15171,16 @@  When on, breakpoint location specific debugging is enabled."),
 			   &setdebuglist, &showdebuglist);
+  add_setshow_boolean_cmd ("prefer-software-single-stepping", class_maintenance,
+			   &prefer_software_single_stepping, _("\
+Set whether software single-stepping is preferred."), _("\
+Show whether software single-stepping is preferred."), _("\
+When on, if both are available, software single-stepping is preferred over hardware single-stepping."),
+			   NULL,
+			   NULL,
+			   &maintenance_set_cmdlist,
+			   &maintenance_show_cmdlist);
   add_setshow_enum_cmd ("condition-evaluation", class_breakpoint,
 			&condition_evaluation_mode_1, _("\