From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22063 invoked by alias); 25 Oct 2012 19:23:33 -0000 Received: (qmail 22049 invoked by uid 22791); 25 Oct 2012 19:23:31 -0000 X-SWARE-Spam-Status: No, hits=-5.1 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL,RP_MATCHES_RCVD,TW_HP X-Spam-Check-By: sourceware.org Received: from mms2.broadcom.com (HELO mms2.broadcom.com) (216.31.210.18) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 25 Oct 2012 19:23:28 +0000 Received: from [10.9.200.133] by mms2.broadcom.com with ESMTP (Broadcom SMTP Relay (Email Firewall v6.5)); Thu, 25 Oct 2012 12:21:35 -0700 X-Server-Uuid: 4500596E-606A-40F9-852D-14843D8201B2 Received: from mail-irva-13.broadcom.com (10.11.16.103) by IRVEXCHHUB02.corp.ad.broadcom.com (10.9.200.133) with Microsoft SMTP Server id 8.2.247.2; Thu, 25 Oct 2012 12:22:51 -0700 Received: from [10.177.252.215] (unknown [10.177.252.215]) by mail-irva-13.broadcom.com (Postfix) with ESMTP id 538F140FE4; Thu, 25 Oct 2012 12:23:20 -0700 (PDT) Message-ID: <508991A7.5030607@broadcom.com> Date: Thu, 25 Oct 2012 19:23:00 -0000 From: "Andrew Burgess" User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:16.0) Gecko/20121010 Thunderbird/16.0.1 MIME-Version: 1.0 To: "Jan Kratochvil" cc: "gdb-patches@sourceware.org" Subject: Re: [PATCH] improve python finish breakpoint for exceptions/longjmp case. References: <505C805A.1050400@broadcom.com> <20121011163241.GA9620@host2.jankratochvil.net> <507C7498.7040001@broadcom.com> <20121017162748.GA6546@host2.jankratochvil.net> In-Reply-To: <20121017162748.GA6546@host2.jankratochvil.net> Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes 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: 2012-10/txt/msg00515.txt.bz2 On 17/10/2012 5:27 PM, Jan Kratochvil wrote: > On Mon, 15 Oct 2012 22:39:52 +0200, Andrew Burgess wrote: >> @@ -295,11 +304,18 @@ bpfinishpy_init (PyObject *self, PyObject *args, PyObject *kwargs) >> AUTO_BOOLEAN_TRUE, >> &bkpt_breakpoint_ops, >> 0, 1, internal_bp, 0); >> + set_longjmp_breakpoint (inferior_thread (), null_frame_id); > > I find too intrusive to call set_longjmp_breakpoint here. > > A countercase - I did not try to reproduce it in real: > > * You have breakpoint installed at TRACEDFUNC and you automatically use > Python finish breakpoint to trace return values of TRACEDFUNC. > * User at CALLERFUNC will type in GDB CLI "finish". > * CALLERFUNC does a lot of processing and it also calls TRACEDFUNC. > * Now you overwide tp->INITIATING_FRAME of the user "finish" command by > null_frame_id which breaks the behavior in some way. I don't think this is a problem, the first finish will be cancelled when we stop for the second time in TRACEDFUNC. So, I think the chain of events will be: - Stop in TRACEDFUNC, create a finish breakpoint setting tp->INITIATING_FRAME to null_frame_id. - From the cli use "finish" command, change tp->INITIATING_FRAME. - User continues. - Recursively enter TRACEDFUNC, stopping. The finish breakpoint is now cancelled. At this point the first finish breakpoint is also cancelled, but this is a known bug at this point that I plan to work on later; and is no worse than current behaviour. - User creates new finish breakpoint, setting tp->INITIATING_FRAME, but that's fine as we have no "finish" in play at this point. Let me know if I've got this wrong and you can see a problem, especially if you think I've broken /other/ commands, that would be worse than just leaving the finish breakpoint stuff with a few broken edge cases. > You want to install the "longjmp breakpoint" there by > set_longjmp_breakpoint_for_call_dummy. You want to hook there > check_longjmp_breakpoint_for_call_dummy to call bpfinishpy_detect_out_scope_cb > in some way. Currently you do it on stop but that is too late, breakpoint may > may have been for example placed at stack trampoline function (code at the > stack) and the breakpoint instruction now corrupts live stack data there. Hmmm, I see the problem, I'll work on that one. Thanks for your time, Andrew