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] PR symtab/13277: Resolving opaque structures in ICC generated binaries.


[ 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


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