diff options
author | Cary Coutant <ccoutant@google.com> | 2012-02-29 21:22:29 +0000 |
---|---|---|
committer | Cary Coutant <ccoutant@google.com> | 2012-02-29 21:22:29 +0000 |
commit | 5dd8762ad1a47548394c76ead1b56fc5dab64628 (patch) | |
tree | 54eeb14cc262fb233284909e649157185c6a92d2 /gold/dwarf_reader.cc | |
parent | 718cb7da5d4c438d89fc9aeac7f535d01d64af42 (diff) | |
download | gdb-5dd8762ad1a47548394c76ead1b56fc5dab64628.zip gdb-5dd8762ad1a47548394c76ead1b56fc5dab64628.tar.gz gdb-5dd8762ad1a47548394c76ead1b56fc5dab64628.tar.bz2 |
* dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
Call Object::decompressed_section_contents.
* dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
New dtor.
(Sized_dwarf_line_info::buffer_start_): New data member.
* merge.cc (Output_merge_data::do_add_input_section): Call
Object::decompressed_section_contents.
(Output_merge_string::do_add_input_section): Likewise.
* object.cc (need_decompressed_section): New function.
(build_compressed_section_map): Decompress sections needed later.
(Sized_relobj_file::do_decompressed_section_contents): New function.
(Sized_relobj_file::do_discard_decompressed_sections): New function.
* object.h (Object::decompressed_section_contents): New function.
(Object::discard_decompressed_sections): New function.
(Object::do_decompressed_section_contents): New function.
(Object::do_discard_decompressed_sections): New function.
(Compressed_section_info): New type.
(Compressed_section_map): Include decompressed section contents.
(Sized_relobj_file::do_decompressed_section_contents): New function.
(Sized_relobj_file::do_discard_decompressed_sections): New function.
Diffstat (limited to 'gold/dwarf_reader.cc')
-rw-r--r-- | gold/dwarf_reader.cc | 33 |
1 files changed, 12 insertions, 21 deletions
diff --git a/gold/dwarf_reader.cc b/gold/dwarf_reader.cc index 2b47a28..73f84b0 100644 --- a/gold/dwarf_reader.cc +++ b/gold/dwarf_reader.cc @@ -62,12 +62,14 @@ ResetLineStateMachine(struct LineStateMachine* lsm, bool default_is_stmt) } template<int size, bool big_endian> -Sized_dwarf_line_info<size, big_endian>::Sized_dwarf_line_info(Object* object, - unsigned int read_shndx) - : data_valid_(false), buffer_(NULL), symtab_buffer_(NULL), - directories_(), files_(), current_header_index_(-1) +Sized_dwarf_line_info<size, big_endian>::Sized_dwarf_line_info( + Object* object, + unsigned int read_shndx) + : data_valid_(false), buffer_(NULL), buffer_start_(NULL), + symtab_buffer_(NULL), directories_(), files_(), current_header_index_(-1) { unsigned int debug_shndx; + for (debug_shndx = 1; debug_shndx < object->shnum(); ++debug_shndx) { // FIXME: do this more efficiently: section_name() isn't super-fast @@ -75,8 +77,12 @@ Sized_dwarf_line_info<size, big_endian>::Sized_dwarf_line_info(Object* object, if (name == ".debug_line" || name == ".zdebug_line") { section_size_type buffer_size; - this->buffer_ = object->section_contents(debug_shndx, &buffer_size, - false); + bool is_new = false; + this->buffer_ = object->decompressed_section_contents(debug_shndx, + &buffer_size, + &is_new); + if (is_new) + this->buffer_start_ = this->buffer_; this->buffer_end_ = this->buffer_ + buffer_size; break; } @@ -84,21 +90,6 @@ 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; |