This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: Crash of Archer's gdb on mingw (passing null argument to vasprintf)
On Mon, 2011-10-03 at 07:59 -0700, Joel Brobecker wrote:
> > In gdbtypes.c there's this code:
> >
> > warning (_("Range for type %s has invalid bounds %s..%s"),
> > TYPE_NAME (type), plongest (TYPE_LOW_BOUND (range_type)),
> > plongest (TYPE_HIGH_BOUND (range_type)));
> >
> > This goes wrong when TYPE_NAME (type) is null.
>
> We should several example of us handling this type of situation.
> Typically we use:
>
> TYPE_NAME (type) ? TYPE_NAME (type) : "<anonymous>"
I've found the TYPE_ERROR_NAME macro. Now another question: how do I
send a patch for inclusion in gdb? Can I send it to this list? Or
gdb-patches?
btw: patch is attached. First part will only apply to Archer though. (My
guess is the archer-jankratochvil-vla branch)
Regards,
Joost van der Slui
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -1527,7 +1544,7 @@ type_length_get (struct type *type, struct type *target_type, int full_span)
/* It may happen for wrong DWARF annotations returning garbage data. */
if (count < 0)
warning (_("Range for type %s has invalid bounds %s..%s"),
- TYPE_NAME (type), plongest (TYPE_LOW_BOUND (range_type)),
+ TYPE_ERROR_NAME (type), plongest (TYPE_LOW_BOUND (range_type)),
plongest (TYPE_HIGH_BOUND (range_type)));
/* The code below does not handle count == 0 right. */
if (count <= 0)
--- a/gdb/gnu-v3-abi.c
+++ b/gdb/gnu-v3-abi.c
@@ -319,7 +319,7 @@ gnuv3_rtti_type (struct value *value,
|| strncmp (vtable_symbol_name, "vtable for ", 11))
{
warning (_("can't find linker symbol for virtual table for `%s' value"),
- TYPE_NAME (values_type));
+ TYPE_ERROR_NAME (values_type));
if (vtable_symbol_name)
warning (_(" found `%s' instead"), vtable_symbol_name);
return NULL;