mirror of
https://github.com/darlinghq/darling-gdb.git
synced 2024-11-28 22:40:24 +00:00
* debug.h (debug_get_type_size): Declare.
(debug_get_field_name): Declare. (debug_get_field_bitpos): Declare. (debug_get_field_bitsize): Declare. (debug_get_field_visibility): Declare. (debug_get_field_physname): Declare. * debug.c (debug_get_real_type): Handle DEBUG_KIND_TAGGED. (debug_get_type_size): New function. (debug_get_field_name): New function. (debug_get_field_bitpos): New function. (debug_get_field_bitsize): New function. (debug_get_field_visibility): New function. (debug_get_field_physname): New function. (debug_write_type): Make sure we pass the real kind, not INDIRECT, to tag_type. Pass the name recursively for INDIRECT.
This commit is contained in:
parent
d2f5fa493b
commit
35aa91b97d
107
binutils/debug.c
107
binutils/debug.c
@ -2158,6 +2158,7 @@ debug_get_real_type (handle, type)
|
||||
return debug_get_real_type (handle, *type->u.kindirect->slot);
|
||||
return type;
|
||||
case DEBUG_KIND_NAMED:
|
||||
case DEBUG_KIND_TAGGED:
|
||||
return debug_get_real_type (handle, type->u.knamed->type);
|
||||
}
|
||||
/*NOTREACHED*/
|
||||
@ -2195,6 +2196,37 @@ debug_get_type_name (handle, type)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Get the size of a type. */
|
||||
|
||||
bfd_vma
|
||||
debug_get_type_size (handle, type)
|
||||
PTR handle;
|
||||
debug_type type;
|
||||
{
|
||||
if (type == NULL)
|
||||
return 0;
|
||||
|
||||
/* We don't call debug_get_real_type, because somebody might have
|
||||
called debug_record_type_size on a named or indirect type. */
|
||||
|
||||
if (type->size != 0)
|
||||
return type->size;
|
||||
|
||||
switch (type->kind)
|
||||
{
|
||||
default:
|
||||
return 0;
|
||||
case DEBUG_KIND_INDIRECT:
|
||||
if (*type->u.kindirect->slot != NULL)
|
||||
return debug_get_type_size (handle, *type->u.kindirect->slot);
|
||||
return 0;
|
||||
case DEBUG_KIND_NAMED:
|
||||
case DEBUG_KIND_TAGGED:
|
||||
return debug_get_type_size (handle, type->u.knamed->type);
|
||||
}
|
||||
/*NOTREACHED*/
|
||||
}
|
||||
|
||||
/* Get the return type of a function or method type. */
|
||||
|
||||
debug_type
|
||||
@ -2302,6 +2334,70 @@ debug_get_field_type (handle, field)
|
||||
return NULL;
|
||||
return field->type;
|
||||
}
|
||||
|
||||
/* Get the name of a field. */
|
||||
|
||||
/*ARGSUSED*/
|
||||
const char *
|
||||
debug_get_field_name (handle, field)
|
||||
PTR handle;
|
||||
debug_field field;
|
||||
{
|
||||
if (field == NULL)
|
||||
return NULL;
|
||||
return field->name;
|
||||
}
|
||||
|
||||
/* Get the bit position of a field. */
|
||||
|
||||
/*ARGSUSED*/
|
||||
bfd_vma
|
||||
debug_get_field_bitpos (handle, field)
|
||||
PTR handle;
|
||||
debug_field field;
|
||||
{
|
||||
if (field == NULL || field->static_member)
|
||||
return (bfd_vma) -1;
|
||||
return field->u.f.bitpos;
|
||||
}
|
||||
|
||||
/* Get the bit size of a field. */
|
||||
|
||||
/*ARGSUSED*/
|
||||
bfd_vma
|
||||
debug_get_field_bitsize (handle, field)
|
||||
PTR handle;
|
||||
debug_field field;
|
||||
{
|
||||
if (field == NULL || field->static_member)
|
||||
return (bfd_vma) -1;
|
||||
return field->u.f.bitsize;
|
||||
}
|
||||
|
||||
/* Get the visibility of a field. */
|
||||
|
||||
/*ARGSUSED*/
|
||||
enum debug_visibility
|
||||
debug_get_field_visibility (handle, field)
|
||||
PTR handle;
|
||||
debug_field field;
|
||||
{
|
||||
if (field == NULL)
|
||||
return DEBUG_VISIBILITY_IGNORE;
|
||||
return field->visibility;
|
||||
}
|
||||
|
||||
/* Get the physical name of a field. */
|
||||
|
||||
const char *
|
||||
debug_get_field_physname (handle, field)
|
||||
PTR handle;
|
||||
debug_field field;
|
||||
{
|
||||
if (field == NULL || ! field->static_member)
|
||||
return NULL;
|
||||
return field->u.s.physname;
|
||||
}
|
||||
|
||||
/* Write out the debugging information. This is given a handle to
|
||||
debugging information, and a set of function pointers to call. */
|
||||
@ -2456,8 +2552,13 @@ debug_write_type (info, fns, fhandle, type, name)
|
||||
if (type->kind == DEBUG_KIND_NAMED)
|
||||
return (*fns->typedef_type) (fhandle, type->u.knamed->name->name);
|
||||
else
|
||||
return (*fns->tag_type) (fhandle, type->u.knamed->name->name, 0,
|
||||
type->u.knamed->type->kind);
|
||||
{
|
||||
struct debug_type *real;
|
||||
|
||||
real = debug_get_real_type ((PTR) info, type);
|
||||
return (*fns->tag_type) (fhandle, type->u.knamed->name->name, 0,
|
||||
real->kind);
|
||||
}
|
||||
}
|
||||
|
||||
/* Mark the name after we have already looked for a known name, so
|
||||
@ -2485,7 +2586,7 @@ debug_write_type (info, fns, fhandle, type, name)
|
||||
if (*type->u.kindirect->slot == DEBUG_TYPE_NULL)
|
||||
return (*fns->empty_type) (fhandle);
|
||||
return debug_write_type (info, fns, fhandle, *type->u.kindirect->slot,
|
||||
(struct debug_name *) NULL);
|
||||
name);
|
||||
case DEBUG_KIND_VOID:
|
||||
return (*fns->void_type) (fhandle);
|
||||
case DEBUG_KIND_INT:
|
||||
|
@ -645,9 +645,9 @@ extern debug_type debug_make_undefined_tagged_type
|
||||
|
||||
/* Make a base class for an object. The second argument is the base
|
||||
class type. The third argument is the bit position of this base
|
||||
class in the object (always 0 unless doing multiple inheritance).
|
||||
The fourth argument is whether this is a virtual class. The fifth
|
||||
argument is the visibility of the base class. */
|
||||
class in the object. The fourth argument is whether this is a
|
||||
virtual class. The fifth argument is the visibility of the base
|
||||
class. */
|
||||
|
||||
extern debug_baseclass debug_make_baseclass
|
||||
PARAMS ((PTR, debug_type, bfd_vma, boolean, enum debug_visibility));
|
||||
@ -687,9 +687,7 @@ extern debug_method debug_make_method
|
||||
a const function. The sixth argument is whether this is a volatile
|
||||
function. The seventh argument is the offset in the virtual
|
||||
function table, if any. The eighth argument is the virtual
|
||||
function context. FIXME: Are the const and volatile arguments
|
||||
necessary? Could we just use debug_make_const_type? The handling
|
||||
of the second argument is biased toward the way that stabs works. */
|
||||
function context. */
|
||||
|
||||
extern debug_method_variant debug_make_method_variant
|
||||
PARAMS ((PTR, const char *, debug_type, enum debug_visibility, boolean,
|
||||
@ -733,6 +731,10 @@ extern enum debug_type_kind debug_get_type_kind PARAMS ((PTR, debug_type));
|
||||
|
||||
extern const char *debug_get_type_name PARAMS ((PTR, debug_type));
|
||||
|
||||
/* Get the size of a type. */
|
||||
|
||||
extern bfd_vma debug_get_type_size PARAMS ((PTR, debug_type));
|
||||
|
||||
/* Get the return type of a function or method type. */
|
||||
|
||||
extern debug_type debug_get_return_type PARAMS ((PTR, debug_type));
|
||||
@ -762,6 +764,30 @@ extern const debug_field *debug_get_fields PARAMS ((PTR, debug_type));
|
||||
|
||||
extern debug_type debug_get_field_type PARAMS ((PTR, debug_field));
|
||||
|
||||
/* Get the name of a field. */
|
||||
|
||||
extern const char *debug_get_field_name PARAMS ((PTR, debug_field));
|
||||
|
||||
/* Get the bit position of a field within the containing structure.
|
||||
If the field is a static member, this will return (bfd_vma) -1. */
|
||||
|
||||
extern bfd_vma debug_get_field_bitpos PARAMS ((PTR, debug_field));
|
||||
|
||||
/* Get the bit size of a field. If the field is a static member, this
|
||||
will return (bfd_vma) -1. */
|
||||
|
||||
extern bfd_vma debug_get_field_bitsize PARAMS ((PTR, debug_field));
|
||||
|
||||
/* Get the visibility of a field. */
|
||||
|
||||
extern enum debug_visibility debug_get_field_visibility
|
||||
PARAMS ((PTR, debug_field));
|
||||
|
||||
/* Get the physical name of a field, if it is a static member. If the
|
||||
field is not a static member, this will return NULL. */
|
||||
|
||||
extern const char *debug_get_field_physname PARAMS ((PTR, debug_field));
|
||||
|
||||
/* Write out the recorded debugging information. This takes a set of
|
||||
function pointers which are called to do the actual writing. The
|
||||
first PTR is the debugging handle. The second PTR is a handle
|
||||
|
Loading…
Reference in New Issue
Block a user