This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA] Add global/static and symbol kind indicator to .gdb_index
On Fri, Jun 22, 2012 at 2:20 PM, Cary Coutant <ccoutant@google.com> wrote:
>> Doug> The global/static bit massively speeds up looking up things like
>> Doug> "int" when debugging with lots of shared libraries (all having
>> Doug> .gdb_index). ?PR 14125
>>
>> Tom> I don't think this patch is needed to achieve this. ?At least, the "int"
>> Tom> case and other similar cases were fixed by:
>>
>> Doug pointed out on irc that I was mistaken here.
>> The issue in his case is that, even though each individual index has a
>> single entry for "int", there are still many indices, so gdb still does
>> excessive CU expansion.
>> I'm sorry for the error.
>
> Is there still something I need to fix in gold in this regard? I think
> gold will produce an index entry for "int" in every CU that mentions
> it. If the right thing to do is to have only one CU, how do I decide
> what kinds of names get this treatment? (For example, some arbitrary
> type "struct foo" might actually be a different type, and you'd want
> multiple index entries.)
As a data point, using -fshort-double I created a program where gdb's
behaviour with the index is different than its behaviour without it.
Things like -fshort-double aren't well supported anyway, so I don't
know if this particular issue is something we want to worry about in
the near term.
fshort-double.c:
double normal_double;
extern void foo (void);
int
main ()
{
foo ();
return 0;
}
fshort-double-1.c:
double short_double;
void
foo ()
{
short_double = 42;
}
$ gcc -g -c fshort-double.c
$ gcc -g -c -fshort-double fshort-double-1.c
$ gcc -g fshort-double.o fshort-double-1.o
$ gdb a.out
(gdb) b foo
(gdb) p sizeof(double)
4
then
$ gdb-add-index a.out
$ gdb a.out
(gdb) b foo
(gdb) p sizeof(double)
8
[I can well believe there is more than one bug here though. :-)]