From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: Andrew Burgess <aburgess@broadcom.com>
Cc: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: Re: [PATCH] improve python finish breakpoint for exceptions/longjmp case.
Date: Tue, 30 Oct 2012 17:41:00 -0000 [thread overview]
Message-ID: <20121030174041.GA12889@host2.jankratochvil.net> (raw)
In-Reply-To: <508991A7.5030607@broadcom.com>
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
next prev parent reply other threads:[~2012-10-30 17:41 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-21 14:58 Andrew Burgess
2012-09-24 10:22 ` Kevin Pouget
2012-10-01 16:33 ` Andrew Burgess
2012-10-01 16:30 ` Andrew Burgess
2012-10-10 21:08 ` Andrew Burgess
2012-10-11 6:46 ` Phil Muldoon
2012-10-11 16:32 ` Jan Kratochvil
2012-10-15 20:40 ` Andrew Burgess
2012-10-17 16:28 ` Jan Kratochvil
2012-10-24 20:48 ` Andrew Burgess
2012-10-25 6:13 ` Jan Kratochvil
2012-10-25 19:23 ` Andrew Burgess
2012-10-30 17:41 ` Jan Kratochvil [this message]
2012-11-06 14:24 ` Andrew Burgess
2012-11-22 18:15 ` Jan Kratochvil
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=20121030174041.GA12889@host2.jankratochvil.net \
--to=jan.kratochvil@redhat.com \
--cc=aburgess@broadcom.com \
--cc=gdb-patches@sourceware.org \
/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