* cp-valprint.c (cplus_print_value): Don't dump core if the

baseclass doesn't have a name.
	* values.c (vb_match): New function, which finds the virtual
	base class pointer even if the types are nameless.
	(baseclass_{addr,offset}): Use it.
This commit is contained in:
Jim Kingdon
1993-07-30 01:42:09 +00:00
parent 0ccc65ec79
commit 1410f5f13b
3 changed files with 64 additions and 11 deletions

View File

@@ -338,6 +338,7 @@ cplus_print_value (type, valaddr, stream, format, recurse, pretty, dont_print)
{
char *baddr;
int err;
char *basename = TYPE_NAME (TYPE_BASECLASS (type, i));
if (BASETYPE_VIA_VIRTUAL (type, i))
{
@@ -357,8 +358,8 @@ cplus_print_value (type, valaddr, stream, format, recurse, pretty, dont_print)
/* Fix to use baseclass_offset instead. FIXME */
baddr = baseclass_addr (type, i, valaddr, 0, &err);
if (err == 0 && baddr == 0)
error ("could not find virtual baseclass `%s'\n",
type_name_no_tag (TYPE_BASECLASS (type, i)));
error ("could not find virtual baseclass %s\n",
basename ? basename : "");
if (pretty)
{
@@ -366,7 +367,9 @@ cplus_print_value (type, valaddr, stream, format, recurse, pretty, dont_print)
print_spaces_filtered (2 * recurse, stream);
}
fputs_filtered ("<", stream);
fputs_filtered (type_name_no_tag (TYPE_BASECLASS (type, i)), stream);
/* Not sure what the best notation is in the case where there is no
baseclass name. */
fputs_filtered (basename ? basename : "", stream);
fputs_filtered ("> = ", stream);
if (err != 0)
fprintf_filtered (stream, "<invalid address 0x%x>", baddr);