aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom de Vries <tdevries@suse.de>2021-08-27 16:38:53 +0200
committerTom de Vries <tdevries@suse.de>2021-08-27 16:38:53 +0200
commit698c974ffc97f845f65d2e93d31bdbb1b24d6caf (patch)
tree89f00383fa6bd96cc6a2ba1a1a541a9a4b8a7371
parent77d63f99d67dd89cbcc99e9013dc0fc02930e026 (diff)
downloadbinutils-698c974ffc97f845f65d2e93d31bdbb1b24d6caf.zip
binutils-698c974ffc97f845f65d2e93d31bdbb1b24d6caf.tar.gz
binutils-698c974ffc97f845f65d2e93d31bdbb1b24d6caf.tar.bz2
[gdb/testsuite] Add label option to proc cu
We can use current dwarf assembly infrastructure to declare a label that marks the start of the CU header: ... declare_labels header_start_cu_a _section ".debug_info" header_start_cu_a : cu {} { } _section ".debug_info" header_start_cu_b : cu {} { } ... on the condition that we switch to the .debug_info section before, which makes this style of use fragile. Another way to achieve the same is to use the label as generated by the cu proc itself: ... variable _cu_label cu {} { } set header_start_cu_a $_cu_label cu {} { } set header_start_cu_b $_cu_label ... but again that seems fragile given that adding a new CU inbetween will silently result in the wrong value for the label. Add a label option to proc cu such that we can simply do: ... cu { label header_start_cu_a } { } cu { label header_start_cu_b } { } ... Tested on x86_64-linux.
-rw-r--r--gdb/testsuite/lib/dwarf.exp11
1 files changed, 11 insertions, 0 deletions
diff --git a/gdb/testsuite/lib/dwarf.exp b/gdb/testsuite/lib/dwarf.exp
index ce7b598..3aef58e 100644
--- a/gdb/testsuite/lib/dwarf.exp
+++ b/gdb/testsuite/lib/dwarf.exp
@@ -1258,6 +1258,10 @@ namespace eval Dwarf {
# default = default
# fission 0|1 - boolean indicating if generating Fission debug info
# default = 0
+ # label <label>
+ # - string indicating label to be defined at the start
+ # of the CU header.
+ # default = ""
# 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} {
@@ -1278,6 +1282,7 @@ namespace eval Dwarf {
set _cu_is_fission 0
set section ".debug_info"
set _abbrev_section ".debug_abbrev"
+ set label ""
foreach { name value } $options {
set value [uplevel 1 "subst \"$value\""]
@@ -1286,6 +1291,7 @@ namespace eval Dwarf {
version { set _cu_version $value }
addr_size { set _cu_addr_size $value }
fission { set _cu_is_fission $value }
+ label { set label $value }
default { error "unknown option $name" }
}
}
@@ -1318,6 +1324,11 @@ namespace eval Dwarf {
set start_label [_compute_label "cu${cu_num}_start"]
set end_label [_compute_label "cu${cu_num}_end"]
+ if { $label != "" } {
+ upvar $label my_label
+ set my_label $_cu_label
+ }
+
define_label $_cu_label
if {$is_64} {
_op .4byte 0xffffffff