From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19962 invoked by alias); 30 Oct 2012 17:41:03 -0000 Received: (qmail 19638 invoked by uid 22791); 30 Oct 2012 17:40:59 -0000 X-SWARE-Spam-Status: No, hits=-6.6 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,RCVD_IN_DNSWL_HI,RCVD_IN_HOSTKARMA_W,RP_MATCHES_RCVD,SPF_HELO_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 30 Oct 2012 17:40:53 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q9UHekCS007516 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 30 Oct 2012 13:40:46 -0400 Received: from host2.jankratochvil.net (ovpn-116-77.ams2.redhat.com [10.36.116.77]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q9UHefqk024877 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Tue, 30 Oct 2012 13:40:44 -0400 Date: Tue, 30 Oct 2012 17:41:00 -0000 From: Jan Kratochvil To: Andrew Burgess Cc: "gdb-patches@sourceware.org" Subject: Re: [PATCH] improve python finish breakpoint for exceptions/longjmp case. Message-ID: <20121030174041.GA12889@host2.jankratochvil.net> References: <505C805A.1050400@broadcom.com> <20121011163241.GA9620@host2.jankratochvil.net> <507C7498.7040001@broadcom.com> <20121017162748.GA6546@host2.jankratochvil.net> <508991A7.5030607@broadcom.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <508991A7.5030607@broadcom.com> User-Agent: Mutt/1.5.21 (2010-09-15) 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/msg00551.txt.bz2 On Thu, 25 Oct 2012 21:23:19 +0200, Andrew Burgess wrote: > On 17/10/2012 5:27 PM, Jan Kratochvil wrote: > > 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. OK, I see my countercase was not right. Anyway we agree it is not transparent to "finish" anyway but this is more a problem there are no observer-like breakpoints: ==> finish.c <== void g (void) {} void f (void) { g (); } int main (void) { f (); return 0; } ==> finish.cmd <== file ./finish start step break g commands echo hook-g\n continue end finish ------------------- hook-g Actual: [Inferior 1 (process 13204) exited normally] (gdb) _ Expected: main () at finish.c:7 7 return 0; (gdb) _ > > 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. Anyway the example above was given to convince you to the cleaner check_longjmp_breakpoint_for_call_dummy solution. Thanks, Jan