summaryrefslogtreecommitdiff
path: root/gdb/dwarfread.c
diff options
context:
space:
mode:
authorDavid Carlton <carlton@bactrian.org>2003-06-27 21:50:37 +0000
committerDavid Carlton <carlton@bactrian.org>2003-06-27 21:50:37 +0000
commitf9d1068d7181f399f83f153dbdd3150188a699bf (patch)
treec38af7b159de09bbfbed9a92513049b11305618b /gdb/dwarfread.c
parent2dc24d0234c7499ed20e4e2560000854890843a6 (diff)
downloadgdb-f9d1068d7181f399f83f153dbdd3150188a699bf.tar.gz
2003-06-27 David Carlton <carlton@kealia.com>
* Merge with mainline; tag is carlton_dictionary-20030627-merge.
Diffstat (limited to 'gdb/dwarfread.c')
-rw-r--r--gdb/dwarfread.c56
1 files changed, 40 insertions, 16 deletions
diff --git a/gdb/dwarfread.c b/gdb/dwarfread.c
index 2780858883c..e6f2a2e6b7e 100644
--- a/gdb/dwarfread.c
+++ b/gdb/dwarfread.c
@@ -701,7 +701,7 @@ static void
read_lexical_block_scope (struct dieinfo *dip, char *thisdie, char *enddie,
struct objfile *objfile)
{
- register struct context_stack *new;
+ struct context_stack *new;
push_context (0, dip->at_low_pc);
process_dies (thisdie + dip->die_length, enddie, objfile);
@@ -862,7 +862,8 @@ decode_die_type (struct dieinfo *dip)
}
else if (dip->at_user_def_type)
{
- if ((type = lookup_utype (dip->at_user_def_type)) == NULL)
+ type = lookup_utype (dip->at_user_def_type);
+ if (type == NULL)
{
type = alloc_utype (dip->at_user_def_type, NULL);
}
@@ -916,7 +917,8 @@ struct_type (struct dieinfo *dip, char *thisdie, char *enddie,
char *nextdie;
int anonymous_size;
- if ((type = lookup_utype (dip->die_ref)) == NULL)
+ type = lookup_utype (dip->die_ref);
+ if (type == NULL)
{
/* No forward references created an empty type, so install one now */
type = alloc_utype (dip->die_ref, NULL);
@@ -977,6 +979,13 @@ struct_type (struct dieinfo *dip, char *thisdie, char *enddie,
switch (mbr.die_tag)
{
case TAG_member:
+ /* Static fields can be either TAG_global_variable (GCC) or else
+ TAG_member with no location (Diab). We could treat the latter like
+ the former... but since we don't support the former, just avoid
+ crashing on the latter for now. */
+ if (mbr.at_location == NULL)
+ break;
+
/* Get space to record the next field's data. */
new = (struct nextfield *) alloca (sizeof (struct nextfield));
new->next = list;
@@ -1149,7 +1158,8 @@ decode_array_element_type (char *scan)
attribute = target_to_host (scan, SIZEOF_ATTRIBUTE, GET_UNSIGNED,
current_objfile);
scan += SIZEOF_ATTRIBUTE;
- if ((nbytes = attribute_size (attribute)) == -1)
+ nbytes = attribute_size (attribute);
+ if (nbytes == -1)
{
bad_array_element_type_complaint (DIE_ID, DIE_NAME, attribute);
typep = dwarf_fundamental_type (current_objfile, FT_INTEGER);
@@ -1169,7 +1179,8 @@ decode_array_element_type (char *scan)
case AT_user_def_type:
die_ref = target_to_host (scan, nbytes, GET_UNSIGNED,
current_objfile);
- if ((typep = lookup_utype (die_ref)) == NULL)
+ typep = lookup_utype (die_ref);
+ if (typep == NULL)
{
typep = alloc_utype (die_ref, NULL);
}
@@ -1334,14 +1345,16 @@ dwarf_read_array_type (struct dieinfo *dip)
"DIE @ 0x%x \"%s\", array not row major; not handled correctly",
DIE_ID, DIE_NAME);
}
- if ((sub = dip->at_subscr_data) != NULL)
+ sub = dip->at_subscr_data;
+ if (sub != NULL)
{
nbytes = attribute_size (AT_subscr_data);
blocksz = target_to_host (sub, nbytes, GET_UNSIGNED, current_objfile);
subend = sub + nbytes + blocksz;
sub += nbytes;
type = decode_subscript_data_item (sub, subend);
- if ((utype = lookup_utype (dip->die_ref)) == NULL)
+ utype = lookup_utype (dip->die_ref);
+ if (utype == NULL)
{
/* Install user defined type that has not been referenced yet. */
alloc_utype (dip->die_ref, type);
@@ -1390,7 +1403,8 @@ read_tag_pointer_type (struct dieinfo *dip)
struct type *utype;
type = decode_die_type (dip);
- if ((utype = lookup_utype (dip->die_ref)) == NULL)
+ utype = lookup_utype (dip->die_ref);
+ if (utype == NULL)
{
utype = lookup_pointer_type (type);
alloc_utype (dip->die_ref, utype);
@@ -1509,7 +1523,8 @@ read_subroutine_type (struct dieinfo *dip, char *thisdie, char *enddie)
/* 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->die_ref)) == NULL)
+ ftype = lookup_utype (dip->die_ref);
+ if (ftype == NULL)
{
/* This is the first reference to one of these types. Make
a new one and place it in the user defined types. */
@@ -1623,7 +1638,8 @@ enum_type (struct dieinfo *dip, struct objfile *objfile)
int nbytes;
int unsigned_enum = 1;
- if ((type = lookup_utype (dip->die_ref)) == NULL)
+ type = lookup_utype (dip->die_ref);
+ if (type == NULL)
{
/* No forward references created an empty type, so install one now */
type = alloc_utype (dip->die_ref, NULL);
@@ -1643,7 +1659,8 @@ enum_type (struct dieinfo *dip, struct objfile *objfile)
{
TYPE_LENGTH (type) = dip->at_byte_size;
}
- if ((scan = dip->at_element_list) != NULL)
+ scan = dip->at_element_list;
+ if (scan != NULL)
{
if (dip->short_element_list)
{
@@ -1734,7 +1751,7 @@ static void
read_func_scope (struct dieinfo *dip, char *thisdie, char *enddie,
struct objfile *objfile)
{
- register struct context_stack *new;
+ struct context_stack *new;
/* AT_name is absent if the function is described with an
AT_abstract_origin tag.
@@ -2430,7 +2447,8 @@ add_enum_psymbol (struct dieinfo *dip, struct objfile *objfile)
unsigned short blocksz;
int nbytes;
- if ((scan = dip->at_element_list) != NULL)
+ scan = dip->at_element_list;
+ if (scan != NULL)
{
if (dip->short_element_list)
{
@@ -3143,7 +3161,8 @@ decode_modified_type (char *modifiers, unsigned int modcount, int mtype)
nbytes = attribute_size (AT_user_def_type);
die_ref = target_to_host (modifiers, nbytes, GET_UNSIGNED,
current_objfile);
- if ((typep = lookup_utype (die_ref)) == NULL)
+ typep = lookup_utype (die_ref);
+ if (typep == NULL)
{
typep = alloc_utype (die_ref, NULL);
}
@@ -3179,8 +3198,12 @@ decode_modified_type (char *modifiers, unsigned int modcount, int mtype)
DIE_ID, DIE_NAME); /* FIXME */
break;
default:
- if (!(MOD_lo_user <= (unsigned char) modifier
+ if (!(MOD_lo_user <= (unsigned char) modifier))
+#if 0
+/* This part of the test would always be true, and it triggers a compiler
+ warning. */
&& (unsigned char) modifier <= MOD_hi_user))
+#endif
{
complaint (&symfile_complaints,
"DIE @ 0x%x \"%s\", unknown type modifier %u", DIE_ID,
@@ -3492,7 +3515,8 @@ completedieinfo (struct dieinfo *dip, struct objfile *objfile)
{
attr = target_to_host (diep, SIZEOF_ATTRIBUTE, GET_UNSIGNED, objfile);
diep += SIZEOF_ATTRIBUTE;
- if ((nbytes = attribute_size (attr)) == -1)
+ nbytes = attribute_size (attr);
+ if (nbytes == -1)
{
complaint (&symfile_complaints,
"DIE @ 0x%x \"%s\", unknown attribute length, skipped remaining attributes",