From: Pedro Alves <palves@redhat.com>
To: Phil Muldoon <pmuldoon@redhat.com>
Cc: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: Re: [patch] Convert frame_stash to a hash table
Date: Thu, 16 May 2013 14:23:00 -0000 [thread overview]
Message-ID: <5194EBEF.9040209@redhat.com> (raw)
In-Reply-To: <5194E424.9090605@redhat.com>
On 05/16/2013 02:50 PM, Phil Muldoon wrote:
> On 16/05/13 14:42, Pedro Alves wrote:
>> On 05/16/2013 02:09 PM, Phil Muldoon wrote:
>>
>> When doing a backtrace, you'll end up linearly walking the frame
>> chain, and normally you don't go back to newer frames -- unwind a
>> frame (frame.prev()), print info about it, unwind the next, print it,
>> on and on. As such, a single frame stashed in the frame stash should be
>> sufficient. But it's not. frapy_older does:
>
> When using frame filters, in the case of eliding frames this may not
> be the case. In fact we cannot predict how frame filters will
> navigate the stack.
For sure. However, I think in your backtrace example, the frame
filter actually did nothing, correct?
>
>
>> TRY_CATCH (except, RETURN_MASK_ALL)
>> {
>>
>> /* Try to get the previous frame, to determine if this is the last frame
>> in a corrupt stack. If so, we need to store the frame_id of the next
>> frame and not of this one (which is possibly invalid). */
>> if (get_prev_frame (frame) == NULL
>> && get_frame_unwind_stop_reason (frame) != UNWIND_NO_REASON
>> && get_next_frame (frame) != NULL)
>> {
>> frame_obj->frame_id = get_frame_id (get_next_frame (frame));
>> frame_obj->frame_id_is_next = 1;
>> }
>
>
> Yes, this is bogus. But even if you remove this, the performance hits
> still register as significant.
I'd expected that a simple filter (like I imagine yours was)
you'd not see any performance hit.
>
>> and given the present frame stash can only hold one frame,
>> these get_prev_frame/get_next_frame calls constantly invalidate it.
>> Now, I don't get this "detect corrupt stack" code at all.
>
> Me either, it should be removed. Hiding the corrupt stack from a
> Python consumer seems all kinds of wrong. I am going to fix this
> next. I decided not to include it in this patch, as I wanted the
> focus to be on frame_stash issues where Python scripts can randomly
> access frame from all over the stack.
OK. Again, I'm not questioning the merit of the patch, but the
example/rationale. :-) Personally, I'd rather that was fixed first,
and then the new frame hash stash justified/explained with
with an example where gdb's inefficiencies are exposed even when
gdb's python code is sane. :-)
> Take this example
>
> f = gdb.newest_frame()
>
> do some other inferior operations happen, stop.
>
> g = gdb.newest_frame()
>
> Now is I access f, say f.type(), that will not be in the frame_stash,
> it was from awhile ago. These kinds of patterns do crop up in frame
> filters, because we are filtering, eliding frames.
I'm confused. :-) If you do other inferior operations
that resume the inferior, then the new hash stash won't help either.
Resuming the inferior always invalidates all frames, along with the
stash.
--
Pedro Alves
next prev parent reply other threads:[~2013-05-16 14:23 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-16 13:09 Phil Muldoon
2013-05-16 13:42 ` Tom Tromey
2013-05-16 14:17 ` Phil Muldoon
2013-05-16 18:16 ` Tom Tromey
2013-05-16 19:03 ` Phil Muldoon
2013-05-16 19:07 ` Tom Tromey
2013-05-16 19:27 ` Phil Muldoon
2013-05-16 20:23 ` Tom Tromey
2013-05-17 8:39 ` Phil Muldoon
2013-05-16 13:42 ` Pedro Alves
2013-05-16 13:50 ` Phil Muldoon
2013-05-16 14:23 ` Pedro Alves [this message]
2013-05-16 14:27 ` Phil Muldoon
2013-05-16 14:41 ` Pedro Alves
2013-05-16 14:54 ` Phil Muldoon
2013-05-16 18:44 ` Pedro Alves
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=5194EBEF.9040209@redhat.com \
--to=palves@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=pmuldoon@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