diff options
Diffstat (limited to 'gdb/target.c')
-rw-r--r-- | gdb/target.c | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/gdb/target.c b/gdb/target.c index 4b7d518..3f49079 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -3781,6 +3781,67 @@ maint_show_target_async_command (struct ui_file *file, int from_tty, "asynchronous mode is %s.\n"), value); } +/* Return true if the target operates in non-stop mode even with "set + non-stop off". */ + +static int +target_always_non_stop_p (void) +{ + return current_target.to_always_non_stop_p (¤t_target); +} + +/* See target.h. */ + +int +target_is_non_stop_p (void) +{ + return (non_stop + || target_non_stop_enabled == AUTO_BOOLEAN_TRUE + || (target_non_stop_enabled == AUTO_BOOLEAN_AUTO + && target_always_non_stop_p ())); +} + +/* Controls if targets can report that they always run in non-stop + mode. This is just for maintainers to use when debugging gdb. */ +enum auto_boolean target_non_stop_enabled = AUTO_BOOLEAN_AUTO; + +/* The set command writes to this variable. If the inferior is + executing, target_non_stop_enabled is *not* updated. */ +static enum auto_boolean target_non_stop_enabled_1 = AUTO_BOOLEAN_AUTO; + +/* Implementation of "maint set target-non-stop". */ + +static void +maint_set_target_non_stop_command (char *args, int from_tty, + struct cmd_list_element *c) +{ + if (have_live_inferiors ()) + { + target_non_stop_enabled_1 = target_non_stop_enabled; + error (_("Cannot change this setting while the inferior is running.")); + } + + target_non_stop_enabled = target_non_stop_enabled_1; +} + +/* Implementation of "maint show target-non-stop". */ + +static void +maint_show_target_non_stop_command (struct ui_file *file, int from_tty, + struct cmd_list_element *c, + const char *value) +{ + if (target_non_stop_enabled == AUTO_BOOLEAN_AUTO) + fprintf_filtered (file, + _("Whether the target is always in non-stop mode " + "is %s (currently %s).\n"), value, + target_always_non_stop_p () ? "on" : "off"); + else + fprintf_filtered (file, + _("Whether the target is always in non-stop mode " + "is %s.\n"), value); +} + /* Temporary copies of permission settings. */ static int may_write_registers_1 = 1; @@ -3883,6 +3944,16 @@ Tells gdb whether to control the inferior in asynchronous mode."), &maintenance_set_cmdlist, &maintenance_show_cmdlist); + add_setshow_auto_boolean_cmd ("target-non-stop", no_class, + &target_non_stop_enabled_1, _("\ +Set whether gdb always controls the inferior in non-stop mode."), _("\ +Show whether gdb always controls the inferior in non-stop mode."), _("\ +Tells gdb whether to control the inferior in non-stop mode."), + maint_set_target_non_stop_command, + maint_show_target_non_stop_command, + &maintenance_set_cmdlist, + &maintenance_show_cmdlist); + add_setshow_boolean_cmd ("may-write-registers", class_support, &may_write_registers_1, _("\ Set permission to write into registers."), _("\ |