diff options
author | Simon Marchi <simon.marchi@polymtl.ca> | 2021-08-30 11:20:59 -0400 |
---|---|---|
committer | Simon Marchi <simon.marchi@polymtl.ca> | 2021-09-30 22:21:56 -0400 |
commit | 46a5b75b37853b30963d7399e18b2124e6d129e2 (patch) | |
tree | a011d55ff6482845641406890881edaf48cef79c /gdb/testsuite/lib | |
parent | c5dfcc218832f26e7ecefa6c44a2b350c605148f (diff) | |
download | gdb-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
Diffstat (limited to 'gdb/testsuite/lib')
-rw-r--r-- | gdb/testsuite/lib/dwarf.exp | 83 |
1 files changed, 27 insertions, 56 deletions
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 |