* dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
authorIan Lance Taylor <ian@airs.com>
Mon, 20 Dec 2010 18:37:36 +0000 (18:37 +0000)
committerIan Lance Taylor <ian@airs.com>
Mon, 20 Dec 2010 18:37:36 +0000 (18:37 +0000)
second of two consecutive entries with same offset.

gold/ChangeLog
gold/dwarf_reader.cc
gold/dwarf_reader.h

index 4fbd9f70e1744dcb317ef26797e8a4a595d8b8ec..64958ab925ef8b73aee22e3a5082709540b7b5c0 100644 (file)
@@ -1,3 +1,8 @@
+2010-12-20  Ian Lance Taylor  <iant@google.com>
+
+       * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
+       second of two consecutive entries with same offset.
+
 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
 
        * testsuite/Makefile.am (ifuncmain2static_LDADD)
index 7fbfdaedc1884cb4f6c09cb63a1c30c4cf9bd62b..8110f38143522181152917c7268a228220d2cf14 100644 (file)
@@ -493,7 +493,18 @@ Sized_dwarf_line_info<size, big_endian>::read_lines(unsigned const char* lineptr
               Offset_to_lineno_entry entry
                   = { lsm.address, this->current_header_index_,
                       lsm.file_num, lsm.line_num };
-              line_number_map_[lsm.shndx].push_back(entry);
+             std::vector<Offset_to_lineno_entry>&
+               map(this->line_number_map_[lsm.shndx]);
+             // If we see two consecutive entries with the same
+             // offset and a real line number, then always use the
+             // second one.
+             if (!map.empty()
+                 && (map.back().offset == static_cast<off_t>(lsm.address))
+                 && lsm.line_num != -1
+                 && map.back().line_num != -1)
+               map.back() = entry;
+             else
+               map.push_back(entry);
             }
           lineptr += oplength;
         }
index c1978332ee829bacd30d9de4ff521b7aa10c7a76..8fe7898a55ab7e8e435276ecb397c358489de579 100644 (file)
@@ -46,7 +46,10 @@ struct Offset_to_lineno_entry
   int header_num;  // which file-list to use (i.e. which .o file are we in)
   int file_num;    // a pointer into files_
   int line_num;    // the line number in the source file
-  // Offsets are unique within a section, so that's a sufficient sort key.
+
+  // When we add entries to the table, we always use the last entry
+  // with a given offset.  Given proper DWARF info, this should ensure
+  // that the offset is a sufficient sort key.
   bool operator<(const Offset_to_lineno_entry& that) const
   { return this->offset < that.offset; }
 };
This page took 0.032805 seconds and 4 git commands to generate.