From: Simon Marchi <simon.marchi@polymtl.ca>
To: Tom de Vries <tdevries@suse.de>, Tom Tromey <tom@tromey.com>,
Tom de Vries via Gdb-patches <gdb-patches@sourceware.org>
Subject: Re: [PATCH][gdb/testsuite] Support .debug_aranges in dwarf assembly
Date: Sat, 28 Aug 2021 16:29:10 -0400 [thread overview]
Message-ID: <3ece042f-2e05-66dd-2f18-0ba2555a76dd@polymtl.ca> (raw)
In-Reply-To: <cd404173-082c-abd1-6f92-2459dba09c2d@suse.de>
On 2021-08-28 11:31 a.m., Tom de Vries wrote:
> On 8/27/21 5:09 PM, Simon Marchi via Gdb-patches wrote:
>>
>>
>> On 2021-08-27 9:35 a.m., Tom Tromey wrote:
>>>>>>>> "Tom" == Tom de Vries via Gdb-patches <gdb-patches@sourceware.org> writes:
>>>
>>> Tom> + # arange [-c <comment>] [<segment selector>] <start> <length>
>>> Tom> + # -- adds an address range.
>>>
>>> I wonder if there's a way to make this more tcl-ish, say by rearranging
>>> the order of arguments so that things can be defaulted. I think the
>>> "args"-parsing style should normally be a last resort.
>>
>> I personally don't like this style
>>
>> proc arange { arange_start arange_length {comment ""} {seg_sel ""} }
>>
>> ... because if you want to specify the last parameter, you need to give
>> all the other optional ones before.
>>
>> I also agree that just having:
>>
>> proc arange { args }
>>
>> is not great, since we have to do the argument parsing by hand, and it's
>> a bit opaque what the proc accepts. Could we consistently use the
>> "options" pattern, such as the one used by aranges and cu?
>>
>> proc arange { options arange_start arange_length }
>>
>> The callers would look like:
>>
>> arange {} $start $length
>> arange {
>> comment $comment
>> seg_sel $seg_sel
>> } $start $length
>>
>> I think that's a good compromise. I could re-do the rnglists procs this
>> way, if you'd like.
>>
>
> This patch implements that approach, using a new proc parse_options
> similar to parse_args.
>
> WDYT?
Here:
@@ -2354,9 +2350,9 @@ namespace eval Dwarf {
# Terminator tuple.
set comment "Terminator"
if { $_seg_size == 0 } {
- arange 0 0 $comment
+ arange [list comment $comment] 0 0
} else {
- arange 0 0 $comment 0
+ arange [list comment $comment seg_sel 0] 0 0
}
Could we apply some magic so that we are able to use { } instead of
list?
arange {
comment $comment
set_seg 0
} { ... }
... instead of having to use [list ...]? I suppose doing an "eval" or
something of the option value in the caller's context?
Simon
next prev parent reply other threads:[~2021-08-28 20:29 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-26 11:56 Tom de Vries
2021-08-27 13:35 ` Tom Tromey
2021-08-27 14:39 ` Tom de Vries
2021-08-27 15:09 ` Simon Marchi
2021-08-27 16:11 ` Keith Seitz
2021-08-27 16:14 ` Tom Tromey
2021-08-27 17:03 ` Simon Marchi
2021-08-27 17:10 ` Tom Tromey
2021-08-27 17:23 ` Simon Marchi
2021-08-28 15:31 ` Tom de Vries
2021-08-28 20:29 ` Simon Marchi [this message]
2021-08-28 21:28 ` Simon Marchi
2021-08-29 15:31 ` Tom de Vries
2021-08-29 19:54 ` Simon Marchi
2021-08-29 21:11 ` Tom de Vries
2021-08-30 8:35 ` Tom de Vries
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3ece042f-2e05-66dd-2f18-0ba2555a76dd@polymtl.ca \
--to=simon.marchi@polymtl.ca \
--cc=gdb-patches@sourceware.org \
--cc=tdevries@suse.de \
--cc=tom@tromey.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).