public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Fangrui Song <maskray@google.com>
To: gdb-patches@sourceware.org
Cc: Fangrui Song <maskray@google.com>
Subject: [PATCH] gdb: Recognize -1 as a tombstone value in .debug_line
Date: Tue, 30 Jun 2020 16:18:42 -0700	[thread overview]
Message-ID: <20200630231842.508205-1-maskray@google.com> (raw)

LLD from 11 onwards (https://reviews.llvm.org/D81784) uses -1 to
represent a relocation in .debug_line referencing a discarded symbol.
Recognize -1 to fix gdb.base/break-on-linker-gcd-function.exp when the
linker is a newer LLD.

gdb/ChangeLog:

	* dwarf2/read.c (lnp_state_machine::check_line_address): Test -1.
---
 gdb/dwarf2/read.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index b097f624b6..7cf2691ae9 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -20380,9 +20380,13 @@ lnp_state_machine::check_line_address (struct dwarf2_cu *cu,
   /* If ADDRESS < UNRELOCATED_LOWPC then it's not a usable value, it's outside
      the pc range of the CU.  However, we restrict the test to only ADDRESS
      values of zero to preserve GDB's previous behaviour which is to handle
-     the specific case of a function being GC'd by the linker.  */
+     the specific case of a function being GC'd by the linker.
 
-  if (address == 0 && address < unrelocated_lowpc)
+     LLD from 11 onwards (https://reviews.llvm.org/D81784) uses -1 to represent
+     the tombstone value.
+     */
+
+  if ((address == 0 && address < unrelocated_lowpc) || address == (CORE_ADDR)-1)
     {
       /* This line table is for a function which has been
 	 GCd by the linker.  Ignore it.  PR gdb/12528 */
-- 
2.27.0.212.ge8ba1cc988-goog


             reply	other threads:[~2020-06-30 23:24 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-30 23:18 Fangrui Song [this message]
2020-07-01  8:26 ` Andrew Burgess
2020-07-01 17:39   ` [PATCH v2] " Fangrui Song
2020-07-01 19:17     ` 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=20200630231842.508205-1-maskray@google.com \
    --to=maskray@google.com \
    --cc=gdb-patches@sourceware.org \
    /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).