From: Joel Brobecker <brobecker@adacore.com>
To: Dmitry Neverov <dmitry.neverov@jetbrains.com>, tom@tromey.com
Cc: gdb-patches@sourceware.org, Joel Brobecker <brobecker@adacore.com>
Subject: Re: [PR 31727] Recognize -2 as a tombstone value in .debug_line
Date: Sun, 1 Sep 2024 11:50:10 -0700 [thread overview]
Message-ID: <ZtS3YpM8pHuYHeMZ@adacore.com> (raw)
In-Reply-To: <20240608084529.1406412-1-dmitry.neverov@jetbrains.com>
Hi everyone,
I think this patch would be safe to apply to the gdb-15-branch,
wouldn't it?
I don't think the patch itself is critical per se, but having it
in the GDB 15.2 release could be helpful to avoid what looked like
a GDB 15.1 regression which turned out to be caused by a faulty
stub. This is documented in...
https://sourceware.org/bugzilla/show_bug.cgi?id=31801
... and that PR has been on our list of PRs to fix for GDB 15
due to the apparent regression aspect. However, the current
conclusion for 31801 is that there is no fix to do in GDB.
The reason why this seemingly unrelated patch below would be helpful
in the context above is that, apparently, the patch below indirectly
hides the issue by making GDB's code going through a different
code path. Two birds in one stone.
OK for Dmitry to backport this patch to gdb-15-branch?
Thank you,
On Sat, Jun 08, 2024 at 10:45:29AM +0200, Dmitry Neverov wrote:
> Commit a8caed5d7faa639a1e6769eba551d15d8ddd9510 handled the tombstone
> value -1 used by lld (https://reviews.llvm.org/D81784). The
> referenced lld commit also uses the tombstone value -2 for
> pre-DWARF-v5
> (https://github.com/llvm/llvm-project/commit/e618ccbf431f6730edb6d1467a127c3a52fd57f7).
>
> If not handled, -2 breaks the pc step range calculation and triggers
> the assertion:
>
> gdb/infrun.c:2794: internal-error: resume_1: Assertion
> `pc_in_thread_step_range (pc, tp)' failed.
>
> This commit adds -2 tombstone value and handles it in the same way as -1.
>
> Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31727
> ---
> gdb/dwarf2/read.c | 13 ++++++++-----
> 1 file changed, 8 insertions(+), 5 deletions(-)
>
> diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
> index 6a19064409c..d720f58c8b4 100644
> --- a/gdb/dwarf2/read.c
> +++ b/gdb/dwarf2/read.c
> @@ -17897,8 +17897,8 @@ class lnp_state_machine
> we're processing the end of a sequence. */
> void record_line (bool end_sequence);
>
> - /* Check ADDRESS is -1, or zero and less than UNRELOCATED_LOWPC, and if true
> - nop-out rest of the lines in this sequence. */
> + /* Check ADDRESS is -1, -2, or zero and less than UNRELOCATED_LOWPC, and if
> + true nop-out rest of the lines in this sequence. */
> void check_line_address (struct dwarf2_cu *cu,
> const gdb_byte *line_ptr,
> unrelocated_addr unrelocated_lowpc,
> @@ -18308,13 +18308,16 @@ lnp_state_machine::check_line_address (struct dwarf2_cu *cu,
> unrelocated_addr unrelocated_lowpc,
> unrelocated_addr address)
> {
> - /* Linkers resolve a symbolic relocation referencing a GC'd function to 0 or
> - -1. If ADDRESS is 0, ignoring the opcode will err if the text section is
> + /* Linkers resolve a symbolic relocation referencing a GC'd function to 0,
> + -1 or -2 (-2 is used by certain lld versions, see
> + https://github.com/llvm/llvm-project/commit/e618ccbf431f6730edb6d1467a127c3a52fd57f7).
> + If ADDRESS is 0, ignoring the opcode will err if the text section is
> located at 0x0. In this case, additionally check that if
> ADDRESS < UNRELOCATED_LOWPC. */
>
> if ((address == (unrelocated_addr) 0 && address < unrelocated_lowpc)
> - || address == (unrelocated_addr) -1)
> + || address == (unrelocated_addr) -1
> + || address == (unrelocated_addr) -2)
> {
> /* This line table is for a function which has been
> GCd by the linker. Ignore it. PR gdb/12528 */
> --
> 2.45.1
>
--
Joel
next prev parent reply other threads:[~2024-09-01 18:50 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-08 8:45 Dmitry Neverov
2024-06-08 8:53 ` Dmitry.Neverov
2024-06-10 20:29 ` Tom Tromey
[not found] ` <87cyohxdim.fsf@lubuntu2.mail-host-address-is-not-set>
2024-08-18 6:00 ` [PING][PR " Dmitry.Neverov
2024-08-23 16:16 ` Tom Tromey
2024-09-01 18:50 ` Joel Brobecker [this message]
2024-09-02 17:55 ` [PR " Dmitry.Neverov
2024-09-02 18:14 ` Joel Brobecker
2024-09-04 17:58 ` Tom Tromey
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=ZtS3YpM8pHuYHeMZ@adacore.com \
--to=brobecker@adacore.com \
--cc=dmitry.neverov@jetbrains.com \
--cc=gdb-patches@sourceware.org \
--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