This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Spurious warnings about construction vtables.
- From: Chris Dodd <cdodd at acm dot org>
- To: gdb-patches at sourceware dot org
- Date: Mon, 17 Apr 2017 21:20:09 -0700
- Subject: Spurious warnings about construction vtables.
- Authentication-results: sourceware.org; auth=none
If you put a breakpoint in a C++ constructor, you often get a spurious
warning about the "construction vtable for CLASS". If you have a
condition on the breakpoint (becuase you only want a specific call of
the ctor and want to skip many up that point), you get a huge spew of
these warnings.
Here's a small patch that avoids the warning when it not actually
anything wrong happening:
index 0090990..2bd8d9a 100644
--- a/gdb/gnu-v3-abi.c
+++ b/gdb/gnu-v3-abi.c
@@ -327,8 +327,25 @@ gnuv3_rtti_type (struct value *value,
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 = MSYMBOL_DEMANGLED_NAME (vtable_symbol);
- if (vtable_symbol_name == NULL
- || !startswith (vtable_symbol_name, "vtable for "))
+ if (vtable_symbol_name && startswith (vtable_symbol_name, "vtable for "))
+ class_name = vtable_symbol_name + 11;
+ else if (vtable_symbol_name && startswith (vtable_symbol_name,
"construction vtable for "))
+ {
+ const char *tail;
+
+ class_name = vtable_symbol_name + 24;
+ tail = strstr(class_name, "-in-");
+ if (tail != NULL)
+ {
+ char *copy;
+
+ copy = (char *) alloca (tail - class_name + 1);
+ memcpy (copy, class_name, tail - class_name);
+ copy[tail - class_name] = '\0';
+ class_name = copy;
+ }
+ }
+ else
{
warning (_("can't find linker symbol for virtual table for `%s' value"),
TYPE_SAFE_NAME (values_type));
@@ -336,7 +353,6 @@ gnuv3_rtti_type (struct value *value,
warning (_(" found `%s' instead"), vtable_symbol_name);
return NULL;
}
- class_name = vtable_symbol_name + 11;
/* Strip off @plt and version suffixes. */
atsign = strchr (class_name, '@');
Chris Dodd
cdodd@acm.org