aboutsummaryrefslogtreecommitdiff
path: root/src/common/dwarf/dwarf2reader.cc
diff options
context:
space:
mode:
authorjimblandy <jimblandy@4c0a9323-5329-0410-9bdc-e9ce6186880e>2010-01-28 22:56:28 +0000
committerjimblandy <jimblandy@4c0a9323-5329-0410-9bdc-e9ce6186880e>2010-01-28 22:56:28 +0000
commit1ac84da26d72cc3fb85af124d91b17cdecb17499 (patch)
tree654b9e60633aa320d0498cbd703693aaf26579af /src/common/dwarf/dwarf2reader.cc
parentBreakpad processor: Fix function and public symbol lookup. (diff)
downloadbreakpad-1ac84da26d72cc3fb85af124d91b17cdecb17499.tar.xz
Breakpad DWARF parser: Add method to read DWARF "Initial length".
This patch moves the ReadInitialFunction from dwarf2reader.cc, where it was a static function, to being a member function of google_breakpad::ByteReader. a=jimblandy, r=nealsid git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@504 4c0a9323-5329-0410-9bdc-e9ce6186880e
Diffstat (limited to 'src/common/dwarf/dwarf2reader.cc')
-rw-r--r--src/common/dwarf/dwarf2reader.cc29
1 files changed, 4 insertions, 25 deletions
diff --git a/src/common/dwarf/dwarf2reader.cc b/src/common/dwarf/dwarf2reader.cc
index 6e3561ad..54224390 100644
--- a/src/common/dwarf/dwarf2reader.cc
+++ b/src/common/dwarf/dwarf2reader.cc
@@ -40,27 +40,6 @@
namespace dwarf2reader {
-// Read a DWARF2/3 initial length field from START, using READER, and
-// report the length in LEN. Return the actual initial length.
-
-static uint64 ReadInitialLength(const char* start,
- ByteReader* reader, size_t* len) {
- const uint64 initial_length = reader->ReadFourBytes(start);
- start += 4;
-
- // In DWARF2/3, if the initial length is all 1 bits, then the offset
- // size is 8 and we need to read the next 8 bytes for the real length.
- if (initial_length == 0xffffffff) {
- reader->SetOffsetSize(8);
- *len = 12;
- return reader->ReadOffset(start);
- } else {
- reader->SetOffsetSize(4);
- *len = 4;
- }
- return initial_length;
-}
-
CompilationUnit::CompilationUnit(const SectionMap& sections, uint64 offset,
ByteReader* reader, Dwarf2Handler* handler)
: offset_from_section_start_(offset), reader_(reader),
@@ -243,8 +222,8 @@ void CompilationUnit::ReadHeader() {
size_t initial_length_size;
assert(headerptr + 4 < buffer_ + buffer_length_);
- const uint64 initial_length = ReadInitialLength(headerptr, reader_,
- &initial_length_size);
+ const uint64 initial_length
+ = reader_->ReadInitialLength(headerptr, &initial_length_size);
headerptr += initial_length_size;
header_.length = initial_length;
@@ -563,8 +542,8 @@ void LineInfo::ReadHeader() {
const char* lineptr = buffer_;
size_t initial_length_size;
- const uint64 initial_length = ReadInitialLength(lineptr, reader_,
- &initial_length_size);
+ const uint64 initial_length
+ = reader_->ReadInitialLength(lineptr, &initial_length_size);
lineptr += initial_length_size;
header_.total_length = initial_length;