aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorJoel Brobecker <brobecker@adacore.com>2014-02-26 10:53:05 -0800
committerJoel Brobecker <brobecker@adacore.com>2014-02-26 10:54:27 -0800
commitdbb9c2b1f231262ece36790241fe1fc3902cf03d (patch)
tree6b4eb9731f91c2bebaaad4188092bd58f56e61a1 /gdb
parent55426c9d52fdba13df81fcce1b18469cc0362e50 (diff)
downloadgdb-dbb9c2b1f231262ece36790241fe1fc3902cf03d.zip
gdb-dbb9c2b1f231262ece36790241fe1fc3902cf03d.tar.gz
gdb-dbb9c2b1f231262ece36790241fe1fc3902cf03d.tar.bz2
Add comment in dwarf2read.c::read_subrange_type
This comment explains why we sometimes sign-extend the range type bounds when we normally shouldn't have to. gdb/ChangeLog: * dwarf2read.c (read_subrange_type): Add comment.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog4
-rw-r--r--gdb/dwarf2read.c7
2 files changed, 11 insertions, 0 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 8f2f0dc..49d8113 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,9 @@
2014-02-27 Joel Brobecker <brobecker@adacore.com>
+ * dwarf2read.c (read_subrange_type): Add comment.
+
+2014-02-27 Joel Brobecker <brobecker@adacore.com>
+
* dwarf2read.c (update_enumeration_type_from_children): New
function, mostly extracted from process_structure_scope.
(read_enumeration_type): Call update_enumeration_type_from_children.
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 00bba47..52208d6 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -14522,6 +14522,13 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu)
}
}
+ /* Normally, the DWARF producers are expected to use a signed
+ constant form (Eg. DW_FORM_sdata) to express negative bounds.
+ But this is unfortunately not always the case, as witnessed
+ with GCC, for instance, where the ambiguous DW_FORM_dataN form
+ is used instead. To work around that ambiguity, we treat
+ the bounds as signed, and thus sign-extend their values, when
+ the base type is signed. */
negative_mask =
(LONGEST) -1 << (TYPE_LENGTH (base_type) * TARGET_CHAR_BIT - 1);
if (!TYPE_UNSIGNED (base_type) && (low & negative_mask))