This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [patch] PR symtab/13277: Resolving opaque structures in ICC generated binaries.
- From: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- To: John Steele Scott <toojays at toojays dot net>
- Cc: Tom Tromey <tromey at redhat dot com>, gdb-patches at sourceware dot org, Joel Brobecker <brobecker at adacore dot com>
- Date: Sun, 20 May 2012 15:17:19 +0200
- Subject: Re: [patch] PR symtab/13277: Resolving opaque structures in ICC generated binaries.
- References: <4EA3E995.8040206@toojays.net> <20111026221057.GA24628@host1.jankratochvil.net> <4EBFB451.8030503@toojays.net> <m37h31mhhi.fsf@fleche.redhat.com> <4FA4912E.9050709@toojays.net> <20120512183722.GA20606@host2.jankratochvil.net> <4FB10DD8.7040501@toojays.net> <20120518144642.GA19690@host2.jankratochvil.net> <4FB8E4BD.6000501@toojays.net> <20120520130919.GA6990@host2.jankratochvil.net>
[ Cc to gdb-patches has been lost. ]
On Sun, 20 May 2012 15:09:19 +0200, Jan Kratochvil wrote:
Hi John,
On Sun, 20 May 2012 14:34:05 +0200, John Steele Scott wrote:
> basic_lookup_transparent_type will only do one psymbol->symbol expansion per
> call. For a frequently referenced opaque type in a non-trivial program,
> initially "ptype" will show it as "no data fields". But if I repeatedly
> invoke ptype, eventually it resolves the type correctly.
sorry I did not write a proper reproducer + testcase for it but I believe the
attached patch should fix it. It is probably a regression since introduction
of quick_symbol_functions.
> On the question of caching the producer info in the dwarf2_cu; I propose to
> extract out the second half of producer_is_gxx_lt_4_6 into a new
> check_producer function which will set cu->producer_is_gxx_lt_4_6 and
> cu->producer_is_icc as appropriate (and then set cu->checked_producer).
> producer_is_gxx_lt_4_6 and producer_is_icc will call check_producer if
> cu->checked_producer is not set. Sound okay?
Yes, I find such approach appropriate.
Thanks,
Jan
gdb/
2012-05-20 Jan Kratochvil <jan.kratochvil@redhat.com>
* psymtab.c (lookup_symbol_aux_psymtabs): New variable stab_best. Use
it as a fallback for TYPE_IS_OPAQUE.
diff --git a/gdb/psymtab.c b/gdb/psymtab.c
index e463fff..647368c 100644
--- a/gdb/psymtab.c
+++ b/gdb/psymtab.c
@@ -510,6 +510,7 @@ lookup_symbol_aux_psymtabs (struct objfile *objfile,
{
struct partial_symtab *ps;
const int psymtab_index = (block_index == GLOBAL_BLOCK ? 1 : 0);
+ struct symtab *stab_best = NULL;
ALL_OBJFILE_PSYMTABS_REQUIRED (objfile, ps)
{
@@ -530,13 +531,18 @@ lookup_symbol_aux_psymtabs (struct objfile *objfile,
}
if (sym && strcmp_iw (SYMBOL_SEARCH_NAME (sym), name) == 0)
- return stab;
+ {
+ if (!TYPE_IS_OPAQUE (SYMBOL_TYPE (sym)))
+ return stab;
+
+ stab_best = stab;
+ }
/* Keep looking through other psymtabs. */
}
}
- return NULL;
+ return stab_best;
}
/* Look in PST for a symbol in DOMAIN whose name matches NAME. Search