diff options
author | Mark Wielaard <mark@klomp.org> | 2020-12-14 17:38:09 +0100 |
---|---|---|
committer | Mark Wielaard <mark@klomp.org> | 2020-12-14 20:16:33 +0100 |
commit | eab9267c330046846aa15217da7dcb77f4588220 (patch) | |
tree | 3c252fc5da9996df24b5a7e3289b3164029f528a /gdb/testsuite | |
parent | 2f4132646d8dbf8c1a82d63cacbb36ee46a289bb (diff) | |
download | gdb-eab9267c330046846aa15217da7dcb77f4588220.zip gdb-eab9267c330046846aa15217da7dcb77f4588220.tar.gz gdb-eab9267c330046846aa15217da7dcb77f4588220.tar.bz2 |
Use DW_FORM_exprloc in testsuite Dwarf Assembler for DWARF version 4+.
Since DWARF version 4 expressions are represented by DW_FORM_exprloc
instead of a block form. Support this in the testsuite Dwarf Assembler
by setting the SPECIAL_expr form once we know the CU version.
This doesn't change any testsuite results, it just makes the produced
DWARF valid. gdb also accepts expressions in block form for DWARF
version 4 and above, but this is technically incorrect.
gdb/testsuite/ChangeLog:
* lib/dwarf.exp (Dwarf::_read_constants): Don't set
_constants(SPECIAL_expr) here, but set it...
(Dwarf::cu): ...here based on _cu_version.
Diffstat (limited to 'gdb/testsuite')
-rw-r--r-- | gdb/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | gdb/testsuite/lib/dwarf.exp | 15 |
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] |