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] Fix disabling of longjmp breakpoint.


The current code in step_1_continuation fails to disable
longjmp breakpoint. When we're done with 'step N', we call step_once
with the count of 0, which does nothing, and we don't remove the
breakpoint. We only remove it when we stop for some reason that
is not stepping.

Since step_1_continuation is used for 'step', not just 'step N',
it means we pretty much always fail to remove longjmp breakpoint.
Now, in always-inserted mode it causes an attempt to insert
longjmp breakpoint when restarting the program, which fails.

This patch fixes the logic in step_1_continuation to always
cleanup properly. It should be applied on top of the exec_cleanup
murder patch.

This patch was actually written by Pedro Alves, and I got to
test it since it's located between two other patches of mine :-)

OK?

- Volodya

	* infcmd.c (step_1_continuation): Always disable longjmp
	breakpoint if we're not going to do another step.
---
 gdb/infcmd.c |   33 +++++++++++++++++----------------
 1 files changed, 17 insertions(+), 16 deletions(-)

diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index 0b4dc5d..238c001 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -798,24 +798,25 @@ which has no line number information.\n"), name);
 static void
 step_1_continuation (struct continuation_arg *arg, int error)
 {
-  if (error)
-    disable_longjmp_breakpoint ();
-  else
-    {
-      int count;
-      int skip_subroutines;
-      int single_inst;
+  int count;
+  int skip_subroutines;
+  int single_inst;
       
-      skip_subroutines = arg->data.integer;
-      single_inst      = arg->next->data.integer;
-      count            = arg->next->next->data.integer;
-      
-      if (stop_step)
-	step_once (skip_subroutines, single_inst, count - 1);
-      else
-	if (!single_inst || skip_subroutines)
-	  disable_longjmp_breakpoint ();
+  skip_subroutines = arg->data.integer;
+  single_inst      = arg->next->data.integer;
+  count            = arg->next->next->data.integer;
+
+  if (error || !step_multi || !stop_step)
+    {
+      /* We either hit an error, or stopped for some reason
+	 that is not stepping, or there are no further steps
+	 to make.  Cleanup.  */
+      if (!single_inst || skip_subroutines)
+	disable_longjmp_breakpoint ();
+      step_multi = 0;
     }
+  else
+    step_once (skip_subroutines, single_inst, count - 1);
 }
 
 /* Do just one step operation. If count >1 we will have to set up a
-- 
1.5.3.5


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