diff options
author | Pedro Alves <pedro@codesourcery.com> | 2008-07-09 22:27:13 +0000 |
---|---|---|
committer | Pedro Alves <pedro@codesourcery.com> | 2008-07-09 22:27:13 +0000 |
commit | 630d21a6ea3b02f5af279bee5345acd93a17513c (patch) | |
tree | fb17904b633ebf2348fbb638de2413f8757abcda | |
parent | f3e2a00b870a77535da1873d3fc1ba2d73b350d0 (diff) | |
download | gdb-630d21a6ea3b02f5af279bee5345acd93a17513c.tar.gz |
Add non_stop global.
* inferior.h (non_stop): Declare.
* infrun.c (non_stop, non_stop_1): New.
(set_non_stop, show_non_stop): New.
(_initialize_infrun): Add "set/show non-stop" command.
-rw-r--r-- | gdb/ChangeLog | 9 | ||||
-rw-r--r-- | gdb/inferior.h | 7 | ||||
-rw-r--r-- | gdb/infrun.c | 46 |
3 files changed, 62 insertions, 0 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 859a9a683d1..1b368739fd5 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,14 @@ 2008-07-09 Pedro Alves <pedro@codesourcery.com> + Add non_stop global. + + * inferior.h (non_stop): Declare. + * infrun.c (non_stop, non_stop_1): New. + (set_non_stop, show_non_stop): New. + (_initialize_infrun): Add "set/show non-stop" command. + +2008-07-09 Pedro Alves <pedro@codesourcery.com> + Adjust fork/vfork/exec to pass ptids around. * target.h (struct target_waitstatus): Store related_pid as a ptid. diff --git a/gdb/inferior.h b/gdb/inferior.h index 3c69d4ed71f..9cbf4b4f188 100644 --- a/gdb/inferior.h +++ b/gdb/inferior.h @@ -137,6 +137,13 @@ extern void proceed (CORE_ADDR, enum target_signal, int); over such function. */ extern int step_stop_if_no_debug; +/* If set, the inferior should be controlled in non-stop mode. In + this mode, each thread is controlled independently. Execution + commands apply only to the the selected thread by default, and stop + events stop only the thread that had the event -- the other threads + are kept running freely. */ +extern int non_stop; + extern void generic_mourn_inferior (void); extern void terminal_save_ours (void); diff --git a/gdb/infrun.c b/gdb/infrun.c index 0a87371704b..d9eca9fe1c7 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -4465,6 +4465,32 @@ save_inferior_ptid (void) } +int non_stop = 0; +static int non_stop_1 = 0; + +static void +set_non_stop (char *args, int from_tty, + struct cmd_list_element *c) +{ + if (target_has_execution) + { + non_stop_1 = non_stop; + error (_("Cannot change this setting while the inferior is running.")); + } + + non_stop = non_stop_1; +} + +static void +show_non_stop (struct ui_file *file, int from_tty, + struct cmd_list_element *c, const char *value) +{ + fprintf_filtered (file, + _("Controlling the inferior in non-stop mode is %s.\n"), + value); +} + + void _initialize_infrun (void) { @@ -4538,6 +4564,26 @@ When non-zero, displaced stepping specific debugging is enabled."), show_debug_displaced, &setdebuglist, &showdebuglist); + add_setshow_boolean_cmd ("non-stop", no_class, + &non_stop_1, _("\ +Set whether gdb controls the inferior in non-stop mode."), _("\ +Show whether gdb controls the inferior in non-stop mode."), _("\ +When debugging a multi-threaded program and this setting is\n\ +off (the default, also called all-stop mode), when one thread stops\n\ +(for a breakpoint, watchpoint, exception, or similar events), GDB stops\n\ +all other threads in the program while you interact with the thread of\n\ +interest. When you continue or step a thread, you can allow the other\n\ +threads to run, or have them remain stopped, but while you inspect any\n\ +thread's state, all threads stop.\n\ +\n\ +In non-stop mode, when one thread stops, other threads can continue\n\ +to run freely. You'll be able to step each thread independently,\n\ +leave it stopped or free to run as needed."), + set_non_stop, + show_non_stop, + &setlist, + &showlist); + numsigs = (int) TARGET_SIGNAL_LAST; signal_stop = (unsigned char *) xmalloc (sizeof (signal_stop[0]) * numsigs); signal_print = (unsigned char *) |