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]

[RFA] Don't suppress *running when doing finish.


I've noticed that we don't output *running for the -exec-finish command.
Originally, when I changed *stopped to be emitted via observer, I introduced
suppress_stop_observer variable, which is set inside finish_command. This
is necessary to delay the observer call until finish_command_continuation.
Then, I've introduced *running, which also has to be blocked sometimes.
So, I've renamed suppress_stop_observer to suppress_resume_stop_observers,
and set those to 1 when necessary. However, this also made *running blocked
for finish, which is not the expected effect.

This patch splits suppress_run_stop_observers into suppress_resume_observer
and suppress_stop_observer, so that we disable only observers we need to.

Of course, this bug should be detected by testsuite, in theory. The reason
it's not is that *running patterns are optional. Making them always required,
right now, will break, due to uninteresting for frontends, but significant
for testsuite, differences between sync and async mode output. I have a patch
to fix that, but it's actually unrelated to this one.

OK?

- Volodya

	* infcall.c (call_function_by_hand): Set both
	suppress_resume_observer and suppress_stop_observer.
	* infcmd.c (suppress_run_stop_observers): Split into...
	(suppress_resume_observer, suppress_stop_observer): ...those.
	(finish_command_continuation): Clear suppress_stop_observer.
	(finish_command): Set suppress_stop_observer.
	* inferior.h (suppress_run_stop_observers): Split into...
	(suppress_resume_observer, suppress_stop_observer): ...those.
	* infrun.c (normal_stop): Check for suppress_stop_observer.
	* thread.c (set_running): Check for suppress_resume_observer.
---
 gdb/infcall.c  |    6 ++++--
 gdb/infcmd.c   |   13 +++++++------
 gdb/inferior.h |    6 +++++-
 gdb/infrun.c   |    2 +-
 gdb/thread.c   |    6 +++---
 5 files changed, 20 insertions(+), 13 deletions(-)

diff --git a/gdb/infcall.c b/gdb/infcall.c
index 89b0d80..4fef53f 100644
--- a/gdb/infcall.c
+++ b/gdb/infcall.c
@@ -725,8 +725,10 @@ call_function_by_hand (struct value *function, int nargs, struct value **args)
     proceed_to_inferior_function_call = 1; /* Don't change the user
 					      selected frame in
 					      normal_stop.  */
-    make_cleanup_restore_integer (&suppress_run_stop_observers);
-    suppress_run_stop_observers = 1;
+    make_cleanup_restore_integer (&suppress_resume_observer);
+    suppress_resume_observer = 1;
+    make_cleanup_restore_integer (&suppress_stop_observer);
+    suppress_stop_observer = 1;
     proceed (real_pc, TARGET_SIGNAL_0, 0);
     do_cleanups (old_cleanups2);
 
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index d88c5da..ae3668f 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -207,9 +207,10 @@ int step_multi;
 
 struct gdb_environ *inferior_environ;
 
-/* When set, normal_stop will not call the normal_stop observer.
-   Resume observer likewise will not be called.  */
-int suppress_run_stop_observers = 0;
+/* When set, no calls to target_resumed observer will be made.  */
+int suppress_resume_observer = 0;
+/* When set, normal_stop will not call the normal_stop observer.  */
+int suppress_stop_observer = 0;
 
 /* Accessor routines. */
 
@@ -1351,7 +1352,7 @@ finish_command_continuation (struct continuation_arg *arg, int error_p)
       observer_notify_normal_stop (stop_bpstat);
     }
 
-  suppress_run_stop_observers = 0;
+  suppress_stop_observer = 0;
   delete_breakpoint (breakpoint);
 }
 
@@ -1418,8 +1419,8 @@ finish_command (char *arg, int from_tty)
     }
 
   proceed_to_finish = 1;	/* We want stop_registers, please...  */
-  make_cleanup_restore_integer (&suppress_run_stop_observers);
-  suppress_run_stop_observers = 1;
+  make_cleanup_restore_integer (&suppress_stop_observer);
+  suppress_stop_observer = 1;
   proceed ((CORE_ADDR) -1, TARGET_SIGNAL_DEFAULT, 0);
 
   arg1 =
diff --git a/gdb/inferior.h b/gdb/inferior.h
index 70fccc1..f4c6b83 100644
--- a/gdb/inferior.h
+++ b/gdb/inferior.h
@@ -426,7 +426,11 @@ extern void restore_selected_thread_and_frame (void);
 extern void select_thread_if_no_thread_selected (void);
 
 /* When set, normal_stop will not call the normal_stop observer.  */
-extern int suppress_run_stop_observers;
+extern int suppress_stop_observer;
+
+/* When set, no calls to target_resumed observer will be made.  */
+extern int suppress_resume_observer;
+
 
 /* Possible values for gdbarch_call_dummy_location.  */
 #define ON_STACK 1
diff --git a/gdb/infrun.c b/gdb/infrun.c
index 05ae2c5..47b89bd 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -4073,7 +4073,7 @@ Further execution is probably impossible.\n"));
 
 done:
   annotate_stopped ();
-  if (!suppress_run_stop_observers && !step_multi)
+  if (!suppress_stop_observer && !step_multi)
     observer_notify_normal_stop (stop_bpstat);
   /* Delete the breakpoint we stopped at, if it wants to be deleted.
      Delete any breakpoint that is to be deleted at the next stop.  */
diff --git a/gdb/thread.c b/gdb/thread.c
index 3339ab1..42cb521 100644
--- a/gdb/thread.c
+++ b/gdb/thread.c
@@ -581,7 +581,7 @@ set_running (ptid_t ptid, int running)
 	 state.  */
       if (running
 	  && main_thread_state != THREAD_RUNNING
-	  && !suppress_run_stop_observers)
+	  && !suppress_resume_observer)
 	observer_notify_target_resumed (ptid);
       main_thread_state = running ? THREAD_RUNNING : THREAD_STOPPED;
       return;
@@ -601,7 +601,7 @@ set_running (ptid_t ptid, int running)
  	    any_started = 1;
 	  tp->state_ = running ? THREAD_RUNNING : THREAD_STOPPED;
 	}
-      if (any_started && !suppress_run_stop_observers)
+      if (any_started && !suppress_resume_observer)
 	observer_notify_target_resumed (ptid);      
     }
   else
@@ -613,7 +613,7 @@ set_running (ptid_t ptid, int running)
       if (running && tp->state_ == THREAD_STOPPED)
 	started = 1;
       tp->state_ = running ? THREAD_RUNNING : THREAD_STOPPED;
-      if (started && !suppress_run_stop_observers)
+      if (started && !suppress_resume_observer)
  	observer_notify_target_resumed (ptid);
     }
 }
-- 
1.5.3.5


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