From: Simon Marchi <simon.marchi@polymtl.ca>
To: Tom Tromey <tom@tromey.com>, Simon Marchi <simon.marchi@efficios.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH 2/6] gdb/testsuite/dwarf: convert _section proc to use parse_options
Date: Wed, 19 Nov 2025 15:40:12 -0500 [thread overview]
Message-ID: <42a67fe2-718e-44e3-8a13-066205b2c3f4@polymtl.ca> (raw)
In-Reply-To: <87v7j6qari.fsf@tromey.com>
On 2025-11-19 10:53, Tom Tromey wrote:
>>>>>> "Simon" == Simon Marchi <simon.marchi@efficios.com> writes:
>
> I meant to send this last week but forgot.
>
> Simon> - proc _section {name {flags ""} {type ""}} {
> Simon> - if {$name == ".debug_str"} {
> Simon> - # Hard-code this because it's always desirable.
> Simon> - _emit " .section $name, \"MS\", %progbits, 1"
> Simon> - } elseif {$flags == "" && $type == ""} {
> Simon> - _emit " .section $name"
> Simon> - } elseif {$type == ""} {
> Simon> - _emit " .section $name, \"$flags\""
> Simon> - } else {
> Simon> - _emit " .section $name, \"$flags\", %$type"
>
> This code ignores flags and type if name is .debug_str, but the
> replacement code:
>
> Simon> + if { $name == ".debug_str" } {
> Simon> + # Hard-code this because it's always desirable.
> Simon> + append directive ", \"MS\", %progbits, 1"
> Simon> + }
> Simon> +
> Simon> + if { $flags != "" } {
> Simon> + append directive ",\"$flags\""
> Simon> + }
> Simon> +
> Simon> + if { $type != "" } {
> Simon> + # Can't specify a type without flags.
> Simon> + if { $flags == "" } {
> Simon> + append directive ", \"\""
> Simon> + }
> Simon> +
> Simon> + append directive ", %$type"
> Simon> + }
>
> ... does not.
>
> I think the old code was clearer in this regard. I didn't read forward
> in the series to see if this restructuring helps newer code though.
> Anyway this change should be addressed.
It's true that if one was to call the proc with $name == ".debug_str"
and some flags, the resulting assembler directive would be malformed. I
can change it to
if { $name == ".debug_str" } {
# Hard-code this because it's always desirable.
_emit " .section .debug_str, \"MS\", %progbits, 1"
return
}
I think that would make it clear again that this is a special case,
disconnected from the rest.
Or something cleaner would be to remove this bit from this proc, and
add a _section_debug_str proc that would call _section with the right
params (might need a _defer_output_debug_str as well).
Simon
next prev parent reply other threads:[~2025-11-19 20:40 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-07 21:10 [PATCH 0/6] Type unit + split DWARF fixes (PR 33307) Simon Marchi
2025-11-07 21:10 ` [PATCH 1/6] gdb/testsuite/dwarf: use single abbrev table in .dwo files Simon Marchi
2025-11-10 20:14 ` Simon Marchi
2025-11-18 13:32 ` Andrew Burgess
2025-11-18 16:50 ` Simon Marchi
2025-11-18 16:55 ` Andrew Burgess
2025-11-18 17:20 ` Simon Marchi
2025-11-19 16:05 ` Tom Tromey
2025-11-19 20:21 ` Simon Marchi
2025-11-07 21:10 ` [PATCH 2/6] gdb/testsuite/dwarf: convert _section proc to use parse_options Simon Marchi
2025-11-19 10:59 ` Andrew Burgess
2025-11-19 15:53 ` Tom Tromey
2025-11-19 20:40 ` Simon Marchi [this message]
2025-11-19 21:03 ` Tom Tromey
2025-11-07 21:10 ` [PATCH 3/6] gdb/testsuite/dwarf: emit type unit sections as COMDAT Simon Marchi
2025-11-19 11:43 ` Andrew Burgess
2025-11-07 21:10 ` [PATCH 4/6] gdb/dwarf: when in dwarf2_cu, read addr_size from dwarf2_cu::header Simon Marchi
2025-11-19 14:30 ` Andrew Burgess
2025-11-19 20:46 ` Simon Marchi
2025-11-19 16:11 ` Tom Tromey
2025-11-19 20:51 ` Simon Marchi
2025-11-07 21:10 ` [PATCH 5/6] gdb/dwarf: store addr/offset/ref_addr sizes in dwarf2_per_cu Simon Marchi
2025-11-19 14:42 ` Andrew Burgess
2025-11-19 16:14 ` Tom Tromey
2025-11-21 19:54 ` Simon Marchi
2025-11-21 21:25 ` Tom Tromey
2025-11-07 21:10 ` [PATCH 6/6] gdb/dwarf: use dwarf2_per_cu::ref_addr_size in one spot Simon Marchi
2025-11-19 14:44 ` Andrew Burgess
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=42a67fe2-718e-44e3-8a13-066205b2c3f4@polymtl.ca \
--to=simon.marchi@polymtl.ca \
--cc=gdb-patches@sourceware.org \
--cc=simon.marchi@efficios.com \
--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