aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@efficios.com>2020-11-06 13:09:58 -0500
committerSimon Marchi <simon.marchi@efficios.com>2020-11-06 13:10:29 -0500
commita1945bd4520d2964e7d022b9171bf6bb58d8e90a (patch)
tree5cc7026a47954535cc5ae514631fdb64cc29c1be
parent3fed4c0b7adeae7b2bfd9aa59818bb8f3f381031 (diff)
downloadgdb-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
-rw-r--r--gdb/testsuite/ChangeLog13
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-bad-elf.exp8
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-inline-many-frames.exp12
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-inline-stepping.exp4
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-ranges-base.exp12
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-ranges-func.exp14
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-ranges-overlap.exp8
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-ranges-psym.exp12
-rw-r--r--gdb/testsuite/gdb.dwarf2/enqueued-cu-base-addr.exp2
-rw-r--r--gdb/testsuite/lib/dwarf.exp55
10 files changed, 74 insertions, 66 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 06ca3e7..42c317a 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,16 @@
+2020-11-06 Simon Marchi <simon.marchi@efficios.com>
+
+ * 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.
+
2020-11-04 Tom Tromey <tromey@adacore.com>
* gdb.ada/funcall_ref.exp: Update.
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-bad-elf.exp b/gdb/testsuite/gdb.dwarf2/dw2-bad-elf.exp
index e939046..20ecd68 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-bad-elf.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-bad-elf.exp
@@ -107,12 +107,12 @@ Dwarf::assemble $asm_file {
ranges {is_64 [is_64_target]} {
ranges_label_1: sequence {
- {base [lindex $main_result 0]}
- {range 0 [lindex $main_result 1]}
+ base [lindex $main_result 0]
+ range 0 [lindex $main_result 1]
}
ranges_label_2: sequence {
- {base some_func}
- {range 0 64}
+ base some_func
+ range 0 64
}
}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-inline-many-frames.exp b/gdb/testsuite/gdb.dwarf2/dw2-inline-many-frames.exp
index 935d519..591a927 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-inline-many-frames.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-inline-many-frames.exp
@@ -281,12 +281,12 @@ Dwarf::assemble $asm_file {
ranges {is_64 [is_64_target]} {
ranges_label: sequence {
- {range {${main_start}} ${main_end}}
- {range {${ddd_start}} ${ddd_end}}
- {range {${eee_start}} ${eee_end}}
- {range {${fff_start}} ${fff_end}}
- {range {${jjj_start}} ${jjj_end}}
- {range {${kkk_start}} ${kkk_end}}
+ range ${main_start} ${main_end}
+ range ${ddd_start} ${ddd_end}
+ range ${eee_start} ${eee_end}
+ range ${fff_start} ${fff_end}
+ range ${jjj_start} ${jjj_end}
+ range ${kkk_start} ${kkk_end}
}
}
}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-inline-stepping.exp b/gdb/testsuite/gdb.dwarf2/dw2-inline-stepping.exp
index 24fbb71..a585324 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-inline-stepping.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-inline-stepping.exp
@@ -122,8 +122,8 @@ Dwarf::assemble $asm_file {
ranges {is_64 [is_64_target]} {
ranges_label: sequence {
- {range {${main_start}} ${main_end}}
- {range {${bar_start}} ${bar_end}}
+ range ${main_start} ${main_end}
+ range ${bar_start} ${bar_end}
}
}
}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-ranges-base.exp b/gdb/testsuite/gdb.dwarf2/dw2-ranges-base.exp
index 3f03fa6..3164a90 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-ranges-base.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-ranges-base.exp
@@ -115,12 +115,12 @@ Dwarf::assemble $asm_file {
# base for each function.
ranges {is_64 [is_64_target]} {
ranges_label: sequence {
- {base [lindex $main_func 0]}
- {range 0 [lindex $main_func 1]}
- {base [lindex $frame2_func 0]}
- {range 0 [lindex $frame2_func 1]}
- {base [lindex $frame3_func 0]}
- {range 0 [lindex $frame3_func 1]}
+ base [lindex $main_func 0]
+ range 0 [lindex $main_func 1]
+ base [lindex $frame2_func 0]
+ range 0 [lindex $frame2_func 1]
+ base [lindex $frame3_func 0]
+ range 0 [lindex $frame3_func 1]
}
}
}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-ranges-func.exp b/gdb/testsuite/gdb.dwarf2/dw2-ranges-func.exp
index ac37b24..504b404 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-ranges-func.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-ranges-func.exp
@@ -199,15 +199,15 @@ proc do_test {suffix} {
# Generate ranges data.
ranges {is_64 [is_64_target]} {
func_ranges_label: sequence {
- {range {$foo_start } $foo_end}
- {range {$foo_cold_start} $foo_cold_end}
+ range $foo_start $foo_end
+ range $foo_cold_start $foo_cold_end
}
cu_ranges_label: sequence {
- {range {$foo_start } $foo_end}
- {range {$foo_cold_start} $foo_cold_end}
- {range {$main_start} $main_end}
- {range {$bar_start} $bar_end}
- {range {$baz_start} $baz_end}
+ range $foo_start $foo_end
+ range $foo_cold_start $foo_cold_end
+ range $main_start $main_end
+ range $bar_start $bar_end
+ range $baz_start $baz_end
}
}
}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-ranges-overlap.exp b/gdb/testsuite/gdb.dwarf2/dw2-ranges-overlap.exp
index 59c10c8..485f5c0 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-ranges-overlap.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-ranges-overlap.exp
@@ -66,10 +66,10 @@ Dwarf::assemble $asm_file {
ranges {is_64 [is_64_target]} {
ranges_label: sequence {
- {base [lindex $main_func 0]}
- {range 0 [lindex $main_func 1]}
- {base [lindex $bar_func 0]}
- {range 0 [lindex $bar_func 1]}
+ base [lindex $main_func 0]
+ range 0 [lindex $main_func 1]
+ base [lindex $bar_func 0]
+ range 0 [lindex $bar_func 1]
}
}
}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-ranges-psym.exp b/gdb/testsuite/gdb.dwarf2/dw2-ranges-psym.exp
index 4ced125..1be27c2 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-ranges-psym.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-ranges-psym.exp
@@ -108,14 +108,14 @@ Dwarf::assemble $asm_file {
# Generate ranges data.
ranges {is_64 [is_64_target]} {
func_ranges_label: sequence {
- {range {$foo_start } $foo_end}
- {range {$foo_low_start} $foo_low_end}
+ range $foo_start $foo_end
+ range $foo_low_start $foo_low_end
}
cu_ranges_label: sequence {
- {range {$foo_start } $foo_end}
- {range {$foo_low_start} $foo_low_end}
- {range {$bar_start} $bar_end}
- {range {$baz_start} $baz_end}
+ range $foo_start $foo_end
+ range $foo_low_start $foo_low_end
+ range $bar_start $bar_end
+ range $baz_start $baz_end
}
}
}
diff --git a/gdb/testsuite/gdb.dwarf2/enqueued-cu-base-addr.exp b/gdb/testsuite/gdb.dwarf2/enqueued-cu-base-addr.exp
index 77fe6ff..e4ac1c9 100644
--- a/gdb/testsuite/gdb.dwarf2/enqueued-cu-base-addr.exp
+++ b/gdb/testsuite/gdb.dwarf2/enqueued-cu-base-addr.exp
@@ -73,7 +73,7 @@ Dwarf::assemble $asm_file {
ranges {is_64 [is_64_target]} {
ranges_label: sequence {
- {range 0 [lindex $main_func 1]}
+ range 0 [lindex $main_func 1]
}
}
}
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)"