public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: Doug Evans <dje@google.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [patch] Fix DW_OP_call2 and DW_OP_call4 for max-cache-age 0
Date: Thu, 02 Sep 2010 17:13:00 -0000	[thread overview]
Message-ID: <20100902160216.GA10848@host1.dyn.jankratochvil.net> (raw)
In-Reply-To: <AANLkTimhw307GT1dxA5LFBnCA1njK1vk4+Sk8oamafkX@mail.gmail.com>

On Mon, 23 Aug 2010 21:30:06 +0200, Doug Evans wrote:
> On Mon, Aug 23, 2010 at 11:50 AM, Jan Kratochvil <jan.kratochvil@redhat.com> wrote:
> > as discussed on #gdb when you set max-cache-age 0 DW_OP_call{2,4} crashed GDB.
[...]
> > --- a/gdb/dwarf2read.c
> > +++ b/gdb/dwarf2read.c
> > @@ -1636,6 +1636,11 @@ dw2_do_instantiate_symtab (struct objfile *objfile,
> >  {
> >   struct cleanup *back_to;
> >
> > +  /* Age the cache, releasing compilation units that have not been used
> > +     recently.  Age them first so that we do not age out the requested PER_CU
> > +     unit if DWARF2_MAX_CACHE_AGE is too low.  */
> > +  age_cached_comp_units ();
> 
> Aging cached units first feels weird (if not wrong at least weird); we
> may toss out something we're about to want.
> At the least IWBN to elaborate on why this fixes things.

As otherwise we will age out what we have found (on max-cache-age 0).

One could forbid value zero for max-cache-age but that also does not seem
right to me.

There is such a general cleanup moment when GDB is fully idle
- prepare_execute_command() - shouldn't age_cached_comp_units be called there?

But that way sooner or later we will age out every CU.  This may occur a bit
even nowadays, the default value 5 is also very low.  max-cache-age as "how
long" is IMO not userful to the user.  There could be more a setting "how
many" CUs can be loaded at once.  CU age would be then just an internal
indicator to maintain the count under the "how many" limit.

I would change "max-cache-age" to "max-cache-size" and call it from
prepare_execute_command() instead.  I will provide a patch if not replied.


Thanks,
Jan

  reply	other threads:[~2010-09-02 16:02 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-23 18:50 Jan Kratochvil
2010-08-23 19:30 ` Doug Evans
2010-09-02 17:13   ` Jan Kratochvil [this message]
2010-09-02 19:33     ` Doug Evans
2011-07-13 15:21       ` [patch] Fix DW_OP_call2 and DW_OP_call4 for max-cache-age 0 #2 Jan Kratochvil
2011-07-19 20:55         ` Jan Kratochvil
2010-09-03 15:42     ` [patch] Fix DW_OP_call2 and DW_OP_call4 for max-cache-age 0 Tom Tromey
2010-09-03 16:14       ` Jan Kratochvil
2010-09-03 18:06         ` Doug Evans
2010-09-06 11:29           ` Jan Kratochvil
2010-09-06 22:29             ` Doug Evans
2010-09-08 12:26             ` Tom Tromey

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=20100902160216.GA10848@host1.dyn.jankratochvil.net \
    --to=jan.kratochvil@redhat.com \
    --cc=dje@google.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).