[RFA] Fix failed assertion hit in check_typedef
Joel Brobecker
brobecker@adacore.com
Wed Feb 28 06:23:00 GMT 2007
[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
-------------- next part --------------
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))
More information about the Gdb-patches
mailing list