aboutsummaryrefslogtreecommitdiff
path: root/gdb/dwarfread.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/dwarfread.c')
-rw-r--r--gdb/dwarfread.c215
1 files changed, 85 insertions, 130 deletions
diff --git a/gdb/dwarfread.c b/gdb/dwarfread.c
index f8254c9..f797fc5 100644
--- a/gdb/dwarfread.c
+++ b/gdb/dwarfread.c
@@ -62,115 +62,37 @@
/* Complaints that can be issued during DWARF debug info reading. */
-struct deprecated_complaint no_bfd_get_N =
-{
- "DIE @ 0x%x \"%s\", no bfd support for %d byte data object", 0, 0
-};
-
-struct deprecated_complaint malformed_die =
-{
- "DIE @ 0x%x \"%s\", malformed DIE, bad length (%d bytes)", 0, 0
-};
-
-struct deprecated_complaint bad_die_ref =
-{
- "DIE @ 0x%x \"%s\", reference to DIE (0x%x) outside compilation unit", 0, 0
-};
-
-struct deprecated_complaint unknown_attribute_form =
-{
- "DIE @ 0x%x \"%s\", unknown attribute form (0x%x)", 0, 0
-};
-
-struct deprecated_complaint unknown_attribute_length =
-{
- "DIE @ 0x%x \"%s\", unknown attribute length, skipped remaining attributes", 0, 0
-};
-
-struct deprecated_complaint unexpected_fund_type =
-{
- "DIE @ 0x%x \"%s\", unexpected fundamental type 0x%x", 0, 0
-};
-
-struct deprecated_complaint unknown_type_modifier =
-{
- "DIE @ 0x%x \"%s\", unknown type modifier %u", 0, 0
-};
-
-struct deprecated_complaint volatile_ignored =
-{
- "DIE @ 0x%x \"%s\", type modifier 'volatile' ignored", 0, 0
-};
-
-struct deprecated_complaint const_ignored =
-{
- "DIE @ 0x%x \"%s\", type modifier 'const' ignored", 0, 0
-};
-
-struct deprecated_complaint botched_modified_type =
-{
- "DIE @ 0x%x \"%s\", botched modified type decoding (mtype 0x%x)", 0, 0
-};
-
-struct deprecated_complaint op_deref2 =
-{
- "DIE @ 0x%x \"%s\", OP_DEREF2 address 0x%x not handled", 0, 0
-};
-
-struct deprecated_complaint op_deref4 =
-{
- "DIE @ 0x%x \"%s\", OP_DEREF4 address 0x%x not handled", 0, 0
-};
-
-struct deprecated_complaint basereg_not_handled =
-{
- "DIE @ 0x%x \"%s\", BASEREG %d not handled", 0, 0
-};
-
-struct deprecated_complaint dup_user_type_allocation =
-{
- "DIE @ 0x%x \"%s\", internal error: duplicate user type allocation", 0, 0
-};
-
-struct deprecated_complaint dup_user_type_definition =
-{
- "DIE @ 0x%x \"%s\", internal error: duplicate user type definition", 0, 0
-};
-
-struct deprecated_complaint missing_tag =
-{
- "DIE @ 0x%x \"%s\", missing class, structure, or union tag", 0, 0
-};
-
-struct deprecated_complaint bad_array_element_type =
-{
- "DIE @ 0x%x \"%s\", bad array element type attribute 0x%x", 0, 0
-};
-
-struct deprecated_complaint subscript_data_items =
-{
- "DIE @ 0x%x \"%s\", can't decode subscript data items", 0, 0
-};
-
-struct deprecated_complaint unhandled_array_subscript_format =
+static void
+bad_die_ref_complaint (int arg1, const char *arg2, int arg3)
{
- "DIE @ 0x%x \"%s\", array subscript format 0x%x not handled yet", 0, 0
-};
+ complaint (&symfile_complaints,
+ "DIE @ 0x%x \"%s\", reference to DIE (0x%x) outside compilation unit",
+ arg1, arg2, arg3);
+}
-struct deprecated_complaint unknown_array_subscript_format =
+static void
+unknown_attribute_form_complaint (int arg1, const char *arg2, int arg3)
{
- "DIE @ 0x%x \"%s\", unknown array subscript format %x", 0, 0
-};
+ complaint (&symfile_complaints,
+ "DIE @ 0x%x \"%s\", unknown attribute form (0x%x)", arg1, arg2,
+ arg3);
+}
-struct deprecated_complaint not_row_major =
+static void
+dup_user_type_definition_complaint (int arg1, const char *arg2)
{
- "DIE @ 0x%x \"%s\", array not row major; not handled correctly", 0, 0
-};
+ complaint (&symfile_complaints,
+ "DIE @ 0x%x \"%s\", internal error: duplicate user type definition",
+ arg1, arg2);
+}
-struct deprecated_complaint missing_at_name =
+static void
+bad_array_element_type_complaint (int arg1, const char *arg2, int arg3)
{
- "DIE @ 0x%x, AT_name tag missing", 0, 0
-};
+ complaint (&symfile_complaints,
+ "DIE @ 0x%x \"%s\", bad array element type attribute 0x%x", arg1,
+ arg2, arg3);
+}
typedef unsigned int DIE_REF; /* Reference to a DIE */
@@ -786,7 +708,7 @@ lookup_utype (DIE_REF die_ref)
utypeidx = (die_ref - dbroff) / 4;
if ((utypeidx < 0) || (utypeidx >= numutypes))
{
- complain (&bad_die_ref, DIE_ID, DIE_NAME);
+ bad_die_ref_complaint (DIE_ID, DIE_NAME, die_ref);
}
else
{
@@ -828,12 +750,14 @@ alloc_utype (DIE_REF die_ref, struct type *utypep)
if ((utypeidx < 0) || (utypeidx >= numutypes))
{
utypep = dwarf_fundamental_type (current_objfile, FT_INTEGER);
- complain (&bad_die_ref, DIE_ID, DIE_NAME);
+ bad_die_ref_complaint (DIE_ID, DIE_NAME, die_ref);
}
else if (*typep != NULL)
{
utypep = *typep;
- complain (&dup_user_type_allocation, DIE_ID, DIE_NAME);
+ complaint (&symfile_complaints,
+ "DIE @ 0x%x \"%s\", internal error: duplicate user type allocation",
+ DIE_ID, DIE_NAME);
}
else
{
@@ -978,7 +902,9 @@ struct_type (struct dieinfo *dip, char *thisdie, char *enddie,
default:
/* Should never happen */
TYPE_CODE (type) = TYPE_CODE_UNDEF;
- complain (&missing_tag, DIE_ID, DIE_NAME);
+ complaint (&symfile_complaints,
+ "DIE @ 0x%x \"%s\", missing class, structure, or union tag",
+ DIE_ID, DIE_NAME);
break;
}
/* Some compilers try to be helpful by inventing "fake" names for
@@ -1191,7 +1117,7 @@ decode_array_element_type (char *scan)
scan += SIZEOF_ATTRIBUTE;
if ((nbytes = attribute_size (attribute)) == -1)
{
- complain (&bad_array_element_type, DIE_ID, DIE_NAME, attribute);
+ bad_array_element_type_complaint (DIE_ID, DIE_NAME, attribute);
typep = dwarf_fundamental_type (current_objfile, FT_INTEGER);
}
else
@@ -1218,7 +1144,7 @@ decode_array_element_type (char *scan)
typep = decode_mod_u_d_type (scan);
break;
default:
- complain (&bad_array_element_type, DIE_ID, DIE_NAME, attribute);
+ bad_array_element_type_complaint (DIE_ID, DIE_NAME, attribute);
typep = dwarf_fundamental_type (current_objfile, FT_INTEGER);
break;
}
@@ -1306,7 +1232,9 @@ decode_subscript_data_item (char *scan, char *end)
if (nexttype == NULL)
{
/* Munged subscript data or other problem, fake it. */
- complain (&subscript_data_items, DIE_ID, DIE_NAME);
+ complaint (&symfile_complaints,
+ "DIE @ 0x%x \"%s\", can't decode subscript data items",
+ DIE_ID, DIE_NAME);
nexttype = dwarf_fundamental_type (current_objfile, FT_INTEGER);
}
rangetype = create_range_type ((struct type *) NULL, indextype,
@@ -1320,13 +1248,17 @@ decode_subscript_data_item (char *scan, char *end)
case FMT_UT_C_X:
case FMT_UT_X_C:
case FMT_UT_X_X:
- complain (&unhandled_array_subscript_format, DIE_ID, DIE_NAME, format);
+ complaint (&symfile_complaints,
+ "DIE @ 0x%x \"%s\", array subscript format 0x%x not handled yet",
+ DIE_ID, DIE_NAME, format);
nexttype = dwarf_fundamental_type (current_objfile, FT_INTEGER);
rangetype = create_range_type ((struct type *) NULL, nexttype, 0, 0);
typep = create_array_type ((struct type *) NULL, nexttype, rangetype);
break;
default:
- complain (&unknown_array_subscript_format, DIE_ID, DIE_NAME, format);
+ complaint (&symfile_complaints,
+ "DIE @ 0x%x \"%s\", unknown array subscript format %x", DIE_ID,
+ DIE_NAME, format);
nexttype = dwarf_fundamental_type (current_objfile, FT_INTEGER);
rangetype = create_range_type ((struct type *) NULL, nexttype, 0, 0);
typep = create_array_type ((struct type *) NULL, nexttype, rangetype);
@@ -1364,7 +1296,9 @@ dwarf_read_array_type (struct dieinfo *dip)
if (dip->at_ordering != ORD_row_major)
{
/* FIXME: Can gdb even handle column major arrays? */
- complain (&not_row_major, DIE_ID, DIE_NAME);
+ complaint (&symfile_complaints,
+ "DIE @ 0x%x \"%s\", array not row major; not handled correctly",
+ DIE_ID, DIE_NAME);
}
if ((sub = dip->at_subscr_data) != NULL)
{
@@ -1394,7 +1328,7 @@ dwarf_read_array_type (struct dieinfo *dip)
{
/* Double ick! Not only is a type already in our slot, but
someone has decorated it. Complain and leave it alone. */
- complain (&dup_user_type_definition, DIE_ID, DIE_NAME);
+ dup_user_type_definition_complaint (DIE_ID, DIE_NAME);
}
}
}
@@ -1492,7 +1426,7 @@ read_tag_string_type (struct dieinfo *dip)
is a blank one. If not, complain and leave it alone. */
if (TYPE_CODE (utype) != TYPE_CODE_UNDEF)
{
- complain (&dup_user_type_definition, DIE_ID, DIE_NAME);
+ dup_user_type_definition_complaint (DIE_ID, DIE_NAME);
return;
}
}
@@ -1558,7 +1492,7 @@ read_subroutine_type (struct dieinfo *dip, char *thisdie, char *enddie)
}
else
{
- complain (&dup_user_type_definition, DIE_ID, DIE_NAME);
+ dup_user_type_definition_complaint (DIE_ID, DIE_NAME);
}
}
@@ -1774,7 +1708,8 @@ read_func_scope (struct dieinfo *dip, char *thisdie, char *enddie,
FIXME: Add code to handle AT_abstract_origin tags properly. */
if (dip->at_name == NULL)
{
- complain (&missing_at_name, DIE_ID);
+ complaint (&symfile_complaints, "DIE @ 0x%x, AT_name tag missing",
+ DIE_ID);
return;
}
@@ -2208,10 +2143,14 @@ locval (struct dieinfo *dip)
break;
case OP_DEREF2:
/* pop, deref and push 2 bytes (as a long) */
- complain (&op_deref2, DIE_ID, DIE_NAME, stack[stacki]);
+ complaint (&symfile_complaints,
+ "DIE @ 0x%x \"%s\", OP_DEREF2 address 0x%lx not handled",
+ DIE_ID, DIE_NAME, stack[stacki]);
break;
case OP_DEREF4: /* pop, deref and push 4 bytes (as a long) */
- complain (&op_deref4, DIE_ID, DIE_NAME, stack[stacki]);
+ complaint (&symfile_complaints,
+ "DIE @ 0x%x \"%s\", OP_DEREF4 address 0x%lx not handled",
+ DIE_ID, DIE_NAME, stack[stacki]);
break;
case OP_ADD: /* pop top 2 items, add, push result */
stack[stacki - 1] += stack[stacki];
@@ -2661,8 +2600,8 @@ scan_partial_symbols (char *thisdie, char *enddie, struct objfile *objfile)
temp = dbbase + di.at_sibling - dbroff;
if ((temp < thisdie) || (temp >= enddie))
{
- complain (&bad_die_ref, DIE_ID, DIE_NAME,
- di.at_sibling);
+ bad_die_ref_complaint (DIE_ID, DIE_NAME,
+ di.at_sibling);
}
else
{
@@ -3180,7 +3119,9 @@ decode_modified_type (char *modifiers, unsigned int modcount, int mtype)
}
break;
default:
- complain (&botched_modified_type, DIE_ID, DIE_NAME, mtype);
+ complaint (&symfile_complaints,
+ "DIE @ 0x%x \"%s\", botched modified type decoding (mtype 0x%x)",
+ DIE_ID, DIE_NAME, mtype);
typep = dwarf_fundamental_type (current_objfile, FT_INTEGER);
break;
}
@@ -3198,16 +3139,22 @@ decode_modified_type (char *modifiers, unsigned int modcount, int mtype)
typep = lookup_reference_type (typep);
break;
case MOD_const:
- complain (&const_ignored, DIE_ID, DIE_NAME); /* FIXME */
+ complaint (&symfile_complaints,
+ "DIE @ 0x%x \"%s\", type modifier 'const' ignored", DIE_ID,
+ DIE_NAME); /* FIXME */
break;
case MOD_volatile:
- complain (&volatile_ignored, DIE_ID, DIE_NAME); /* FIXME */
+ complaint (&symfile_complaints,
+ "DIE @ 0x%x \"%s\", type modifier 'volatile' ignored",
+ DIE_ID, DIE_NAME); /* FIXME */
break;
default:
if (!(MOD_lo_user <= (unsigned char) modifier
&& (unsigned char) modifier <= MOD_hi_user))
{
- complain (&unknown_type_modifier, DIE_ID, DIE_NAME, modifier);
+ complaint (&symfile_complaints,
+ "DIE @ 0x%x \"%s\", unknown type modifier %u", DIE_ID,
+ DIE_NAME, modifier);
}
break;
}
@@ -3349,7 +3296,9 @@ decode_fund_type (unsigned int fundtype)
typep = dwarf_fundamental_type (current_objfile, FT_INTEGER);
if (!(FT_lo_user <= fundtype && fundtype <= FT_hi_user))
{
- complain (&unexpected_fund_type, DIE_ID, DIE_NAME, fundtype);
+ complaint (&symfile_complaints,
+ "DIE @ 0x%x \"%s\", unexpected fundamental type 0x%x",
+ DIE_ID, DIE_NAME, fundtype);
}
}
@@ -3447,7 +3396,9 @@ basicdieinfo (struct dieinfo *dip, char *diep, struct objfile *objfile)
if ((dip->die_length < SIZEOF_DIE_LENGTH) ||
((diep + dip->die_length) > (dbbase + dbsize)))
{
- complain (&malformed_die, DIE_ID, DIE_NAME, dip->die_length);
+ complaint (&symfile_complaints,
+ "DIE @ 0x%x \"%s\", malformed DIE, bad length (%ld bytes)",
+ DIE_ID, DIE_NAME, dip->die_length);
dip->die_length = 0;
}
else if (dip->die_length < (SIZEOF_DIE_LENGTH + SIZEOF_DIE_TAG))
@@ -3513,7 +3464,9 @@ completedieinfo (struct dieinfo *dip, struct objfile *objfile)
diep += SIZEOF_ATTRIBUTE;
if ((nbytes = attribute_size (attr)) == -1)
{
- complain (&unknown_attribute_length, DIE_ID, DIE_NAME);
+ complaint (&symfile_complaints,
+ "DIE @ 0x%x \"%s\", unknown attribute length, skipped remaining attributes",
+ DIE_ID, DIE_NAME);
diep = end;
continue;
}
@@ -3670,7 +3623,7 @@ completedieinfo (struct dieinfo *dip, struct objfile *objfile)
diep += strlen (diep) + 1;
break;
default:
- complain (&unknown_attribute_form, DIE_ID, DIE_NAME, form);
+ unknown_attribute_form_complaint (DIE_ID, DIE_NAME, form);
diep = end;
break;
}
@@ -3727,7 +3680,9 @@ target_to_host (char *from, int nbytes, int signextend, /* FIXME: Unused */
rtnval = bfd_get_8 (objfile->obfd, (bfd_byte *) from);
break;
default:
- complain (&no_bfd_get_N, DIE_ID, DIE_NAME, nbytes);
+ complaint (&symfile_complaints,
+ "DIE @ 0x%x \"%s\", no bfd support for %d byte data object",
+ DIE_ID, DIE_NAME, nbytes);
rtnval = 0;
break;
}
@@ -3782,7 +3737,7 @@ attribute_size (unsigned int attr)
nbytes = TARGET_FT_POINTER_SIZE (objfile);
break;
default:
- complain (&unknown_attribute_form, DIE_ID, DIE_NAME, form);
+ unknown_attribute_form_complaint (DIE_ID, DIE_NAME, form);
nbytes = -1;
break;
}