This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFC] 03/10 Add non-stop global


This patch adds a non_stop global and associated set/show non-stop commands.

It is very simplistic and doesn't have any target support checks.  we still
haven't decided on how to do those, and how to report this to the frontends.
Plus, it will need docs.

But, the rest of the series depends on the global, so here it is.

-- 
Pedro Alves
2008-05-06  Pedro Alves  <pedro@codesourcery.com>

	* 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.

---
 gdb/inferior.h |    7 +++++++
 gdb/infrun.c   |   36 ++++++++++++++++++++++++++++++++++++
 2 files changed, 43 insertions(+)

Index: src/gdb/inferior.h
===================================================================
--- src.orig/gdb/inferior.h	2008-05-06 12:18:12.000000000 +0100
+++ src/gdb/inferior.h	2008-05-06 12:18:16.000000000 +0100
@@ -137,6 +137,13 @@ extern void proceed (CORE_ADDR, enum tar
    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.  Commands apply
+   to the selected thread only by default, and stop events stops 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);
Index: src/gdb/infrun.c
===================================================================
--- src.orig/gdb/infrun.c	2008-05-06 12:18:12.000000000 +0100
+++ src/gdb/infrun.c	2008-05-06 12:18:43.000000000 +0100
@@ -4460,6 +4460,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)
 {
@@ -4533,6 +4559,16 @@ When non-zero, displaced stepping specif
 			    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."), _("\
+Tells gdb whether to control the inferior in non-stop mode."),
+			   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 *)

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]