From: Tom Tromey <tom@tromey.com>
To: simon.marchi@polymtl.ca
Cc: gdb-patches@sourceware.org, Simon Marchi <simon.marchi@efficios.com>
Subject: Re: [PATCH v2 1/2] gdb/testsuite: add .debug_frame support in DWARF assembler
Date: Mon, 06 Apr 2026 11:45:14 -0600 [thread overview]
Message-ID: <87tstox9sl.fsf@tromey.com> (raw)
In-Reply-To: <20260318202801.2030268-1-simon.marchi@polymtl.ca> (simon marchi's message of "Wed, 18 Mar 2026 16:27:22 -0400")
>>>>> "Simon" == simon marchi <simon.marchi@polymtl.ca> writes:
Simon> Add support to the DWARF assembler for generating .debug_frame sections.
Simon> My initial use case is to reproduce a crash happening when encountering
Simon> an empty FDE, but I suppose that other use cases will pop up in the
Simon> future.
Thanks for doing this. I have one little note.
Simon> + # Create procs for DW_CFA_* instructions, used in
Simon> + # .debug_frame CIE/FDE bodies.
Simon> +
Simon> + # DW_CFA_advance_loc, DW_CFA_offset and
Simon> + # DW_CFA_restore encode the operand in the low 6
Simon> + # bits of the opcode byte. They need special
Simon> + # handling.
Simon> + switch -exact -- $name {
Simon> + DW_CFA_advance_loc {
Simon> + proc DW_CFA_advance_loc {delta} {
Simon> + _op .byte \
Simon> + "$Dwarf::_constants(DW_CFA_advance_loc) + $delta" \
Simon> + DW_CFA_advance_loc
Simon> + }
Simon> + }
Simon> +
Simon> + DW_CFA_offset {
Simon> + proc DW_CFA_offset {register offset} {
Simon> + _op .byte \
Simon> + "$Dwarf::_constants(DW_CFA_offset) + $register" \
Simon> + DW_CFA_offset
Simon> + _op .uleb128 $offset "offset"
Simon> + }
Simon> + }
Simon> +
Simon> + DW_CFA_restore {
Simon> + proc DW_CFA_restore {register} {
Simon> + _op .byte \
Simon> + "$Dwarf::_constants(DW_CFA_restore) + $register" \
Simon> + DW_CFA_restore
Simon> + }
Simon> + }
These procs could just be defined at the namespace level and then these
constants just skipped here, like
DW_CFA_advance_loc -
DW_CFA_offset -
DW_CFA_restore {
# These need special handling and are predefined below.
}
I think this would be a bit clearer.
Approved-By: Tom Tromey <tom@tromey.com>
thanks,
Tom
next prev parent reply other threads:[~2026-04-06 17:45 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-16 17:22 [PATCH " Simon Marchi
2026-03-16 17:22 ` [PATCH 2/2] gdb/dwarf: fix internal error when FDEs do not describe the CFA Simon Marchi
2026-03-17 19:33 ` Simon Marchi
2026-03-18 20:27 ` [PATCH v2 1/2] gdb/testsuite: add .debug_frame support in DWARF assembler simon.marchi
2026-03-18 20:27 ` [PATCH v2 2/2] gdb/dwarf: fix internal error when FDEs do not describe the CFA simon.marchi
2026-04-06 18:10 ` Tom Tromey
2026-04-11 2:47 ` Simon Marchi
2026-04-04 1:25 ` [PATCH v2 1/2] gdb/testsuite: add .debug_frame support in DWARF assembler Simon Marchi
2026-04-06 17:45 ` Tom Tromey [this message]
2026-04-11 2:46 ` Simon Marchi
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=87tstox9sl.fsf@tromey.com \
--to=tom@tromey.com \
--cc=gdb-patches@sourceware.org \
--cc=simon.marchi@efficios.com \
--cc=simon.marchi@polymtl.ca \
/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