[binutils-gdb] PR21957, addr2line incorrectly handles non-increasing sequences in line table

Alan Modra amodra@sourceware.org
Sun Oct 1 10:26:00 GMT 2017


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=20230942fe3674150ab661738d72f1618b3d4b1b

commit 20230942fe3674150ab661738d72f1618b3d4b1b
Author: Alan Modra <amodra@gmail.com>
Date:   Sun Oct 1 17:39:00 2017 +1030

    PR21957, addr2line incorrectly handles non-increasing sequences in line table
    
    	PR 21957
    	* dwarf2.c (new_line_sorts_after): Remove end_sequence comparison.
    	(add_line_info): Always put end_sequence last.

Diff:
---
 bfd/ChangeLog | 6 ++++++
 bfd/dwarf2.c  | 7 +++----
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 9a6af67..b51311e 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,5 +1,11 @@
 2017-10-01  Alan Modra  <amodra@gmail.com>
 
+	PR 21957
+	* dwarf2.c (new_line_sorts_after): Remove end_sequence comparison.
+	(add_line_info): Always put end_sequence last.
+
+2017-10-01  Alan Modra  <amodra@gmail.com>
+
 	PR 22047
 	* dwarf2.c (read_section): Allocate buffer with extra byte for
 	bfd_simple_get_relocated_section_contents rather than copying
diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c
index 4cf50cc..248e621 100644
--- a/bfd/dwarf2.c
+++ b/bfd/dwarf2.c
@@ -1420,9 +1420,7 @@ new_line_sorts_after (struct line_info *new_line, struct line_info *line)
 {
   return (new_line->address > line->address
 	  || (new_line->address == line->address
-	      && (new_line->op_index > line->op_index
-		  || (new_line->op_index == line->op_index
-		      && new_line->end_sequence < line->end_sequence))));
+	      && new_line->op_index > line->op_index));
 }
 
 
@@ -1508,7 +1506,8 @@ add_line_info (struct line_info_table *table,
       table->sequences = seq;
       table->num_sequences++;
     }
-  else if (new_line_sorts_after (info, seq->last_line))
+  else if (info->end_sequence
+	   || new_line_sorts_after (info, seq->last_line))
     {
       /* Normal case: add 'info' to the beginning of the current sequence.  */
       info->prev_line = seq->last_line;



More information about the Binutils-cvs mailing list