* merge.h (Output_merge_string::Merged_string): Remove object, shndx,
[binutils-gdb.git] / gold / dwarf_reader.cc
index c8d29cddf65c2af3039b4c610af31a514e3d79bb..c0188fbd435b5bac060a2017f581abba00bc2274 100644 (file)
@@ -32,6 +32,7 @@
 #include "reloc.h"
 #include "dwarf_reader.h"
 #include "int_encoding.h"
+#include "compressed_output.h"
 
 namespace gold {
 
@@ -80,6 +81,21 @@ Sized_dwarf_line_info<size, big_endian>::Sized_dwarf_line_info(Object* object,
   if (this->buffer_ == NULL)
     return;
 
+  section_size_type uncompressed_size = 0;
+  unsigned char* uncompressed_data = NULL;
+  if (object->section_is_compressed(debug_shndx, &uncompressed_size))
+    {
+      uncompressed_data = new unsigned char[uncompressed_size];
+      if (!decompress_input_section(this->buffer_,
+                                   this->buffer_end_ - this->buffer_,
+                                   uncompressed_data,
+                                   uncompressed_size))
+       object->error(_("could not decompress section %s"),
+                     object->section_name(debug_shndx).c_str());
+      this->buffer_ = uncompressed_data;
+      this->buffer_end_ = this->buffer_ + uncompressed_size;
+    }
+
   // Find the relocation section for ".debug_line".
   // We expect these for relobjs (.o's) but not dynobjs (.so's).
   bool got_relocs = false;
@@ -294,7 +310,7 @@ Sized_dwarf_line_info<size, big_endian>::process_one_opcode(
     case elfcpp::DW_LNS_advance_pc:
       {
         const uint64_t advance_address
-         = read_unsigned_LEB_128(start, &templen);
+            = read_unsigned_LEB_128(start, &templen);
         oplen += templen;
         lsm->address += header_.min_insn_length * advance_address;
       }
@@ -353,7 +369,7 @@ Sized_dwarf_line_info<size, big_endian>::process_one_opcode(
     case elfcpp::DW_LNS_extended_op:
       {
         const uint64_t extended_op_len
-         = read_unsigned_LEB_128(start, &templen);
+            = read_unsigned_LEB_128(start, &templen);
         start += templen;
         oplen += templen + extended_op_len;
 
@@ -375,7 +391,7 @@ Sized_dwarf_line_info<size, big_endian>::process_one_opcode(
             {
               lsm->address = elfcpp::Swap_unaligned<size, big_endian>::readval(start);
               typename Reloc_map::const_iterator it
-               = reloc_map_.find(start - this->buffer_);
+                  = reloc_map_.find(start - this->buffer_);
               if (it != reloc_map_.end())
                 {
                   // value + addend.
@@ -420,16 +436,17 @@ Sized_dwarf_line_info<size, big_endian>::process_one_opcode(
 
     default:
       {
-        // Ignore unknown opcode  silently.
+        // Ignore unknown opcode  silently
         for (int i = 0; i < header_.std_opcode_lengths[opcode]; i++)
           {
+            size_t templen;
             read_unsigned_LEB_128(start, &templen);
             start += templen;
             oplen += templen;
           }
       }
       break;
-    }
+  }
   *len = oplen;
   return false;
 }