Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Daniel Jacobowitz <drow@false.org>
To: Joel Brobecker <brobecker@adacore.com>
Cc: gdb@sourceware.org
Subject: Re: More info on PR/9711 (quadratic slowdown for deep stack traces)
Date: Wed, 02 Sep 2009 11:43:00 -0000	[thread overview]
Message-ID: <20090902114303.GA30223@caradoc.them.org> (raw)
In-Reply-To: <20090901204815.GK4379@adacore.com>

On Tue, Sep 01, 2009 at 01:48:15PM -0700, Joel Brobecker wrote:
> One improvement I'm looking at is the fact that get_prev_frame is
> doing redundant checks when the previous frame has already been
> computed. So I'm currently testing the idea of adding:
> 
>   if (this_frame->prev_p)
>     return this_frame->prev;
> 
> (before doing the various checks and then calling get_prev_frame_1).
> Does anyone see why this would be a problem? It does not change the

This almost, almost works.  I can see two problems:

* Can the results of those checks ever change?  For instance, does
"set backtrace past-main off" flush the stack frame?  If not, it won't
take effect right away after this change.

* There are places that call get_prev_frame_1 directly.  So one frame
past main may be in the chain, but we usually don't want it.

Now, the results of the checks could be cached in the frame object...

> There might be some other micro optimizations that we could do,
> I haven't looked further. But to break the quadratic behavior,
> I suspect we need to avoid the call to frame_find_by_id, which means
> that we would net to have prev_register routine return the frame in
> addition to the value - I think that we would have to be very careful
> with what we do with the frame.

Have frame_find_by_id keep a cache with the same lifetime as
current_frame.  If it saves the last frame it returned, we can try
that frame and the previous frame before going on to searching from
the current frame.

Also, have frame_find_by_id use get_prev_frame_1?  I'm not sure why we
don't.  You'd have to look at the callers, but I can't see the problem.

-- 
Daniel Jacobowitz
CodeSourcery


  parent reply	other threads:[~2009-09-02 11:43 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-01 20:48 Joel Brobecker
2009-09-02  3:42 ` Paul Pluzhnikov
2009-09-02  4:52   ` Joel Brobecker
2009-09-02  4:57     ` Paul Pluzhnikov
2009-09-02 11:43 ` Daniel Jacobowitz [this message]
2009-09-02 16:24   ` Joel Brobecker
2009-09-03 18:40     ` Joel Brobecker

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=20090902114303.GA30223@caradoc.them.org \
    --to=drow@false.org \
    --cc=brobecker@adacore.com \
    --cc=gdb@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