diff options
author | Simon Marchi <simon.marchi@efficios.com> | 2020-11-06 13:09:58 -0500 |
---|---|---|
committer | Simon Marchi <simon.marchi@efficios.com> | 2020-11-06 13:10:29 -0500 |
commit | a1945bd4520d2964e7d022b9171bf6bb58d8e90a (patch) | |
tree | 5cc7026a47954535cc5ae514631fdb64cc29c1be /gdb/testsuite/lib | |
parent | 3fed4c0b7adeae7b2bfd9aa59818bb8f3f381031 (diff) | |
download | gdb-a1945bd4520d2964e7d022b9171bf6bb58d8e90a.zip gdb-a1945bd4520d2964e7d022b9171bf6bb58d8e90a.tar.gz gdb-a1945bd4520d2964e7d022b9171bf6bb58d8e90a.tar.bz2 |
gdb/testsuite: make DWARF assembler's ranges' "base" and "range" procs
When creating a .debug_ranges section using the testsuite's DWARF
assembler, it currently looks like this:
ranges {
sequence {
{base ...}
{range ...}
{range ...}
}
}
The sub-tree of sequence is manually traversed as a list of lists. I
think it would be nicer if `base` and `range` where procedure, just like
the other levels:
ranges {
sequence {
base ...
range ...
range ...
}
}
That makes the implementation more robust, and the usage a bit nicer
(less special characters). It also allows having comments in between
the range list entries:
ranges {
sequence {
base ...
range ...
# Hello world.
range ...
}
}
... which doesn't work with the current approach.
gdb/testsuite/ChangeLog:
* lib/dwarf.exp (ranges): Handle "base" and "range" as
proceduresu.
* gdb.dwarf/dw2-bad-elf.exp: Adjust.
* gdb.dwarf2/dw2-inline-many-frames.exp: Adjust.
* gdb.dwarf2/dw2-inline-stepping.exp: Adjust.
* gdb.dwarf2/dw2-ranges-base.exp: Adjust.
* gdb.dwarf2/dw2-ranges-func.exp: Adjust.
* gdb.dwarf2/dw2-ranges-overlap.exp: Adjust.
* gdb.dwarf2/dw2-ranges-psym.exp: Adjust.
* gdb.dwarf2/enqueued-cu-base-addr.exp: Adjust.
Change-Id: I0b2af480faff54d0fd4214e0cc8d042d9583a865
Diffstat (limited to 'gdb/testsuite/lib')
-rw-r--r-- | gdb/testsuite/lib/dwarf.exp | 55 |
1 files changed, 25 insertions, 30 deletions
diff --git a/gdb/testsuite/lib/dwarf.exp b/gdb/testsuite/lib/dwarf.exp index c585621..c1596df 100644 --- a/gdb/testsuite/lib/dwarf.exp +++ b/gdb/testsuite/lib/dwarf.exp @@ -1247,42 +1247,37 @@ namespace eval Dwarf { set section ".debug_ranges" _section $section - proc sequence {{ranges {}}} { + proc sequence { body } { variable _debug_ranges_64_bit # Emit the sequence of addresses. - set base "" - foreach range $ranges { - set range [uplevel 1 "subst \"$range\""] - set type [lindex $range 0] - switch -exact -- $type { - base { - set base [lrange $range 1 end] - - if { $_debug_ranges_64_bit } then { - _op .8byte 0xffffffffffffffff "Base Marker" - _op .8byte $base "Base Address" - } else { - _op .4byte 0xffffffff "Base Marker" - _op .4byte $base "Base Address" - } - } - range { - set start [lindex $range 1] - set end [lrange $range 2 end] - - if { $_debug_ranges_64_bit } then { - _op .8byte $start "Start Address" - _op .8byte $end "End Address" - } else { - _op .4byte $start "Start Address" - _op .4byte $end "End Address" - } - } - default { error "unknown range type: $type " } + + proc base { addr } { + variable _debug_ranges_64_bit + + if { $_debug_ranges_64_bit } then { + _op .8byte 0xffffffffffffffff "Base Marker" + _op .8byte $addr "Base Address" + } else { + _op .4byte 0xffffffff "Base Marker" + _op .4byte $addr "Base Address" } } + proc range { start end } { + variable _debug_ranges_64_bit + + if { $_debug_ranges_64_bit } then { + _op .8byte $start "Start Address" + _op .8byte $end "End Address" + } else { + _op .4byte $start "Start Address" + _op .4byte $end "End Address" + } + } + + uplevel $body + # End of the sequence. if { $_debug_ranges_64_bit } then { _op .8byte 0x0 "End of Sequence Marker (Part 1)" |