This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
patch to robustify gnuv3_rtti_type
- From: Per Bothner <per at bothner dot com>
- To: gdb-patches at sources dot redhat dot com
- Cc: per at bothner dot com
- Date: Sat, 19 Jan 2002 12:41:03 -0800
- Subject: patch to robustify gnuv3_rtti_type
Ok to check in? This doesn't fix the real problem, which is that
gcj produces vtables that aren't properly abi-compliant. Hopefully,
we'll fix that. But for now, let's at least prevent gdb from crashing.
* gnu-v3-abi.c (gnuv3_rtti_type): Guard that vtable_symbol_name
isn't NULL, which can happen with some gcj3.0-produced code.
--
--Per Bothner
per@bothner.com http://www.bothner.com/per/
Index: gnu-v3-abi.c
===================================================================
RCS file: /cvs/src/src/gdb/gnu-v3-abi.c,v
retrieving revision 1.6
diff -u -r1.6 gnu-v3-abi.c
--- gnu-v3-abi.c 2002/01/04 18:20:19 1.6
+++ gnu-v3-abi.c 2002/01/19 20:33:49
@@ -239,7 +239,8 @@
type_info object itself to get the class name. But this way
should work just as well, and doesn't read target memory. */
vtable_symbol_name = SYMBOL_DEMANGLED_NAME (vtable_symbol);
- if (strncmp (vtable_symbol_name, "vtable for ", 11))
+ if (vtable_symbol_name == NULL
+ || strncmp (vtable_symbol_name, "vtable for ", 11))
error ("can't find linker symbol for virtual table for `%s' value",
TYPE_NAME (value_type));
class_name = vtable_symbol_name + 11;