From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26139 invoked by alias); 10 Apr 2008 19:48:42 -0000 Received: (qmail 26085 invoked by uid 22791); 10 Apr 2008 19:48:42 -0000 X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (65.74.133.4) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 10 Apr 2008 19:48:25 +0000 Received: (qmail 30962 invoked from network); 10 Apr 2008 19:48:22 -0000 Received: from unknown (HELO localhost) (vladimir@127.0.0.2) by mail.codesourcery.com with ESMTPA; 10 Apr 2008 19:48:22 -0000 From: Vladimir Prus Date: Thu, 10 Apr 2008 20:00:00 -0000 Subject: [RFA] Fix disabling of longjmp breakpoint. To: gdb-patches@sources.redhat.com X-TUID: 3b0bd223ee18821c X-Length: 1929 X-UID: 157 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200804102348.19120.vladimir@codesourcery.com> Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2008-04/txt/msg00203.txt.bz2 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