[PATCH] gdb: Recognize -1 as a tombstone value in .debug_line

Fangrui Song maskray@google.com
Tue Jun 30 23:18:42 GMT 2020


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



More information about the Gdb-patches mailing list