mirror of
https://github.com/darlinghq/darling-gdb.git
synced 2024-11-28 22:40:24 +00:00
When creating user defined types for subroutine and array types, check
first to see if a partial type already exists due to a forward reference, and if so, bash it to fit.
This commit is contained in:
parent
d17c317cfe
commit
af21362450
@ -1,3 +1,9 @@
|
|||||||
|
Mon Feb 17 07:13:27 1992 Fred Fish (fnf at cygnus.com)
|
||||||
|
|
||||||
|
* dwarfread.c (dwarf_read_array_type, read_subroutine_type):
|
||||||
|
When creating a new user defined type, check to see if a partial
|
||||||
|
type already exists, and if so, bash it to fit.
|
||||||
|
|
||||||
Thu Feb 13 17:14:28 1992 Fred Fish (fnf at cygnus.com)
|
Thu Feb 13 17:14:28 1992 Fred Fish (fnf at cygnus.com)
|
||||||
|
|
||||||
* elfread.c (elf_symtab_read): Fix code to correctly track
|
* elfread.c (elf_symtab_read): Fix code to correctly track
|
||||||
|
@ -1163,6 +1163,7 @@ static void
|
|||||||
DEFUN(dwarf_read_array_type, (dip), struct dieinfo *dip)
|
DEFUN(dwarf_read_array_type, (dip), struct dieinfo *dip)
|
||||||
{
|
{
|
||||||
struct type *type;
|
struct type *type;
|
||||||
|
struct type *utype;
|
||||||
char *sub;
|
char *sub;
|
||||||
char *subend;
|
char *subend;
|
||||||
short temp;
|
short temp;
|
||||||
@ -1180,14 +1181,26 @@ DEFUN(dwarf_read_array_type, (dip), struct dieinfo *dip)
|
|||||||
type = decode_subscr_data (sub, subend);
|
type = decode_subscr_data (sub, subend);
|
||||||
if (type == NULL)
|
if (type == NULL)
|
||||||
{
|
{
|
||||||
type = alloc_utype (dip -> dieref, NULL);
|
if ((utype = lookup_utype (dip -> dieref)) == NULL)
|
||||||
TYPE_CODE (type) = TYPE_CODE_ARRAY;
|
{
|
||||||
TYPE_TARGET_TYPE (type) = builtin_type_int;
|
utype = alloc_utype (dip -> dieref, NULL);
|
||||||
TYPE_LENGTH (type) = 1 * TYPE_LENGTH (TYPE_TARGET_TYPE (type));
|
}
|
||||||
|
TYPE_CODE (utype) = TYPE_CODE_ARRAY;
|
||||||
|
TYPE_TARGET_TYPE (utype) = builtin_type_int;
|
||||||
|
TYPE_LENGTH (utype) = 1 * TYPE_LENGTH (TYPE_TARGET_TYPE (utype));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
type = alloc_utype (dip -> dieref, type);
|
if ((utype = lookup_utype (dip -> dieref)) == NULL)
|
||||||
|
{
|
||||||
|
(void) alloc_utype (dip -> dieref, type);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
TYPE_CODE (utype) = TYPE_CODE_ARRAY;
|
||||||
|
TYPE_LENGTH (utype) = TYPE_LENGTH (type);
|
||||||
|
TYPE_TARGET_TYPE (utype) = TYPE_TARGET_TYPE (type);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1225,11 +1238,32 @@ DEFUN(read_subroutine_type, (dip, thisdie, enddie),
|
|||||||
char *thisdie AND
|
char *thisdie AND
|
||||||
char *enddie)
|
char *enddie)
|
||||||
{
|
{
|
||||||
struct type *type;
|
struct type *type; /* Type that this function returns */
|
||||||
|
struct type *ftype; /* Function that returns above type */
|
||||||
|
|
||||||
|
/* Decode the type that this subroutine returns */
|
||||||
|
|
||||||
type = decode_die_type (dip);
|
type = decode_die_type (dip);
|
||||||
type = lookup_function_type (type);
|
|
||||||
type = alloc_utype (dip -> dieref, type);
|
/* Check to see if we already have a partially constructed user
|
||||||
|
defined type for this DIE, from a forward reference. */
|
||||||
|
|
||||||
|
if ((ftype = lookup_utype (dip -> dieref)) == NULL)
|
||||||
|
{
|
||||||
|
/* This is the first reference to one of these types. Make
|
||||||
|
a new one and place it in the user defined types. */
|
||||||
|
ftype = lookup_function_type (type);
|
||||||
|
(void) alloc_utype (dip -> dieref, ftype);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* We have an existing partially constructed type, so bash it
|
||||||
|
into the correct type. */
|
||||||
|
TYPE_TARGET_TYPE (ftype) = type;
|
||||||
|
TYPE_FUNCTION_TYPE (type) = ftype;
|
||||||
|
TYPE_LENGTH (ftype) = 1;
|
||||||
|
TYPE_CODE (ftype) = TYPE_CODE_FUNC;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user