forked from Imagelibrary/binutils-gdb
* debug.c (debug_make_undefined_tagged_type): Make sure we are
given a kind of type we can handle. (debug_write_type): Handle undefined enums and structs. (debug_write_class_type): Handle undefined classes. * prdbg.c (pr_enum_type): Handle an undefined enum. Also comment changes to debug.h.
This commit is contained in:
@@ -1,3 +1,11 @@
|
||||
Thu Jan 11 11:45:34 1996 Ian Lance Taylor <ian@cygnus.com>
|
||||
|
||||
* debug.c (debug_make_undefined_tagged_type): Make sure we are
|
||||
given a kind of type we can handle.
|
||||
(debug_write_type): Handle undefined enums and structs.
|
||||
(debug_write_class_type): Handle undefined classes.
|
||||
* prdbg.c (pr_enum_type): Handle an undefined enum.
|
||||
|
||||
Wed Jan 10 15:33:18 1996 Ian Lance Taylor <ian@cygnus.com>
|
||||
|
||||
* Makefile.in: Updated dependencies.
|
||||
|
||||
@@ -1706,6 +1706,20 @@ debug_make_undefined_tagged_type (handle, name, kind)
|
||||
if (name == NULL)
|
||||
return DEBUG_TYPE_NULL;
|
||||
|
||||
switch (kind)
|
||||
{
|
||||
case DEBUG_KIND_STRUCT:
|
||||
case DEBUG_KIND_UNION:
|
||||
case DEBUG_KIND_CLASS:
|
||||
case DEBUG_KIND_UNION_CLASS:
|
||||
case DEBUG_KIND_ENUM:
|
||||
break;
|
||||
|
||||
default:
|
||||
debug_error ("debug_make_undefined_type: unsupported kind");
|
||||
return DEBUG_TYPE_NULL;
|
||||
}
|
||||
|
||||
t = debug_make_type (info, kind, 0);
|
||||
if (t == NULL)
|
||||
return DEBUG_TYPE_NULL;
|
||||
@@ -2250,19 +2264,24 @@ debug_write_type (info, fns, fhandle, type, name)
|
||||
return (*fns->bool_type) (fhandle, type->size);
|
||||
case DEBUG_KIND_STRUCT:
|
||||
case DEBUG_KIND_UNION:
|
||||
if (type->u.kclass != NULL)
|
||||
{
|
||||
if (info->class_mark == type->u.kclass->mark)
|
||||
{
|
||||
/* We are currently outputting this struct. I don't know if
|
||||
this can happen, but it can happen for a class. */
|
||||
/* We are currently outputting this struct. I don't
|
||||
know if this can happen, but it can happen for a
|
||||
class. */
|
||||
return (*fns->tag_type) (fhandle, "?defining?", type->kind);
|
||||
}
|
||||
type->u.kclass->mark = info->class_mark;
|
||||
}
|
||||
|
||||
if (! (*fns->start_struct_type) (fhandle, tag,
|
||||
type->kind == DEBUG_KIND_STRUCT,
|
||||
type->size))
|
||||
return false;
|
||||
if (type->u.kclass->fields != NULL)
|
||||
if (type->u.kclass != NULL
|
||||
&& type->u.kclass->fields != NULL)
|
||||
{
|
||||
for (i = 0; type->u.kclass->fields[i] != NULL; i++)
|
||||
{
|
||||
@@ -2281,6 +2300,9 @@ debug_write_type (info, fns, fhandle, type, name)
|
||||
case DEBUG_KIND_UNION_CLASS:
|
||||
return debug_write_class_type (info, fns, fhandle, type, tag);
|
||||
case DEBUG_KIND_ENUM:
|
||||
if (type->u.kenum == NULL)
|
||||
return (*fns->enum_type) (fhandle, tag, (const char **) NULL,
|
||||
(bfd_signed_vma *) NULL);
|
||||
return (*fns->enum_type) (fhandle, tag, type->u.kenum->names,
|
||||
type->u.kenum->values);
|
||||
case DEBUG_KIND_POINTER:
|
||||
@@ -2389,10 +2411,12 @@ debug_write_class_type (info, fns, fhandle, type, tag)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
if (type->u.kclass != NULL)
|
||||
{
|
||||
if (info->class_mark == type->u.kclass->mark)
|
||||
{
|
||||
/* We are currently outputting this class. This can happen when
|
||||
there are methods for an anonymous class. */
|
||||
/* We are currently outputting this class. This can happen
|
||||
when there are methods for an anonymous class. */
|
||||
return (*fns->tag_type) (fhandle, "?defining?", type->kind);
|
||||
}
|
||||
type->u.kclass->mark = info->class_mark;
|
||||
@@ -2400,10 +2424,12 @@ debug_write_class_type (info, fns, fhandle, type, tag)
|
||||
if (type->u.kclass->vptrbase != NULL
|
||||
&& type->u.kclass->vptrbase != type)
|
||||
{
|
||||
if (! debug_write_type (info, fns, fhandle, type->u.kclass->vptrbase,
|
||||
if (! debug_write_type (info, fns, fhandle,
|
||||
type->u.kclass->vptrbase,
|
||||
(struct debug_name *) NULL))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (! (*fns->start_class_type) (fhandle, tag,
|
||||
type->kind == DEBUG_KIND_CLASS,
|
||||
@@ -2411,6 +2437,9 @@ debug_write_class_type (info, fns, fhandle, type, tag)
|
||||
type->u.kclass->vptrbase != NULL,
|
||||
type->u.kclass->vptrbase == type))
|
||||
return false;
|
||||
|
||||
if (type->u.kclass != NULL)
|
||||
{
|
||||
if (type->u.kclass->fields != NULL)
|
||||
{
|
||||
for (i = 0; type->u.kclass->fields[i] != NULL; i++)
|
||||
@@ -2481,7 +2510,8 @@ debug_write_class_type (info, fns, fhandle, type, tag)
|
||||
{
|
||||
if (! (*fns->class_method_variant) (fhandle, v->argtypes,
|
||||
v->visibility,
|
||||
v->constp, v->volatilep,
|
||||
v->constp,
|
||||
v->volatilep,
|
||||
v->voffset,
|
||||
v->context != NULL))
|
||||
return false;
|
||||
@@ -2500,6 +2530,7 @@ debug_write_class_type (info, fns, fhandle, type, tag)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return (*fns->end_class_type) (fhandle);
|
||||
}
|
||||
|
||||
@@ -194,7 +194,8 @@ struct debug_write_fns
|
||||
|
||||
/* Push an enum type onto the type stack, given the tag, a NULL
|
||||
terminated array of names and the associated values. If there is
|
||||
no tag, the tag argument will be NULL. */
|
||||
no tag, the tag argument will be NULL. If this is an undefined
|
||||
enum, the names and values arguments will be NULL. */
|
||||
boolean (*enum_type) PARAMS ((PTR, const char *, const char **,
|
||||
bfd_signed_vma *));
|
||||
|
||||
@@ -259,7 +260,9 @@ struct debug_write_fns
|
||||
end_struct_type function. The second argument is the tag; this
|
||||
will be NULL if there isn't one. The boolean argument is true
|
||||
for a struct, false for a union. The unsigned int argument is
|
||||
the size. */
|
||||
the size. If this is an undefined struct or union, the size will
|
||||
be 0 and struct_field will not be called before end_struct_type
|
||||
is called. */
|
||||
boolean (*start_struct_type) PARAMS ((PTR, const char *, boolean,
|
||||
unsigned int));
|
||||
|
||||
|
||||
@@ -519,6 +519,13 @@ pr_enum_type (p, tag, names, values)
|
||||
if (! append_type (info, "{ "))
|
||||
return false;
|
||||
|
||||
if (names == NULL)
|
||||
{
|
||||
if (! append_type (info, "/* undefined */"))
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
val = 0;
|
||||
for (i = 0; names[i] != NULL; i++)
|
||||
{
|
||||
@@ -544,6 +551,7 @@ pr_enum_type (p, tag, names, values)
|
||||
|
||||
++val;
|
||||
}
|
||||
}
|
||||
|
||||
return append_type (info, " }");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user