aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/testsuite/ChangeLog6
-rw-r--r--gdb/testsuite/lib/dwarf.exp15
2 files changed, 16 insertions, 5 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 1c522e8..ab03f07 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2020-12-14 Mark Wielaard <mark@klomp.org>
+
+ * lib/dwarf.exp (Dwarf::_read_constants): Don't set
+ _constants(SPECIAL_expr) here, but set it...
+ (Dwarf::cu): ...here based on _cu_version.
+
2020-12-14 Tom de Vries <tdevries@suse.de>
* lib/gdb.exp (gdb_compile_shlib): Make sure it's not necessary to
diff --git a/gdb/testsuite/lib/dwarf.exp b/gdb/testsuite/lib/dwarf.exp
index ecd438b..43ae296 100644
--- a/gdb/testsuite/lib/dwarf.exp
+++ b/gdb/testsuite/lib/dwarf.exp
@@ -234,8 +234,9 @@ proc get_func_info { name {options {debug}} } {
# section automatically.
#
# If FORM is 'SPECIAL_expr', then VALUE is treated as a location
-# expression. The effective form is then DW_FORM_block, and VALUE
-# is passed to the (internal) '_location' proc to be translated.
+# expression. The effective form is then DW_FORM_block or DW_FORM_exprloc
+# for DWARF version >= 4, and VALUE is passed to the (internal)
+# '_location' proc to be translated.
# This proc implements a miniature DW_OP_ assembler.
#
# If FORM is not given, it is guessed:
@@ -389,7 +390,6 @@ namespace eval Dwarf {
proc _read_constants {} {
global srcdir hex decimal
- variable _constants
# DWARF name-matching regexp.
set dwrx "DW_\[a-zA-Z0-9_\]+"
@@ -416,8 +416,6 @@ namespace eval Dwarf {
}
}
close $fd
-
- set _constants(SPECIAL_expr) $_constants(DW_FORM_block)
}
proc _quote {string} {
@@ -1042,6 +1040,7 @@ namespace eval Dwarf {
# BODY is Tcl code that emits the DIEs which make up the body of
# the CU. It is evaluated in the caller's context.
proc cu {options body} {
+ variable _constants
variable _cu_count
variable _abbrev_section
variable _abbrev_num
@@ -1081,6 +1080,12 @@ namespace eval Dwarf {
set _abbrev_section ".debug_abbrev.dwo"
}
+ if {$_cu_version < 4} {
+ set _constants(SPECIAL_expr) $_constants(DW_FORM_block)
+ } else {
+ set _constants(SPECIAL_expr) $_constants(DW_FORM_exprloc)
+ }
+
_section $section
set cu_num [incr _cu_count]