This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

revised duplicate-line-number elimination patch



I talked to Michael Snyder, and he said that duplicate line numbers in
assembler functions could cause GDB trouble.  So, I came up with this
patch to replace the previous one.

Tested against the gas & gdb testsuites on a cross to powerpc-eabisim,
and also by checking that this little source file:


        .text
        nop ; nop ; nop
        nop
        nop ; nop
        nop

produces no duplicate line number information:

 Line Number Statements:
  Extended opcode 2: set Address to 0x0
  Special opcode 7: advance Address by 0 to 0x0 and Line by 2 to 3
  Special opcode 48: advance Address by 12 to 0xc and Line by 1 to 4
  Special opcode 20: advance Address by 4 to 0x10 and Line by 1 to 5
  Special opcode 34: advance Address by 8 to 0x18 and Line by 1 to 6
  Advance PC by 4 to 1c
  Extended opcode 1: End of Sequence

How's that?  OK to commit?

-- 
Geoff Keating <geoffk@redhat.com>

===File ~/patches/gas-duplineno-2.patch=====================
Index: ChangeLog
===================================================================
RCS file: /cvs/src/src/gas/ChangeLog,v
retrieving revision 1.1283
diff -p -u -p -r1.1283 ChangeLog
--- ChangeLog	4 Apr 2002 14:06:48 -0000	1.1283
+++ ChangeLog	12 Apr 2002 21:41:43 -0000
@@ -1,3 +1,8 @@
+2002-04-12  Geoffrey Keating  <geoffk@redhat.com>
+
+	* dwarf2dbg.c (dwarf2_gen_line_info): Do emit duplicate line
+	numbers, gdb relies on them to detect the start of the prologue.
+
 2002-04-04  Alan Modra  <amodra@bigpond.net.au>
 
 	* dep-in.sed: Cope with absolute paths.
Index: dwarf2dbg.c
===================================================================
RCS file: /cvs/src/src/gas/dwarf2dbg.c,v
retrieving revision 1.44
diff -p -u -p -r1.44 dwarf2dbg.c
--- dwarf2dbg.c	4 Dec 2001 23:07:26 -0000	1.44
+++ dwarf2dbg.c	12 Apr 2002 21:41:43 -0000
@@ -237,8 +237,12 @@ dwarf2_gen_line_info (ofs, loc)
   if (loc->filenum == 0 || loc->line == 0)
     return;
 
-  /* Don't emit sequences of line symbols for the same line. */
-  if (line == loc->line && filenum == loc->filenum)
+  /* Don't emit sequences of line symbols for the same line when the
+     symbols apply to assembler code.  It is necessary to emit
+     duplicate line symbols when a compiler asks for them, because GDB
+     uses them to determine the end of the prologue.  */
+  if (debug_type == DEBUG_DWARF2 
+      && line == loc->line && filenum == loc->filenum)
     return;
 
   line = loc->line;
============================================================


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]