aboutsummaryrefslogtreecommitdiff
path: root/binutils/debug.c
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>1996-01-23 00:34:58 +0000
committerIan Lance Taylor <ian@airs.com>1996-01-23 00:34:58 +0000
commit35aa91b97d1b00baea762e2a239bdc5386af0a0e (patch)
treea9ff1edeae75c645cfb484f871e246c4e74e6377 /binutils/debug.c
parentd2f5fa493b32ad644449ae6ba936122611103621 (diff)
downloadgdb-35aa91b97d1b00baea762e2a239bdc5386af0a0e.zip
gdb-35aa91b97d1b00baea762e2a239bdc5386af0a0e.tar.gz
gdb-35aa91b97d1b00baea762e2a239bdc5386af0a0e.tar.bz2
* 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.
Diffstat (limited to 'binutils/debug.c')
-rw-r--r--binutils/debug.c107
1 files changed, 104 insertions, 3 deletions
diff --git a/binutils/debug.c b/binutils/debug.c
index 0a6832e..111a6bb 100644
--- a/binutils/debug.c
+++ b/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: