[patch] Do not add partial_symbol again and again to the list

Daniel Jacobowitz drow@false.org
Tue Feb 12 02:12:00 GMT 2008


On Mon, Feb 11, 2008 at 08:07:55PM -0500, Aleksandar Ristovski wrote:
> struct dwarf2_cu has a pointer to struct objfile, which (if I'm not 
> mistaken) get's allocated per compilation unit.

That's where your confusion is.  An objfile is something like
"/lib/libc.so.6", a linked file.  A compilation unit is something
like "init.o", a single "gcc -c" output.

Look at how n_static_syms is set in dwarf2read.c to see how
multiple psymtabs, for different CUs, share the same static_psymbols
list.

>>> Not sure if it is a valid indicator but I didn't have any regressions 
>>> in 'make check'.
>>
>> Yeah, I think I could write some testcases that were affected by this,
>> but I'm not sure.  It's tricky because if something else causes the
>> full symtab to load, the problem won't appear.
>
> Yes, that is the tricky part. We want lookup by symbol name to occur in 
> order to test this. Maybe adding a maintenance command that would 
> explicitly lookup a partial symbol by name?

The trick for writing testcases is to not stop in the second file or
"list" it or set a breakpoint in it; any of those things will load the
symtab.

-- 
Daniel Jacobowitz
CodeSourcery



More information about the Gdb-patches mailing list