Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Vladimir Prus <vladimir@codesourcery.com>
To: gdb-patches@sources.redhat.com
Subject: [RFA] Fix disabling of longjmp breakpoint.
Date: Thu, 10 Apr 2008 20:00:00 -0000	[thread overview]
Message-ID: <200804102348.19120.vladimir@codesourcery.com> (raw)


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


             reply	other threads:[~2008-04-10 19:48 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-10 20:00 Vladimir Prus [this message]
2008-04-17 16:47 ` Daniel Jacobowitz
2008-04-17 16:55   ` Pedro Alves
2008-04-17 17:22     ` Pedro Alves
2008-04-24 13:01       ` Vladimir Prus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200804102348.19120.vladimir@codesourcery.com \
    --to=vladimir@codesourcery.com \
    --cc=gdb-patches@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox