This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] Fix DW_OP_call2 and DW_OP_call4 for max-cache-age 0


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]