* [RFA] Fix failed assertion hit in check_typedef
[not found] ` <20070227120239.GB5164@caradoc.them.org>
@ 2007-02-28 6:23 ` Joel Brobecker
2007-02-28 11:44 ` Daniel Jacobowitz
0 siblings, 1 reply; 3+ messages in thread
From: Joel Brobecker @ 2007-02-28 6:23 UTC (permalink / raw)
To: gdb-patches; +Cc: Jerome Guitton
[-- Attachment #1: Type: text/plain, Size: 993 bytes --]
[switching to gdb-patches]
Hi Daniel,
> How about doing it in the caller? If you go to check_typedef, you'll
> see that there's already an example of the same thing. If this is
> DWARF2 and only started happening recently it may be the fault of your
> recent fixes for what empty types constitute a declaration.
Duh, of course! I'm sorry for not having seen this.
Funny enough, just after I worked on this and sent this message to
this list, Someone from the Paris office hit this very same problem,
and I found a checkin in our tree waiting for me when I woke up.
I think the patch follows your suggestion, so here is a slightly
modified version.
2007-02-28 Jerome Guitton <guitton@adacore.com>
Joel Brobecker <brobecker@adacore.com>
* gdbtypes.c (check_typedef): Do not replace stub type if
the resolved type is not defined in the same objfile.
I tested it on x86-linux, no regression. Also fixes the problem
at hand.
OK to commit?
Thanks,
--
Joel
[-- Attachment #2: gdbtypes.c.diff --]
[-- Type: text/plain, Size: 905 bytes --]
Index: gdbtypes.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbtypes.c,v
retrieving revision 1.112
diff -u -p -r1.112 gdbtypes.c
--- gdbtypes.c 29 Jan 2007 17:31:05 -0000 1.112
+++ gdbtypes.c 27 Feb 2007 23:24:06 -0000
@@ -1514,7 +1514,15 @@ check_typedef (struct type *type)
}
sym = lookup_symbol (name, 0, STRUCT_DOMAIN, 0, (struct symtab **) NULL);
if (sym)
- make_cv_type (is_const, is_volatile, SYMBOL_TYPE (sym), &type);
+ {
+ /* Same as above for opaque types, we can replace the stub
+ with the complete type only if they are int the same
+ objfile. */
+ if (TYPE_OBJFILE (SYMBOL_TYPE(sym)) == TYPE_OBJFILE (type))
+ make_cv_type (is_const, is_volatile, SYMBOL_TYPE (sym), &type);
+ else
+ type = SYMBOL_TYPE (sym);
+ }
}
if (TYPE_TARGET_STUB (type))
^ permalink raw reply [flat|nested] 3+ messages in thread