aboutsummaryrefslogtreecommitdiff
path: root/gdb/dwarf2read.c
diff options
context:
space:
mode:
authorPaul N. Hilfinger <hilfinger@adacore.com>2009-12-14 06:19:13 +0000
committerPaul N. Hilfinger <hilfinger@adacore.com>2009-12-14 06:19:13 +0000
commit43bbcdc2bc4ce5748662bceeb206481a6ef63951 (patch)
tree54a54d486360249d86dca4984253061dbb4735de /gdb/dwarf2read.c
parentd48d911fbf5511e4faed869ef04a7ea1ccc0850d (diff)
downloadgdb-43bbcdc2bc4ce5748662bceeb206481a6ef63951.zip
gdb-43bbcdc2bc4ce5748662bceeb206481a6ef63951.tar.gz
gdb-43bbcdc2bc4ce5748662bceeb206481a6ef63951.tar.bz2
* dwarf2read.c (struct attribute): Increase sizes of unsnd and snd
fields to allow larger integer sizes. (read_subrange_type): Increase size of bound values. Add logic to determine signedness based on base-type size, signedness. (read_attribute_value): Change format for bad byte size in message. (read_8_bytes): Increase size of result type. (dump_die_shallow): Change format for value. (dwarf2_get_attr_constant_value): Increase size of return type. Correct comment. * gdbtypes.c (create_range_type): Change API to increase size of bounds. struct field -> union field. Always take signedness from base type. (check_typedef): Use new API for TYPE_LOW_BOUND, TYPE_HIGH_BOUND. (recursive_dump_type, copy_type_recursive): Adjust to new representation of range types. * gdbtypes.h (fields_or_bounds): New union containing struct field and new struct range_bounds, used for range types. (TYPE_RANGE_DATA): New macro to access range_bounds member. (TYPE_LOW_BOUND, TYPE_HIGH_BOUND): Represent with new TYPE_RANGE_DATA. (TYPE_LOW_BOUND_UNDEFINED, TYPE_HIGH_BOUND_UNDEFINED): New macros, taking over the job of TYPE_FIELD_ARTIFICIAL for range bounds. (SET_TYPE_LOW_BOUND, SET_TYPE_HIGH_BOUND, SET_TYPE_LOW_BOUND_DEFINED) (SET_TYPE_HIGH_BOUND_DEFINED): New macros. (TYPE_FIELDS, TYPE_BASECLASS, TYPE_BASECLASS_NAME, TYPE_FIELD) (TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED) (TYPE_ARRAY_LOWER_BOUND_IS_UNDEFINED, TYPE_ARRAY_UPPER_BOUND_VALUE) (TYPE_ARRAY_LOWER_BOUND_VALUE): Adjust to new representation. (create_range_type): Adjust API. * ada-lang.c (ada_modulus): Use new extended bound values. (discrete_type_low_bound): Rename to... (ada_discrete_type_low_bound): ... and make external. (discrete_type_high_bound): Rename to... (ada_discrete_type_high_bound): ... and make external. (ada_value_slice_from_ptr, ada_array_bound_from_type) (ada_evaluate_subexp, to_fixed_range_type): Use ada_discrete_type_low_bound, ada_discrete_type_high_bound. * ada-typeprint.c (print_range): Use ada_discrete_type_low_bound, ada_discrete_type_high_bound. Don't look at field count, which is no longer meaningful. Print bounds whenever argument is a range or enumeration. * ada-lang.h (ada_discrete_type_low_bound,ada_discrete_type_high_bound): Declare. * varobj.c (c_describe_child): Adjust to render larger values. * mdebugread.c (parse_type): Use proper abstractions for range types: TYPE_RANGE_DATA, SET_TYPE_LOW_BOUND_DEFINED, SET_TYPE_HIGH_BOUND_DEFINED. * p-typeprint.c (pascal_type_print_varspec_prefix): Use larger format for bounds.
Diffstat (limited to 'gdb/dwarf2read.c')
-rw-r--r--gdb/dwarf2read.c31
1 files changed, 20 insertions, 11 deletions
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index a92d923..13f3c7a 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -549,8 +549,8 @@ struct attribute
{
char *str;
struct dwarf_block *blk;
- unsigned long unsnd;
- long int snd;
+ ULONGEST unsnd;
+ LONGEST snd;
CORE_ADDR addr;
struct signatured_type *signatured_type;
}
@@ -1065,7 +1065,7 @@ static int is_ref_attr (struct attribute *);
static unsigned int dwarf2_get_ref_die_offset (struct attribute *);
-static int dwarf2_get_attr_constant_value (struct attribute *, int);
+static LONGEST dwarf2_get_attr_constant_value (struct attribute *, int);
static struct die_info *follow_die_ref_or_sig (struct die_info *,
struct attribute *,
@@ -6041,9 +6041,10 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu)
struct type *base_type;
struct type *range_type;
struct attribute *attr;
- int low = 0;
- int high = -1;
+ LONGEST low = 0;
+ LONGEST high = -1;
char *name;
+ LONGEST negative_mask;
base_type = die_type (die, cu);
if (TYPE_CODE (base_type) == TYPE_CODE_VOID)
@@ -6090,6 +6091,13 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu)
high = dwarf2_get_attr_constant_value (attr, 1);
}
+ negative_mask =
+ (LONGEST) -1 << (TYPE_LENGTH (base_type) * TARGET_CHAR_BIT - 1);
+ if (!TYPE_UNSIGNED (base_type) && (low & negative_mask))
+ low |= negative_mask;
+ if (!TYPE_UNSIGNED (base_type) && (high & negative_mask))
+ high |= negative_mask;
+
range_type = create_range_type (NULL, base_type, low, high);
name = dwarf2_name (die, cu);
@@ -7127,8 +7135,8 @@ read_attribute_value (struct attribute *attr, unsigned form,
{
complaint
(&symfile_complaints,
- _("Suspicious DW_AT_byte_size value treated as zero instead of 0x%lx"),
- DW_UNSND (attr));
+ _("Suspicious DW_AT_byte_size value treated as zero instead of %s"),
+ hex_string (DW_UNSND (attr)));
DW_UNSND (attr) = 0;
}
@@ -10107,7 +10115,8 @@ dump_die_shallow (struct ui_file *f, int indent, struct die_info *die)
case DW_FORM_data8:
case DW_FORM_udata:
case DW_FORM_sdata:
- fprintf_unfiltered (f, "constant: %ld", DW_UNSND (&die->attrs[i]));
+ fprintf_unfiltered (f, "constant: %s",
+ pulongest (DW_UNSND (&die->attrs[i])));
break;
case DW_FORM_sig8:
if (DW_SIGNATURED_TYPE (&die->attrs[i]) != NULL)
@@ -10230,10 +10239,10 @@ dwarf2_get_ref_die_offset (struct attribute *attr)
return 0;
}
-/* Return the constant value held by the given attribute. Return -1
- if the value held by the attribute is not constant. */
+/* Return the constant value held by ATTR. Return DEFAULT_VALUE if
+ * the value held by the attribute is not constant. */
-static int
+static LONGEST
dwarf2_get_attr_constant_value (struct attribute *attr, int default_value)
{
if (attr->form == DW_FORM_sdata)