public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [gold patch obvious] Fix dwarf reader to recognize compressed debug sections by name
@ 2010-11-17  1:51 Cary Coutant
  0 siblings, 0 replies; only message in thread
From: Cary Coutant @ 2010-11-17  1:51 UTC (permalink / raw)
  To: Binutils, Ian Lance Taylor

Another problem found in PR 12220 is that gold does not do ODR
detection or print source line information when the debug information
is compressed. This was caused by a simple failure to recognize the
".zdebug_line" section name. I'm committing this patch as obvious.

-cary


        * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
        Check for ".zdebug_line".


Index: dwarf_reader.cc
===================================================================
RCS file: /cvs/src/src/gold/dwarf_reader.cc,v
retrieving revision 1.27
diff -u -p -r1.27 dwarf_reader.cc
--- dwarf_reader.cc	12 Jul 2010 17:59:58 -0000	1.27
+++ dwarf_reader.cc	17 Nov 2010 01:41:30 -0000
@@ -68,16 +68,19 @@ Sized_dwarf_line_info<size, big_endian>:
     directories_(), files_(), current_header_index_(-1)
 {
   unsigned int debug_shndx;
-  for (debug_shndx = 0; debug_shndx < object->shnum(); ++debug_shndx)
-    // FIXME: do this more efficiently: section_name() isn't super-fast
-    if (object->section_name(debug_shndx) == ".debug_line")
-      {
-        section_size_type buffer_size;
-        this->buffer_ = object->section_contents(debug_shndx, &buffer_size,
-						 false);
-        this->buffer_end_ = this->buffer_ + buffer_size;
-        break;
-      }
+  for (debug_shndx = 1; debug_shndx < object->shnum(); ++debug_shndx)
+    {
+      // FIXME: do this more efficiently: section_name() isn't super-fast
+      std::string name = object->section_name(debug_shndx);
+      if (name == ".debug_line" || name == ".zdebug_line")
+	{
+	  section_size_type buffer_size;
+	  this->buffer_ = object->section_contents(debug_shndx, &buffer_size,
+						   false);
+	  this->buffer_end_ = this->buffer_ + buffer_size;
+	  break;
+	}
+    }
   if (this->buffer_ == NULL)
     return;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2010-11-17  1:51 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-17  1:51 [gold patch obvious] Fix dwarf reader to recognize compressed debug sections by name Cary Coutant

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).