Skip to content

Commit

Permalink
Fix ctor vtable symbol recognition
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Dodd authored and ChrisDodd committed Jan 22, 2024
1 parent 58ce812 commit 1f0d539
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions gdb/gnu-v3-abi.c
Original file line number Diff line number Diff line change
Expand Up @@ -343,16 +343,32 @@ 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 = vtable_symbol->demangled_name ();
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));
if (vtable_symbol_name)
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, '@');
Expand Down

0 comments on commit 1f0d539

Please sign in to comment.