aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@polymtl.ca>2021-08-30 11:20:59 -0400
committerSimon Marchi <simon.marchi@polymtl.ca>2021-09-30 22:21:56 -0400
commit46a5b75b37853b30963d7399e18b2124e6d129e2 (patch)
treea011d55ff6482845641406890881edaf48cef79c
parentc5dfcc218832f26e7ecefa6c44a2b350c605148f (diff)
downloadgdb-46a5b75b37853b30963d7399e18b2124e6d129e2.zip
gdb-46a5b75b37853b30963d7399e18b2124e6d129e2.tar.gz
gdb-46a5b75b37853b30963d7399e18b2124e6d129e2.tar.bz2
gdb/testsuite/dwarf: use options for rnglists/loclists procs
Change how rnglists and loclists procs to align them with how procs for aranges (and other things in the DWARF assembler) work. Instead of using "args" (variable number of parameters in TCL) and command-line style option arguments, use one leading "option" parameters, used as a kind of key/value dictionary of options parsed using `parse_options`. Change-Id: I63e60d17ae16a020ce4d6de44baf3d152ea42a1a
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-zero-range.exp4
-rw-r--r--gdb/testsuite/gdb.dwarf2/loclists-multiple-cus.exp6
-rw-r--r--gdb/testsuite/gdb.dwarf2/loclists-sec-offset.exp8
-rw-r--r--gdb/testsuite/gdb.dwarf2/loclists-start-end.exp6
-rw-r--r--gdb/testsuite/gdb.dwarf2/rnglists-multiple-cus.exp6
-rw-r--r--gdb/testsuite/gdb.dwarf2/rnglists-sec-offset.exp8
-rw-r--r--gdb/testsuite/lib/dwarf.exp83
7 files changed, 46 insertions, 75 deletions
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-zero-range.exp b/gdb/testsuite/gdb.dwarf2/dw2-zero-range.exp
index 0320c11..478299d 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-zero-range.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-zero-range.exp
@@ -81,8 +81,8 @@ foreach_with_prefix ranges_sect {ranges rnglists} {
}
}
- rnglists {
- table {
+ rnglists {} {
+ table {} {
rnglists_label: list_ {
start_end 0 1
}
diff --git a/gdb/testsuite/gdb.dwarf2/loclists-multiple-cus.exp b/gdb/testsuite/gdb.dwarf2/loclists-multiple-cus.exp
index 47e163f..7844628 100644
--- a/gdb/testsuite/gdb.dwarf2/loclists-multiple-cus.exp
+++ b/gdb/testsuite/gdb.dwarf2/loclists-multiple-cus.exp
@@ -87,17 +87,17 @@ foreach_with_prefix is_64 {false true} {
}
}
- loclists -is-64 $is_64 {
+ loclists {is-64 $is_64} {
# This table is unused, but exists so that the used table is not at
# the beginning of the section.
- table {
+ table {} {
list_ {
start_length 0x1000 0x1000 { DW_OP_addr 0x100000 }
}
}
# The lists in this table are accessed by index (DW_FORM_rnglistx).
- table -post-header-label cu_table {
+ table {post-header-label cu_table} {
# This list is unused, but exists to offset the next ones.
list_ {
start_length 0x1000 0x1000 { DW_OP_addr 0x100000 }
diff --git a/gdb/testsuite/gdb.dwarf2/loclists-sec-offset.exp b/gdb/testsuite/gdb.dwarf2/loclists-sec-offset.exp
index 0ca9dc1..b7a4590 100644
--- a/gdb/testsuite/gdb.dwarf2/loclists-sec-offset.exp
+++ b/gdb/testsuite/gdb.dwarf2/loclists-sec-offset.exp
@@ -165,10 +165,10 @@ foreach_with_prefix is_64 {false true} {
}
}
- loclists -is-64 $is_64 {
+ loclists {is-64 $is_64} {
# The lists in this table are accessed by direct offset
# (DW_FORM_sec_offset).
- table {
+ table {} {
foo_location_list: list_ {
start_length $func1_addr $func1_len {
DW_OP_constu 0x123456
@@ -182,7 +182,7 @@ foreach_with_prefix is_64 {false true} {
}
}
- table -post-header-label cu2_table {
+ table {post-header-label cu2_table} {
bar_location_list: list_ {
start_length $func3_addr $func3_len {
DW_OP_constu 0x345678
@@ -196,7 +196,7 @@ foreach_with_prefix is_64 {false true} {
}
}
- table -with-offset-array false {
+ table {with-offset-array false} {
baz_location_list: list_ {
start_length $func5_addr $func5_len {
DW_OP_constu 0x567890
diff --git a/gdb/testsuite/gdb.dwarf2/loclists-start-end.exp b/gdb/testsuite/gdb.dwarf2/loclists-start-end.exp
index ce611fb..e3c12e5 100644
--- a/gdb/testsuite/gdb.dwarf2/loclists-start-end.exp
+++ b/gdb/testsuite/gdb.dwarf2/loclists-start-end.exp
@@ -78,17 +78,17 @@ foreach_with_prefix is_64 {false true} {
}
}
- loclists -is-64 $is_64 {
+ loclists {is-64 $is_64} {
# This table is unused, but exists so that the used table is not at
# the beginning of the section.
- table {
+ table {} {
list_ {
start_end 0x1000 0x2000 { DW_OP_addr 0x100000 }
}
}
# The lists in this table are accessed by index (DW_FORM_rnglistx).
- table -post-header-label cu_table {
+ table {post-header-label cu_table} {
# This list is unused, but exists to offset the next ones.
list_ {
start_end 0x1000 0x2000 { DW_OP_addr 0x100000 }
diff --git a/gdb/testsuite/gdb.dwarf2/rnglists-multiple-cus.exp b/gdb/testsuite/gdb.dwarf2/rnglists-multiple-cus.exp
index e09cd4e..2e83b37 100644
--- a/gdb/testsuite/gdb.dwarf2/rnglists-multiple-cus.exp
+++ b/gdb/testsuite/gdb.dwarf2/rnglists-multiple-cus.exp
@@ -63,17 +63,17 @@ foreach_with_prefix is_64 {false true} {
}
}
- rnglists -is-64 $is_64 {
+ rnglists {is-64 $is_64} {
# This table is unused, but exists so that the used table is not at
# the beginning of the section.
- table {
+ table {} {
list_ {
start_end 0x1000 0x2000
}
}
# The lists in this table are accessed by index (DW_FORM_rnglistx).
- table -post-header-label cu_table {
+ table {post-header-label cu_table} {
# This list is unused, but exists to offset the next ones.
list_ {
start_end 0x2000 0x3000
diff --git a/gdb/testsuite/gdb.dwarf2/rnglists-sec-offset.exp b/gdb/testsuite/gdb.dwarf2/rnglists-sec-offset.exp
index 0733e90..e5ae777 100644
--- a/gdb/testsuite/gdb.dwarf2/rnglists-sec-offset.exp
+++ b/gdb/testsuite/gdb.dwarf2/rnglists-sec-offset.exp
@@ -90,10 +90,10 @@ foreach_with_prefix is_64 {false true} {
}
}
- rnglists -is-64 $is_64 {
+ rnglists {is-64 $is_64} {
# The lists in this table are accessed by direct offset
# (DW_FORM_sec_offset).
- table {
+ table {} {
# For the first CU.
cu1_range_list: list_ {
start_end 0x4000 0x5000
@@ -105,7 +105,7 @@ foreach_with_prefix is_64 {false true} {
}
}
- table -post-header-label cu2_table {
+ table {post-header-label cu2_table} {
# For the second CU.
cu2_range_list: list_ {
start_end 0x5000 0x6000
@@ -117,7 +117,7 @@ foreach_with_prefix is_64 {false true} {
}
}
- table -with-offset-array false {
+ table {with-offset-array false} {
# For the third CU.
cu3_range_list: list_ {
start_end 0x6000 0x7000
diff --git a/gdb/testsuite/lib/dwarf.exp b/gdb/testsuite/lib/dwarf.exp
index 87c8a13..66f9844 100644
--- a/gdb/testsuite/lib/dwarf.exp
+++ b/gdb/testsuite/lib/dwarf.exp
@@ -1543,27 +1543,18 @@ namespace eval Dwarf {
#
# The target address size is based on the current target's address size.
#
- # There is one mandatory positional argument, BODY, which must be Tcl code
- # that emits the content of the section. It is evaluated in the caller's
- # context.
+ # BODY must be Tcl code that emits the content of the section. It is
+ # evaluated in the caller's context.
#
- # The following option can be used:
- #
- # - -is-64 true|false: Whether to use 64-bit DWARF instead of 32-bit DWARF.
- # The default is 32-bit.
+ # The `is-64 true|false` options tells whether to use 64-bit DWARF instead
+ # of 32-bit DWARF. The default is 32-bit.
- proc rnglists { args } {
+ proc rnglists { options body } {
variable _debug_rnglists_addr_size
variable _debug_rnglists_offset_size
variable _debug_rnglists_is_64_dwarf
- parse_args {{"is-64" "false"}}
-
- if { [llength $args] != 1 } {
- error "rnglists proc expects one positional argument (body)"
- }
-
- lassign $args body
+ parse_options {{"is-64" "false"}}
if [is_64_target] {
set _debug_rnglists_addr_size 8
@@ -1603,34 +1594,29 @@ namespace eval Dwarf {
# This proc is meant to be used within proc rnglists' body. It is made
# available as `table` while inside proc rnglists' body.
#
- # Accepts one positional argument, BODY. BODY may call the LIST_ procedure
- # to generate rnglists.
+ # BODY must be Tcl code that emits the content of the table. It may call
+ # the LIST_ procedure to generate rnglists. It is evaluated in the
+ # caller's context.
#
- # The -post-header-label option can be used to define a label just after
+ # The `post-header-label` option can be used to define a label just after
# the header of the table. This is the label that a DW_AT_rnglists_base
# attribute will usually refer to.
#
- # The `-with-offset-array true|false` option can be used to control whether
+ # The `with-offset-array true|false` option can be used to control whether
# the headers of the location list tables have an array of offset. The
# default is true.
- proc _rnglists_table { args } {
+ proc _rnglists_table { options body } {
variable _debug_rnglists_table_count
variable _debug_rnglists_addr_size
variable _debug_rnglists_offset_size
variable _debug_rnglists_is_64_dwarf
- parse_args {
+ parse_options {
{post-header-label ""}
{with-offset-array true}
}
- if { [llength $args] != 1 } {
- error "table proc expects one positional argument (body)"
- }
-
- lassign $args body
-
# Count of lists in the table.
variable _debug_rnglists_list_count 0
@@ -1743,27 +1729,18 @@ namespace eval Dwarf {
#
# The target address size is based on the current target's address size.
#
- # There is one mandatory positional argument, BODY, which must be Tcl code
- # that emits the content of the section. It is evaluated in the caller's
- # context.
- #
- # The following option can be used:
+ # BODY must be Tcl code that emits the content of the section. It is
+ # evaluated in the caller's context.
#
- # - -is-64 true|false: Whether to use 64-bit DWARF instead of 32-bit DWARF.
- # The default is 32-bit.
+ # The `is-64 true|false` options tells whether to use 64-bit DWARF instead
+ # of 32-bit DWARF. The default is 32-bit.
- proc loclists { args } {
+ proc loclists { options body } {
variable _debug_loclists_addr_size
variable _debug_loclists_offset_size
variable _debug_loclists_is_64_dwarf
- parse_args {{"is-64" "false"}}
-
- if { [llength $args] != 1 } {
- error "loclists proc expects one positional argument (body)"
- }
-
- lassign $args body
+ parse_options {{"is-64" "false"}}
if [is_64_target] {
set _debug_loclists_addr_size 8
@@ -1803,35 +1780,29 @@ namespace eval Dwarf {
# This proc is meant to be used within proc loclists' body. It is made
# available as `table` while inside proc rnglists' body.
#
- # Accepts one position argument, BODY. BODY may call the LIST_
- # procedure to generate loclists.
+ # BODY must be Tcl code that emits the content of the table. It may call
+ # the LIST_ procedure to generate rnglists. It is evaluated in the
+ # caller's context.
#
- # The -post-header-label option can be used to define a label just after the
- # header of the table. This is the label that a DW_AT_loclists_base
+ # The `post-header-label` option can be used to define a label just after
+ # the header of the table. This is the label that a DW_AT_loclists_base
# attribute will usually refer to.
#
- # The `-with-offset-array true|false` option can be used to control
+ # The `with-offset-array true|false` option can be used to control
# whether the headers of the location list tables have an array of
# offset. The default is true.
- proc _loclists_table { args } {
+ proc _loclists_table { options body } {
variable _debug_loclists_table_count
variable _debug_loclists_addr_size
variable _debug_loclists_offset_size
variable _debug_loclists_is_64_dwarf
- parse_args {
+ parse_options {
{post-header-label ""}
{with-offset-array true}
}
- if { [llength $args] != 1 } {
- error "table proc expects one positional argument (body)"
- }
-
- lassign $args body
-
-
# Count of lists in the table.
variable _debug_loclists_list_count 0