summaryrefslogtreecommitdiff
path: root/gdb/testsuite/lib
diff options
context:
space:
mode:
authorDoug Evans <xdje42@gmail.com>2015-01-11 15:45:43 -0800
committerDoug Evans <xdje42@gmail.com>2015-01-11 15:45:43 -0800
commitf2e0d4b4ebd224797385ca22a031d74346b2475a (patch)
treed5d73d05ac3ff3121ac80958e9ed2876574a9f60 /gdb/testsuite/lib
parent6a3ca067521821b6c2ad9a836104d11e6dd760cb (diff)
downloadbinutils-gdb-f2e0d4b4ebd224797385ca22a031d74346b2475a.tar.gz
Require numeric attributes to specify the form.
gdb/testsuite/ChangeLog: * lib/dwarf.exp (Dwarf): Flag an error if a numeric attribute value is given without an explicit form. * gdb.dwarf2/arr-subrange.exp: Specify forms for all numeric attributes. * gdb.dwarf/corrupt.exp: Ditto. * gdb.dwarf2/enum-type.exp: Ditto. * gdb.trace/entry-values.exp: Ditto. * gdb.trace/unavailable-dwarf-piece.exp: Ditto.
Diffstat (limited to 'gdb/testsuite/lib')
-rw-r--r--gdb/testsuite/lib/dwarf.exp8
1 files changed, 7 insertions, 1 deletions
diff --git a/gdb/testsuite/lib/dwarf.exp b/gdb/testsuite/lib/dwarf.exp
index f44ecd7524c..8ea7a0fdc42 100644
--- a/gdb/testsuite/lib/dwarf.exp
+++ b/gdb/testsuite/lib/dwarf.exp
@@ -225,7 +225,9 @@ proc function_range { func src } {
# reference. The rest of VALUE is taken to be the name of a label,
# and DW_FORM_ref4 is used. See 'new_label' and 'define_label'.
# * Otherwise, VALUE is taken to be a string and DW_FORM_string is
-# used.
+# used. In order to prevent bugs where a numeric value is given but
+# no form is specified, it is an error if the value looks like a number
+# (using Tcl's "string is integer") and no form is provided.
# More form-guessing functionality may be added.
#
# CHILDREN is just Tcl code that can be used to define child DIEs. It
@@ -614,6 +616,10 @@ namespace eval Dwarf {
if {[llength $attr] > 2} {
set attr_form [lindex $attr 2]
} else {
+ # If the value looks like an integer, a form is required.
+ if [string is integer $attr_value] {
+ error "Integer value requires a form"
+ }
set attr_form [_guess_form $attr_value attr_value]
}
set attr_form [_map_name $attr_form _FORM]