Move the dwarf2reader objects into google_breakpad namespace to make it consistent with cfi_assembler.cc

Bug: b/189249305
Change-Id: I3433ff5c41d2f66ab292fbecb969f2cd08d24b29
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/2920506
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
This commit is contained in:
Tyrel Russell 2021-05-26 08:35:33 -04:00 committed by Joshua Peraza
parent f7428bc397
commit 0622f68827
30 changed files with 947 additions and 958 deletions

View file

@ -34,7 +34,7 @@
#include <assert.h> #include <assert.h>
#include <stdint.h> #include <stdint.h>
namespace dwarf2reader { namespace google_breakpad {
inline uint8_t ByteReader::ReadOneByte(const uint8_t* buffer) const { inline uint8_t ByteReader::ReadOneByte(const uint8_t* buffer) const {
return buffer[0]; return buffer[0];
@ -176,6 +176,6 @@ inline void ByteReader::ClearFunctionBase() {
have_function_base_ = false; have_function_base_ = false;
} }
} // namespace dwarf2reader } // namespace google_breakpad
#endif // UTIL_DEBUGINFO_BYTEREADER_INL_H__ #endif // UTIL_DEBUGINFO_BYTEREADER_INL_H__

View file

@ -33,7 +33,7 @@
#include "common/dwarf/bytereader-inl.h" #include "common/dwarf/bytereader-inl.h"
#include "common/dwarf/bytereader.h" #include "common/dwarf/bytereader.h"
namespace dwarf2reader { namespace google_breakpad {
ByteReader::ByteReader(enum Endianness endian) ByteReader::ByteReader(enum Endianness endian)
:offset_reader_(NULL), address_reader_(NULL), endian_(endian), :offset_reader_(NULL), address_reader_(NULL), endian_(endian),
@ -247,4 +247,4 @@ Endianness ByteReader::GetEndianness() const {
return endian_; return endian_;
} }
} // namespace dwarf2reader } // namespace google_breakpad

View file

@ -38,7 +38,7 @@
#include "common/dwarf/types.h" #include "common/dwarf/types.h"
#include "common/dwarf/dwarf2enums.h" #include "common/dwarf/dwarf2enums.h"
namespace dwarf2reader { namespace google_breakpad {
// We can't use the obvious name of LITTLE_ENDIAN and BIG_ENDIAN // We can't use the obvious name of LITTLE_ENDIAN and BIG_ENDIAN
// because it conflicts with a macro // because it conflicts with a macro
@ -315,6 +315,6 @@ class ByteReader {
const uint8_t* buffer_base_; const uint8_t* buffer_base_;
}; };
} // namespace dwarf2reader } // namespace google_breakpad
#endif // COMMON_DWARF_BYTEREADER_H__ #endif // COMMON_DWARF_BYTEREADER_H__

View file

@ -29,7 +29,7 @@
// Original author: Jim Blandy <jimb@mozilla.com> <jimb@red-bean.com> // Original author: Jim Blandy <jimb@mozilla.com> <jimb@red-bean.com>
// bytereader_unittest.cc: Unit tests for dwarf2reader::ByteReader // bytereader_unittest.cc: Unit tests for google_breakpad::ByteReader
#include <stdint.h> #include <stdint.h>
@ -41,10 +41,10 @@
#include "common/dwarf/cfi_assembler.h" #include "common/dwarf/cfi_assembler.h"
#include "common/using_std_string.h" #include "common/using_std_string.h"
using dwarf2reader::ByteReader; using google_breakpad::ByteReader;
using dwarf2reader::DwarfPointerEncoding; using google_breakpad::DwarfPointerEncoding;
using dwarf2reader::ENDIANNESS_BIG; using google_breakpad::ENDIANNESS_BIG;
using dwarf2reader::ENDIANNESS_LITTLE; using google_breakpad::ENDIANNESS_LITTLE;
using google_breakpad::CFISection; using google_breakpad::CFISection;
using google_breakpad::test_assembler::Label; using google_breakpad::test_assembler::Label;
using google_breakpad::test_assembler::kBigEndian; using google_breakpad::test_assembler::kBigEndian;
@ -91,279 +91,279 @@ TEST_F(Reader, SimpleConstructor) {
TEST_F(Reader, ValidEncodings) { TEST_F(Reader, ValidEncodings) {
ByteReader reader(ENDIANNESS_LITTLE); ByteReader reader(ENDIANNESS_LITTLE);
EXPECT_TRUE(reader.ValidEncoding( EXPECT_TRUE(reader.ValidEncoding(
DwarfPointerEncoding(dwarf2reader::DW_EH_PE_absptr))); DwarfPointerEncoding(google_breakpad::DW_EH_PE_absptr)));
EXPECT_TRUE(reader.ValidEncoding( EXPECT_TRUE(reader.ValidEncoding(
DwarfPointerEncoding(dwarf2reader::DW_EH_PE_omit))); DwarfPointerEncoding(google_breakpad::DW_EH_PE_omit)));
EXPECT_TRUE(reader.ValidEncoding( EXPECT_TRUE(reader.ValidEncoding(
DwarfPointerEncoding(dwarf2reader::DW_EH_PE_aligned))); DwarfPointerEncoding(google_breakpad::DW_EH_PE_aligned)));
EXPECT_TRUE(reader.ValidEncoding( EXPECT_TRUE(reader.ValidEncoding(
DwarfPointerEncoding(dwarf2reader::DW_EH_PE_uleb128))); DwarfPointerEncoding(google_breakpad::DW_EH_PE_uleb128)));
EXPECT_TRUE(reader.ValidEncoding( EXPECT_TRUE(reader.ValidEncoding(
DwarfPointerEncoding(dwarf2reader::DW_EH_PE_udata2))); DwarfPointerEncoding(google_breakpad::DW_EH_PE_udata2)));
EXPECT_TRUE(reader.ValidEncoding( EXPECT_TRUE(reader.ValidEncoding(
DwarfPointerEncoding(dwarf2reader::DW_EH_PE_udata4))); DwarfPointerEncoding(google_breakpad::DW_EH_PE_udata4)));
EXPECT_TRUE(reader.ValidEncoding( EXPECT_TRUE(reader.ValidEncoding(
DwarfPointerEncoding(dwarf2reader::DW_EH_PE_udata8))); DwarfPointerEncoding(google_breakpad::DW_EH_PE_udata8)));
EXPECT_TRUE(reader.ValidEncoding( EXPECT_TRUE(reader.ValidEncoding(
DwarfPointerEncoding(dwarf2reader::DW_EH_PE_sleb128))); DwarfPointerEncoding(google_breakpad::DW_EH_PE_sleb128)));
EXPECT_TRUE(reader.ValidEncoding( EXPECT_TRUE(reader.ValidEncoding(
DwarfPointerEncoding(dwarf2reader::DW_EH_PE_sdata2))); DwarfPointerEncoding(google_breakpad::DW_EH_PE_sdata2)));
EXPECT_TRUE(reader.ValidEncoding( EXPECT_TRUE(reader.ValidEncoding(
DwarfPointerEncoding(dwarf2reader::DW_EH_PE_sdata4))); DwarfPointerEncoding(google_breakpad::DW_EH_PE_sdata4)));
EXPECT_TRUE(reader.ValidEncoding( EXPECT_TRUE(reader.ValidEncoding(
DwarfPointerEncoding(dwarf2reader::DW_EH_PE_sdata8))); DwarfPointerEncoding(google_breakpad::DW_EH_PE_sdata8)));
EXPECT_TRUE(reader.ValidEncoding( EXPECT_TRUE(reader.ValidEncoding(
DwarfPointerEncoding(dwarf2reader::DW_EH_PE_absptr | DwarfPointerEncoding(google_breakpad::DW_EH_PE_absptr |
dwarf2reader::DW_EH_PE_pcrel))); google_breakpad::DW_EH_PE_pcrel)));
EXPECT_TRUE(reader.ValidEncoding( EXPECT_TRUE(reader.ValidEncoding(
DwarfPointerEncoding(dwarf2reader::DW_EH_PE_uleb128 | DwarfPointerEncoding(google_breakpad::DW_EH_PE_uleb128 |
dwarf2reader::DW_EH_PE_pcrel))); google_breakpad::DW_EH_PE_pcrel)));
EXPECT_TRUE(reader.ValidEncoding( EXPECT_TRUE(reader.ValidEncoding(
DwarfPointerEncoding(dwarf2reader::DW_EH_PE_udata2 | DwarfPointerEncoding(google_breakpad::DW_EH_PE_udata2 |
dwarf2reader::DW_EH_PE_pcrel))); google_breakpad::DW_EH_PE_pcrel)));
EXPECT_TRUE(reader.ValidEncoding( EXPECT_TRUE(reader.ValidEncoding(
DwarfPointerEncoding(dwarf2reader::DW_EH_PE_udata4 | DwarfPointerEncoding(google_breakpad::DW_EH_PE_udata4 |
dwarf2reader::DW_EH_PE_pcrel))); google_breakpad::DW_EH_PE_pcrel)));
EXPECT_TRUE(reader.ValidEncoding( EXPECT_TRUE(reader.ValidEncoding(
DwarfPointerEncoding(dwarf2reader::DW_EH_PE_udata8 | DwarfPointerEncoding(google_breakpad::DW_EH_PE_udata8 |
dwarf2reader::DW_EH_PE_pcrel))); google_breakpad::DW_EH_PE_pcrel)));
EXPECT_TRUE(reader.ValidEncoding( EXPECT_TRUE(reader.ValidEncoding(
DwarfPointerEncoding(dwarf2reader::DW_EH_PE_sleb128 | DwarfPointerEncoding(google_breakpad::DW_EH_PE_sleb128 |
dwarf2reader::DW_EH_PE_pcrel))); google_breakpad::DW_EH_PE_pcrel)));
EXPECT_TRUE(reader.ValidEncoding( EXPECT_TRUE(reader.ValidEncoding(
DwarfPointerEncoding(dwarf2reader::DW_EH_PE_sdata2 | DwarfPointerEncoding(google_breakpad::DW_EH_PE_sdata2 |
dwarf2reader::DW_EH_PE_pcrel))); google_breakpad::DW_EH_PE_pcrel)));
EXPECT_TRUE(reader.ValidEncoding( EXPECT_TRUE(reader.ValidEncoding(
DwarfPointerEncoding(dwarf2reader::DW_EH_PE_sdata4 | DwarfPointerEncoding(google_breakpad::DW_EH_PE_sdata4 |
dwarf2reader::DW_EH_PE_pcrel))); google_breakpad::DW_EH_PE_pcrel)));
EXPECT_TRUE(reader.ValidEncoding( EXPECT_TRUE(reader.ValidEncoding(
DwarfPointerEncoding(dwarf2reader::DW_EH_PE_sdata8 | DwarfPointerEncoding(google_breakpad::DW_EH_PE_sdata8 |
dwarf2reader::DW_EH_PE_pcrel))); google_breakpad::DW_EH_PE_pcrel)));
EXPECT_TRUE(reader.ValidEncoding( EXPECT_TRUE(reader.ValidEncoding(
DwarfPointerEncoding(dwarf2reader::DW_EH_PE_absptr | DwarfPointerEncoding(google_breakpad::DW_EH_PE_absptr |
dwarf2reader::DW_EH_PE_textrel))); google_breakpad::DW_EH_PE_textrel)));
EXPECT_TRUE(reader.ValidEncoding( EXPECT_TRUE(reader.ValidEncoding(
DwarfPointerEncoding(dwarf2reader::DW_EH_PE_uleb128 | DwarfPointerEncoding(google_breakpad::DW_EH_PE_uleb128 |
dwarf2reader::DW_EH_PE_textrel))); google_breakpad::DW_EH_PE_textrel)));
EXPECT_TRUE(reader.ValidEncoding( EXPECT_TRUE(reader.ValidEncoding(
DwarfPointerEncoding(dwarf2reader::DW_EH_PE_udata2 | DwarfPointerEncoding(google_breakpad::DW_EH_PE_udata2 |
dwarf2reader::DW_EH_PE_textrel))); google_breakpad::DW_EH_PE_textrel)));
EXPECT_TRUE(reader.ValidEncoding( EXPECT_TRUE(reader.ValidEncoding(
DwarfPointerEncoding(dwarf2reader::DW_EH_PE_udata4 | DwarfPointerEncoding(google_breakpad::DW_EH_PE_udata4 |
dwarf2reader::DW_EH_PE_textrel))); google_breakpad::DW_EH_PE_textrel)));
EXPECT_TRUE(reader.ValidEncoding( EXPECT_TRUE(reader.ValidEncoding(
DwarfPointerEncoding(dwarf2reader::DW_EH_PE_udata8 | DwarfPointerEncoding(google_breakpad::DW_EH_PE_udata8 |
dwarf2reader::DW_EH_PE_textrel))); google_breakpad::DW_EH_PE_textrel)));
EXPECT_TRUE(reader.ValidEncoding( EXPECT_TRUE(reader.ValidEncoding(
DwarfPointerEncoding(dwarf2reader::DW_EH_PE_sleb128 | DwarfPointerEncoding(google_breakpad::DW_EH_PE_sleb128 |
dwarf2reader::DW_EH_PE_textrel))); google_breakpad::DW_EH_PE_textrel)));
EXPECT_TRUE(reader.ValidEncoding( EXPECT_TRUE(reader.ValidEncoding(
DwarfPointerEncoding(dwarf2reader::DW_EH_PE_sdata2 | DwarfPointerEncoding(google_breakpad::DW_EH_PE_sdata2 |
dwarf2reader::DW_EH_PE_textrel))); google_breakpad::DW_EH_PE_textrel)));
EXPECT_TRUE(reader.ValidEncoding( EXPECT_TRUE(reader.ValidEncoding(
DwarfPointerEncoding(dwarf2reader::DW_EH_PE_sdata4 | DwarfPointerEncoding(google_breakpad::DW_EH_PE_sdata4 |
dwarf2reader::DW_EH_PE_textrel))); google_breakpad::DW_EH_PE_textrel)));
EXPECT_TRUE(reader.ValidEncoding( EXPECT_TRUE(reader.ValidEncoding(
DwarfPointerEncoding(dwarf2reader::DW_EH_PE_sdata8 | DwarfPointerEncoding(google_breakpad::DW_EH_PE_sdata8 |
dwarf2reader::DW_EH_PE_textrel))); google_breakpad::DW_EH_PE_textrel)));
EXPECT_TRUE(reader.ValidEncoding( EXPECT_TRUE(reader.ValidEncoding(
DwarfPointerEncoding(dwarf2reader::DW_EH_PE_absptr | DwarfPointerEncoding(google_breakpad::DW_EH_PE_absptr |
dwarf2reader::DW_EH_PE_datarel))); google_breakpad::DW_EH_PE_datarel)));
EXPECT_TRUE(reader.ValidEncoding( EXPECT_TRUE(reader.ValidEncoding(
DwarfPointerEncoding(dwarf2reader::DW_EH_PE_uleb128 | DwarfPointerEncoding(google_breakpad::DW_EH_PE_uleb128 |
dwarf2reader::DW_EH_PE_datarel))); google_breakpad::DW_EH_PE_datarel)));
EXPECT_TRUE(reader.ValidEncoding( EXPECT_TRUE(reader.ValidEncoding(
DwarfPointerEncoding(dwarf2reader::DW_EH_PE_udata2 | DwarfPointerEncoding(google_breakpad::DW_EH_PE_udata2 |
dwarf2reader::DW_EH_PE_datarel))); google_breakpad::DW_EH_PE_datarel)));
EXPECT_TRUE(reader.ValidEncoding( EXPECT_TRUE(reader.ValidEncoding(
DwarfPointerEncoding(dwarf2reader::DW_EH_PE_udata4 | DwarfPointerEncoding(google_breakpad::DW_EH_PE_udata4 |
dwarf2reader::DW_EH_PE_datarel))); google_breakpad::DW_EH_PE_datarel)));
EXPECT_TRUE(reader.ValidEncoding( EXPECT_TRUE(reader.ValidEncoding(
DwarfPointerEncoding(dwarf2reader::DW_EH_PE_udata8 | DwarfPointerEncoding(google_breakpad::DW_EH_PE_udata8 |
dwarf2reader::DW_EH_PE_datarel))); google_breakpad::DW_EH_PE_datarel)));
EXPECT_TRUE(reader.ValidEncoding( EXPECT_TRUE(reader.ValidEncoding(
DwarfPointerEncoding(dwarf2reader::DW_EH_PE_sleb128 | DwarfPointerEncoding(google_breakpad::DW_EH_PE_sleb128 |
dwarf2reader::DW_EH_PE_datarel))); google_breakpad::DW_EH_PE_datarel)));
EXPECT_TRUE(reader.ValidEncoding( EXPECT_TRUE(reader.ValidEncoding(
DwarfPointerEncoding(dwarf2reader::DW_EH_PE_sdata2 | DwarfPointerEncoding(google_breakpad::DW_EH_PE_sdata2 |
dwarf2reader::DW_EH_PE_datarel))); google_breakpad::DW_EH_PE_datarel)));
EXPECT_TRUE(reader.ValidEncoding( EXPECT_TRUE(reader.ValidEncoding(
DwarfPointerEncoding(dwarf2reader::DW_EH_PE_sdata4 | DwarfPointerEncoding(google_breakpad::DW_EH_PE_sdata4 |
dwarf2reader::DW_EH_PE_datarel))); google_breakpad::DW_EH_PE_datarel)));
EXPECT_TRUE(reader.ValidEncoding( EXPECT_TRUE(reader.ValidEncoding(
DwarfPointerEncoding(dwarf2reader::DW_EH_PE_sdata8 | DwarfPointerEncoding(google_breakpad::DW_EH_PE_sdata8 |
dwarf2reader::DW_EH_PE_datarel))); google_breakpad::DW_EH_PE_datarel)));
EXPECT_TRUE(reader.ValidEncoding( EXPECT_TRUE(reader.ValidEncoding(
DwarfPointerEncoding(dwarf2reader::DW_EH_PE_absptr | DwarfPointerEncoding(google_breakpad::DW_EH_PE_absptr |
dwarf2reader::DW_EH_PE_funcrel))); google_breakpad::DW_EH_PE_funcrel)));
EXPECT_TRUE(reader.ValidEncoding( EXPECT_TRUE(reader.ValidEncoding(
DwarfPointerEncoding(dwarf2reader::DW_EH_PE_uleb128 | DwarfPointerEncoding(google_breakpad::DW_EH_PE_uleb128 |
dwarf2reader::DW_EH_PE_funcrel))); google_breakpad::DW_EH_PE_funcrel)));
EXPECT_TRUE(reader.ValidEncoding( EXPECT_TRUE(reader.ValidEncoding(
DwarfPointerEncoding(dwarf2reader::DW_EH_PE_udata2 | DwarfPointerEncoding(google_breakpad::DW_EH_PE_udata2 |
dwarf2reader::DW_EH_PE_funcrel))); google_breakpad::DW_EH_PE_funcrel)));
EXPECT_TRUE(reader.ValidEncoding( EXPECT_TRUE(reader.ValidEncoding(
DwarfPointerEncoding(dwarf2reader::DW_EH_PE_udata4 | DwarfPointerEncoding(google_breakpad::DW_EH_PE_udata4 |
dwarf2reader::DW_EH_PE_funcrel))); google_breakpad::DW_EH_PE_funcrel)));
EXPECT_TRUE(reader.ValidEncoding( EXPECT_TRUE(reader.ValidEncoding(
DwarfPointerEncoding(dwarf2reader::DW_EH_PE_udata8 | DwarfPointerEncoding(google_breakpad::DW_EH_PE_udata8 |
dwarf2reader::DW_EH_PE_funcrel))); google_breakpad::DW_EH_PE_funcrel)));
EXPECT_TRUE(reader.ValidEncoding( EXPECT_TRUE(reader.ValidEncoding(
DwarfPointerEncoding(dwarf2reader::DW_EH_PE_sleb128 | DwarfPointerEncoding(google_breakpad::DW_EH_PE_sleb128 |
dwarf2reader::DW_EH_PE_funcrel))); google_breakpad::DW_EH_PE_funcrel)));
EXPECT_TRUE(reader.ValidEncoding( EXPECT_TRUE(reader.ValidEncoding(
DwarfPointerEncoding(dwarf2reader::DW_EH_PE_sdata2 | DwarfPointerEncoding(google_breakpad::DW_EH_PE_sdata2 |
dwarf2reader::DW_EH_PE_funcrel))); google_breakpad::DW_EH_PE_funcrel)));
EXPECT_TRUE(reader.ValidEncoding( EXPECT_TRUE(reader.ValidEncoding(
DwarfPointerEncoding(dwarf2reader::DW_EH_PE_sdata4 | DwarfPointerEncoding(google_breakpad::DW_EH_PE_sdata4 |
dwarf2reader::DW_EH_PE_funcrel))); google_breakpad::DW_EH_PE_funcrel)));
EXPECT_TRUE(reader.ValidEncoding( EXPECT_TRUE(reader.ValidEncoding(
DwarfPointerEncoding(dwarf2reader::DW_EH_PE_sdata8 | DwarfPointerEncoding(google_breakpad::DW_EH_PE_sdata8 |
dwarf2reader::DW_EH_PE_funcrel))); google_breakpad::DW_EH_PE_funcrel)));
EXPECT_TRUE(reader.ValidEncoding( EXPECT_TRUE(reader.ValidEncoding(
DwarfPointerEncoding(dwarf2reader::DW_EH_PE_indirect | DwarfPointerEncoding(google_breakpad::DW_EH_PE_indirect |
dwarf2reader::DW_EH_PE_absptr | google_breakpad::DW_EH_PE_absptr |
dwarf2reader::DW_EH_PE_pcrel))); google_breakpad::DW_EH_PE_pcrel)));
EXPECT_TRUE(reader.ValidEncoding( EXPECT_TRUE(reader.ValidEncoding(
DwarfPointerEncoding(dwarf2reader::DW_EH_PE_indirect | DwarfPointerEncoding(google_breakpad::DW_EH_PE_indirect |
dwarf2reader::DW_EH_PE_uleb128 | google_breakpad::DW_EH_PE_uleb128 |
dwarf2reader::DW_EH_PE_pcrel))); google_breakpad::DW_EH_PE_pcrel)));
EXPECT_TRUE(reader.ValidEncoding( EXPECT_TRUE(reader.ValidEncoding(
DwarfPointerEncoding(dwarf2reader::DW_EH_PE_indirect | DwarfPointerEncoding(google_breakpad::DW_EH_PE_indirect |
dwarf2reader::DW_EH_PE_udata2 | google_breakpad::DW_EH_PE_udata2 |
dwarf2reader::DW_EH_PE_pcrel))); google_breakpad::DW_EH_PE_pcrel)));
EXPECT_TRUE(reader.ValidEncoding( EXPECT_TRUE(reader.ValidEncoding(
DwarfPointerEncoding(dwarf2reader::DW_EH_PE_indirect | DwarfPointerEncoding(google_breakpad::DW_EH_PE_indirect |
dwarf2reader::DW_EH_PE_udata4 | google_breakpad::DW_EH_PE_udata4 |
dwarf2reader::DW_EH_PE_pcrel))); google_breakpad::DW_EH_PE_pcrel)));
EXPECT_TRUE(reader.ValidEncoding( EXPECT_TRUE(reader.ValidEncoding(
DwarfPointerEncoding(dwarf2reader::DW_EH_PE_indirect | DwarfPointerEncoding(google_breakpad::DW_EH_PE_indirect |
dwarf2reader::DW_EH_PE_udata8 | google_breakpad::DW_EH_PE_udata8 |
dwarf2reader::DW_EH_PE_pcrel))); google_breakpad::DW_EH_PE_pcrel)));
EXPECT_TRUE(reader.ValidEncoding( EXPECT_TRUE(reader.ValidEncoding(
DwarfPointerEncoding(dwarf2reader::DW_EH_PE_indirect | DwarfPointerEncoding(google_breakpad::DW_EH_PE_indirect |
dwarf2reader::DW_EH_PE_sleb128 | google_breakpad::DW_EH_PE_sleb128 |
dwarf2reader::DW_EH_PE_pcrel))); google_breakpad::DW_EH_PE_pcrel)));
EXPECT_TRUE(reader.ValidEncoding( EXPECT_TRUE(reader.ValidEncoding(
DwarfPointerEncoding(dwarf2reader::DW_EH_PE_indirect | DwarfPointerEncoding(google_breakpad::DW_EH_PE_indirect |
dwarf2reader::DW_EH_PE_sdata2 | google_breakpad::DW_EH_PE_sdata2 |
dwarf2reader::DW_EH_PE_pcrel))); google_breakpad::DW_EH_PE_pcrel)));
EXPECT_TRUE(reader.ValidEncoding( EXPECT_TRUE(reader.ValidEncoding(
DwarfPointerEncoding(dwarf2reader::DW_EH_PE_indirect | DwarfPointerEncoding(google_breakpad::DW_EH_PE_indirect |
dwarf2reader::DW_EH_PE_sdata4 | google_breakpad::DW_EH_PE_sdata4 |
dwarf2reader::DW_EH_PE_pcrel))); google_breakpad::DW_EH_PE_pcrel)));
EXPECT_TRUE(reader.ValidEncoding( EXPECT_TRUE(reader.ValidEncoding(
DwarfPointerEncoding(dwarf2reader::DW_EH_PE_indirect | DwarfPointerEncoding(google_breakpad::DW_EH_PE_indirect |
dwarf2reader::DW_EH_PE_sdata8 | google_breakpad::DW_EH_PE_sdata8 |
dwarf2reader::DW_EH_PE_pcrel))); google_breakpad::DW_EH_PE_pcrel)));
EXPECT_TRUE(reader.ValidEncoding( EXPECT_TRUE(reader.ValidEncoding(
DwarfPointerEncoding(dwarf2reader::DW_EH_PE_indirect | DwarfPointerEncoding(google_breakpad::DW_EH_PE_indirect |
dwarf2reader::DW_EH_PE_absptr | google_breakpad::DW_EH_PE_absptr |
dwarf2reader::DW_EH_PE_textrel))); google_breakpad::DW_EH_PE_textrel)));
EXPECT_TRUE(reader.ValidEncoding( EXPECT_TRUE(reader.ValidEncoding(
DwarfPointerEncoding(dwarf2reader::DW_EH_PE_indirect | DwarfPointerEncoding(google_breakpad::DW_EH_PE_indirect |
dwarf2reader::DW_EH_PE_uleb128 | google_breakpad::DW_EH_PE_uleb128 |
dwarf2reader::DW_EH_PE_textrel))); google_breakpad::DW_EH_PE_textrel)));
EXPECT_TRUE(reader.ValidEncoding( EXPECT_TRUE(reader.ValidEncoding(
DwarfPointerEncoding(dwarf2reader::DW_EH_PE_indirect | DwarfPointerEncoding(google_breakpad::DW_EH_PE_indirect |
dwarf2reader::DW_EH_PE_udata2 | google_breakpad::DW_EH_PE_udata2 |
dwarf2reader::DW_EH_PE_textrel))); google_breakpad::DW_EH_PE_textrel)));
EXPECT_TRUE(reader.ValidEncoding( EXPECT_TRUE(reader.ValidEncoding(
DwarfPointerEncoding(dwarf2reader::DW_EH_PE_indirect | DwarfPointerEncoding(google_breakpad::DW_EH_PE_indirect |
dwarf2reader::DW_EH_PE_udata4 | google_breakpad::DW_EH_PE_udata4 |
dwarf2reader::DW_EH_PE_textrel))); google_breakpad::DW_EH_PE_textrel)));
EXPECT_TRUE(reader.ValidEncoding( EXPECT_TRUE(reader.ValidEncoding(
DwarfPointerEncoding(dwarf2reader::DW_EH_PE_indirect | DwarfPointerEncoding(google_breakpad::DW_EH_PE_indirect |
dwarf2reader::DW_EH_PE_udata8 | google_breakpad::DW_EH_PE_udata8 |
dwarf2reader::DW_EH_PE_textrel))); google_breakpad::DW_EH_PE_textrel)));
EXPECT_TRUE(reader.ValidEncoding( EXPECT_TRUE(reader.ValidEncoding(
DwarfPointerEncoding(dwarf2reader::DW_EH_PE_indirect | DwarfPointerEncoding(google_breakpad::DW_EH_PE_indirect |
dwarf2reader::DW_EH_PE_sleb128 | google_breakpad::DW_EH_PE_sleb128 |
dwarf2reader::DW_EH_PE_textrel))); google_breakpad::DW_EH_PE_textrel)));
EXPECT_TRUE(reader.ValidEncoding( EXPECT_TRUE(reader.ValidEncoding(
DwarfPointerEncoding(dwarf2reader::DW_EH_PE_indirect | DwarfPointerEncoding(google_breakpad::DW_EH_PE_indirect |
dwarf2reader::DW_EH_PE_sdata2 | google_breakpad::DW_EH_PE_sdata2 |
dwarf2reader::DW_EH_PE_textrel))); google_breakpad::DW_EH_PE_textrel)));
EXPECT_TRUE(reader.ValidEncoding( EXPECT_TRUE(reader.ValidEncoding(
DwarfPointerEncoding(dwarf2reader::DW_EH_PE_indirect | DwarfPointerEncoding(google_breakpad::DW_EH_PE_indirect |
dwarf2reader::DW_EH_PE_sdata4 | google_breakpad::DW_EH_PE_sdata4 |
dwarf2reader::DW_EH_PE_textrel))); google_breakpad::DW_EH_PE_textrel)));
EXPECT_TRUE(reader.ValidEncoding( EXPECT_TRUE(reader.ValidEncoding(
DwarfPointerEncoding(dwarf2reader::DW_EH_PE_indirect | DwarfPointerEncoding(google_breakpad::DW_EH_PE_indirect |
dwarf2reader::DW_EH_PE_sdata8 | google_breakpad::DW_EH_PE_sdata8 |
dwarf2reader::DW_EH_PE_textrel))); google_breakpad::DW_EH_PE_textrel)));
EXPECT_TRUE(reader.ValidEncoding( EXPECT_TRUE(reader.ValidEncoding(
DwarfPointerEncoding(dwarf2reader::DW_EH_PE_indirect | DwarfPointerEncoding(google_breakpad::DW_EH_PE_indirect |
dwarf2reader::DW_EH_PE_absptr | google_breakpad::DW_EH_PE_absptr |
dwarf2reader::DW_EH_PE_datarel))); google_breakpad::DW_EH_PE_datarel)));
EXPECT_TRUE(reader.ValidEncoding( EXPECT_TRUE(reader.ValidEncoding(
DwarfPointerEncoding(dwarf2reader::DW_EH_PE_indirect | DwarfPointerEncoding(google_breakpad::DW_EH_PE_indirect |
dwarf2reader::DW_EH_PE_uleb128 | google_breakpad::DW_EH_PE_uleb128 |
dwarf2reader::DW_EH_PE_datarel))); google_breakpad::DW_EH_PE_datarel)));
EXPECT_TRUE(reader.ValidEncoding( EXPECT_TRUE(reader.ValidEncoding(
DwarfPointerEncoding(dwarf2reader::DW_EH_PE_indirect | DwarfPointerEncoding(google_breakpad::DW_EH_PE_indirect |
dwarf2reader::DW_EH_PE_udata2 | google_breakpad::DW_EH_PE_udata2 |
dwarf2reader::DW_EH_PE_datarel))); google_breakpad::DW_EH_PE_datarel)));
EXPECT_TRUE(reader.ValidEncoding( EXPECT_TRUE(reader.ValidEncoding(
DwarfPointerEncoding(dwarf2reader::DW_EH_PE_indirect | DwarfPointerEncoding(google_breakpad::DW_EH_PE_indirect |
dwarf2reader::DW_EH_PE_udata4 | google_breakpad::DW_EH_PE_udata4 |
dwarf2reader::DW_EH_PE_datarel))); google_breakpad::DW_EH_PE_datarel)));
EXPECT_TRUE(reader.ValidEncoding( EXPECT_TRUE(reader.ValidEncoding(
DwarfPointerEncoding(dwarf2reader::DW_EH_PE_indirect | DwarfPointerEncoding(google_breakpad::DW_EH_PE_indirect |
dwarf2reader::DW_EH_PE_udata8 | google_breakpad::DW_EH_PE_udata8 |
dwarf2reader::DW_EH_PE_datarel))); google_breakpad::DW_EH_PE_datarel)));
EXPECT_TRUE(reader.ValidEncoding( EXPECT_TRUE(reader.ValidEncoding(
DwarfPointerEncoding(dwarf2reader::DW_EH_PE_indirect | DwarfPointerEncoding(google_breakpad::DW_EH_PE_indirect |
dwarf2reader::DW_EH_PE_sleb128 | google_breakpad::DW_EH_PE_sleb128 |
dwarf2reader::DW_EH_PE_datarel))); google_breakpad::DW_EH_PE_datarel)));
EXPECT_TRUE(reader.ValidEncoding( EXPECT_TRUE(reader.ValidEncoding(
DwarfPointerEncoding(dwarf2reader::DW_EH_PE_indirect | DwarfPointerEncoding(google_breakpad::DW_EH_PE_indirect |
dwarf2reader::DW_EH_PE_sdata2 | google_breakpad::DW_EH_PE_sdata2 |
dwarf2reader::DW_EH_PE_datarel))); google_breakpad::DW_EH_PE_datarel)));
EXPECT_TRUE(reader.ValidEncoding( EXPECT_TRUE(reader.ValidEncoding(
DwarfPointerEncoding(dwarf2reader::DW_EH_PE_indirect | DwarfPointerEncoding(google_breakpad::DW_EH_PE_indirect |
dwarf2reader::DW_EH_PE_sdata4 | google_breakpad::DW_EH_PE_sdata4 |
dwarf2reader::DW_EH_PE_datarel))); google_breakpad::DW_EH_PE_datarel)));
EXPECT_TRUE(reader.ValidEncoding( EXPECT_TRUE(reader.ValidEncoding(
DwarfPointerEncoding(dwarf2reader::DW_EH_PE_indirect | DwarfPointerEncoding(google_breakpad::DW_EH_PE_indirect |
dwarf2reader::DW_EH_PE_sdata8 | google_breakpad::DW_EH_PE_sdata8 |
dwarf2reader::DW_EH_PE_datarel))); google_breakpad::DW_EH_PE_datarel)));
EXPECT_TRUE(reader.ValidEncoding( EXPECT_TRUE(reader.ValidEncoding(
DwarfPointerEncoding(dwarf2reader::DW_EH_PE_indirect | DwarfPointerEncoding(google_breakpad::DW_EH_PE_indirect |
dwarf2reader::DW_EH_PE_absptr | google_breakpad::DW_EH_PE_absptr |
dwarf2reader::DW_EH_PE_funcrel))); google_breakpad::DW_EH_PE_funcrel)));
EXPECT_TRUE(reader.ValidEncoding( EXPECT_TRUE(reader.ValidEncoding(
DwarfPointerEncoding(dwarf2reader::DW_EH_PE_indirect | DwarfPointerEncoding(google_breakpad::DW_EH_PE_indirect |
dwarf2reader::DW_EH_PE_uleb128 | google_breakpad::DW_EH_PE_uleb128 |
dwarf2reader::DW_EH_PE_funcrel))); google_breakpad::DW_EH_PE_funcrel)));
EXPECT_TRUE(reader.ValidEncoding( EXPECT_TRUE(reader.ValidEncoding(
DwarfPointerEncoding(dwarf2reader::DW_EH_PE_indirect | DwarfPointerEncoding(google_breakpad::DW_EH_PE_indirect |
dwarf2reader::DW_EH_PE_udata2 | google_breakpad::DW_EH_PE_udata2 |
dwarf2reader::DW_EH_PE_funcrel))); google_breakpad::DW_EH_PE_funcrel)));
EXPECT_TRUE(reader.ValidEncoding( EXPECT_TRUE(reader.ValidEncoding(
DwarfPointerEncoding(dwarf2reader::DW_EH_PE_indirect | DwarfPointerEncoding(google_breakpad::DW_EH_PE_indirect |
dwarf2reader::DW_EH_PE_udata4 | google_breakpad::DW_EH_PE_udata4 |
dwarf2reader::DW_EH_PE_funcrel))); google_breakpad::DW_EH_PE_funcrel)));
EXPECT_TRUE(reader.ValidEncoding( EXPECT_TRUE(reader.ValidEncoding(
DwarfPointerEncoding(dwarf2reader::DW_EH_PE_indirect | DwarfPointerEncoding(google_breakpad::DW_EH_PE_indirect |
dwarf2reader::DW_EH_PE_udata8 | google_breakpad::DW_EH_PE_udata8 |
dwarf2reader::DW_EH_PE_funcrel))); google_breakpad::DW_EH_PE_funcrel)));
EXPECT_TRUE(reader.ValidEncoding( EXPECT_TRUE(reader.ValidEncoding(
DwarfPointerEncoding(dwarf2reader::DW_EH_PE_indirect | DwarfPointerEncoding(google_breakpad::DW_EH_PE_indirect |
dwarf2reader::DW_EH_PE_sleb128 | google_breakpad::DW_EH_PE_sleb128 |
dwarf2reader::DW_EH_PE_funcrel))); google_breakpad::DW_EH_PE_funcrel)));
EXPECT_TRUE(reader.ValidEncoding( EXPECT_TRUE(reader.ValidEncoding(
DwarfPointerEncoding(dwarf2reader::DW_EH_PE_indirect | DwarfPointerEncoding(google_breakpad::DW_EH_PE_indirect |
dwarf2reader::DW_EH_PE_sdata2 | google_breakpad::DW_EH_PE_sdata2 |
dwarf2reader::DW_EH_PE_funcrel))); google_breakpad::DW_EH_PE_funcrel)));
EXPECT_TRUE(reader.ValidEncoding( EXPECT_TRUE(reader.ValidEncoding(
DwarfPointerEncoding(dwarf2reader::DW_EH_PE_indirect | DwarfPointerEncoding(google_breakpad::DW_EH_PE_indirect |
dwarf2reader::DW_EH_PE_sdata4 | google_breakpad::DW_EH_PE_sdata4 |
dwarf2reader::DW_EH_PE_funcrel))); google_breakpad::DW_EH_PE_funcrel)));
EXPECT_TRUE(reader.ValidEncoding( EXPECT_TRUE(reader.ValidEncoding(
DwarfPointerEncoding(dwarf2reader::DW_EH_PE_indirect | DwarfPointerEncoding(google_breakpad::DW_EH_PE_indirect |
dwarf2reader::DW_EH_PE_sdata8 | google_breakpad::DW_EH_PE_sdata8 |
dwarf2reader::DW_EH_PE_funcrel))); google_breakpad::DW_EH_PE_funcrel)));
EXPECT_FALSE(reader.ValidEncoding(DwarfPointerEncoding(0x05))); EXPECT_FALSE(reader.ValidEncoding(DwarfPointerEncoding(0x05)));
EXPECT_FALSE(reader.ValidEncoding(DwarfPointerEncoding(0x07))); EXPECT_FALSE(reader.ValidEncoding(DwarfPointerEncoding(0x07)));
@ -380,7 +380,7 @@ TEST_F(ReaderDeathTest, DW_EH_PE_omit) {
static const uint8_t data[] = { 42 }; static const uint8_t data[] = { 42 };
ByteReader reader(ENDIANNESS_BIG); ByteReader reader(ENDIANNESS_BIG);
reader.SetAddressSize(4); reader.SetAddressSize(4);
EXPECT_DEATH(reader.ReadEncodedPointer(data, dwarf2reader::DW_EH_PE_omit, EXPECT_DEATH(reader.ReadEncodedPointer(data, google_breakpad::DW_EH_PE_omit,
&pointer_size), &pointer_size),
"encoding != DW_EH_PE_omit"); "encoding != DW_EH_PE_omit");
} }
@ -390,7 +390,7 @@ TEST_F(Reader, DW_EH_PE_absptr4) {
ByteReader reader(ENDIANNESS_LITTLE); ByteReader reader(ENDIANNESS_LITTLE);
reader.SetAddressSize(4); reader.SetAddressSize(4);
EXPECT_EQ(0x40ea5727U, EXPECT_EQ(0x40ea5727U,
reader.ReadEncodedPointer(data, dwarf2reader::DW_EH_PE_absptr, reader.ReadEncodedPointer(data, google_breakpad::DW_EH_PE_absptr,
&pointer_size)); &pointer_size));
EXPECT_EQ(4U, pointer_size); EXPECT_EQ(4U, pointer_size);
} }
@ -402,7 +402,7 @@ TEST_F(Reader, DW_EH_PE_absptr8) {
ByteReader reader(ENDIANNESS_LITTLE); ByteReader reader(ENDIANNESS_LITTLE);
reader.SetAddressSize(8); reader.SetAddressSize(8);
EXPECT_EQ(0x010598c240ea5727ULL, EXPECT_EQ(0x010598c240ea5727ULL,
reader.ReadEncodedPointer(data + 1, dwarf2reader::DW_EH_PE_absptr, reader.ReadEncodedPointer(data + 1, google_breakpad::DW_EH_PE_absptr,
&pointer_size)); &pointer_size));
EXPECT_EQ(8U, pointer_size); EXPECT_EQ(8U, pointer_size);
} }
@ -412,7 +412,7 @@ TEST_F(Reader, DW_EH_PE_uleb128) {
ByteReader reader(ENDIANNESS_LITTLE); ByteReader reader(ENDIANNESS_LITTLE);
reader.SetAddressSize(4); reader.SetAddressSize(4);
EXPECT_EQ(0x130201U, EXPECT_EQ(0x130201U,
reader.ReadEncodedPointer(data, dwarf2reader::DW_EH_PE_uleb128, reader.ReadEncodedPointer(data, google_breakpad::DW_EH_PE_uleb128,
&pointer_size)); &pointer_size));
EXPECT_EQ(3U, pointer_size); EXPECT_EQ(3U, pointer_size);
} }
@ -422,7 +422,7 @@ TEST_F(Reader, DW_EH_PE_udata2) {
ByteReader reader(ENDIANNESS_BIG); ByteReader reader(ENDIANNESS_BIG);
reader.SetAddressSize(4); reader.SetAddressSize(4);
EXPECT_EQ(0xf48dU, EXPECT_EQ(0xf48dU,
reader.ReadEncodedPointer(data, dwarf2reader::DW_EH_PE_udata2, reader.ReadEncodedPointer(data, google_breakpad::DW_EH_PE_udata2,
&pointer_size)); &pointer_size));
EXPECT_EQ(2U, pointer_size); EXPECT_EQ(2U, pointer_size);
} }
@ -432,7 +432,7 @@ TEST_F(Reader, DW_EH_PE_udata4) {
ByteReader reader(ENDIANNESS_BIG); ByteReader reader(ENDIANNESS_BIG);
reader.SetAddressSize(8); reader.SetAddressSize(8);
EXPECT_EQ(0xa5628f8b, EXPECT_EQ(0xa5628f8b,
reader.ReadEncodedPointer(data + 2, dwarf2reader::DW_EH_PE_udata4, reader.ReadEncodedPointer(data + 2, google_breakpad::DW_EH_PE_udata4,
&pointer_size)); &pointer_size));
EXPECT_EQ(4U, pointer_size); EXPECT_EQ(4U, pointer_size);
} }
@ -444,7 +444,7 @@ TEST_F(Reader, DW_EH_PE_udata8Addr8) {
ByteReader reader(ENDIANNESS_LITTLE); ByteReader reader(ENDIANNESS_LITTLE);
reader.SetAddressSize(8); reader.SetAddressSize(8);
EXPECT_EQ(0x8fed199f69047304ULL, EXPECT_EQ(0x8fed199f69047304ULL,
reader.ReadEncodedPointer(data + 1, dwarf2reader::DW_EH_PE_udata8, reader.ReadEncodedPointer(data + 1, google_breakpad::DW_EH_PE_udata8,
&pointer_size)); &pointer_size));
EXPECT_EQ(8U, pointer_size); EXPECT_EQ(8U, pointer_size);
} }
@ -456,7 +456,7 @@ TEST_F(Reader, DW_EH_PE_udata8Addr4) {
ByteReader reader(ENDIANNESS_LITTLE); ByteReader reader(ENDIANNESS_LITTLE);
reader.SetAddressSize(4); reader.SetAddressSize(4);
EXPECT_EQ(0x69047304ULL, EXPECT_EQ(0x69047304ULL,
reader.ReadEncodedPointer(data + 1, dwarf2reader::DW_EH_PE_udata8, reader.ReadEncodedPointer(data + 1, google_breakpad::DW_EH_PE_udata8,
&pointer_size)); &pointer_size));
EXPECT_EQ(8U, pointer_size); EXPECT_EQ(8U, pointer_size);
} }
@ -466,7 +466,7 @@ TEST_F(Reader, DW_EH_PE_sleb128) {
ByteReader reader(ENDIANNESS_BIG); ByteReader reader(ENDIANNESS_BIG);
reader.SetAddressSize(4); reader.SetAddressSize(4);
EXPECT_EQ(-0x030201U & 0xffffffff, EXPECT_EQ(-0x030201U & 0xffffffff,
reader.ReadEncodedPointer(data + 1, dwarf2reader::DW_EH_PE_sleb128, reader.ReadEncodedPointer(data + 1, google_breakpad::DW_EH_PE_sleb128,
&pointer_size)); &pointer_size));
EXPECT_EQ(3U, pointer_size); EXPECT_EQ(3U, pointer_size);
} }
@ -476,7 +476,7 @@ TEST_F(Reader, DW_EH_PE_sdata2) {
ByteReader reader(ENDIANNESS_LITTLE); ByteReader reader(ENDIANNESS_LITTLE);
reader.SetAddressSize(8); reader.SetAddressSize(8);
EXPECT_EQ(0xffffffffffffbfb9ULL, EXPECT_EQ(0xffffffffffffbfb9ULL,
reader.ReadEncodedPointer(data, dwarf2reader::DW_EH_PE_sdata2, reader.ReadEncodedPointer(data, google_breakpad::DW_EH_PE_sdata2,
&pointer_size)); &pointer_size));
EXPECT_EQ(2U, pointer_size); EXPECT_EQ(2U, pointer_size);
} }
@ -486,7 +486,7 @@ TEST_F(Reader, DW_EH_PE_sdata4) {
ByteReader reader(ENDIANNESS_LITTLE); ByteReader reader(ENDIANNESS_LITTLE);
reader.SetAddressSize(8); reader.SetAddressSize(8);
EXPECT_EQ(0xffffffffadc2b8f2ULL, EXPECT_EQ(0xffffffffadc2b8f2ULL,
reader.ReadEncodedPointer(data + 2, dwarf2reader::DW_EH_PE_sdata4, reader.ReadEncodedPointer(data + 2, google_breakpad::DW_EH_PE_sdata4,
&pointer_size)); &pointer_size));
EXPECT_EQ(4U, pointer_size); EXPECT_EQ(4U, pointer_size);
} }
@ -498,7 +498,7 @@ TEST_F(Reader, DW_EH_PE_sdata8) {
ByteReader reader(ENDIANNESS_LITTLE); ByteReader reader(ENDIANNESS_LITTLE);
reader.SetAddressSize(8); reader.SetAddressSize(8);
EXPECT_EQ(0x87269b0ce0795766ULL, EXPECT_EQ(0x87269b0ce0795766ULL,
reader.ReadEncodedPointer(data + 1, dwarf2reader::DW_EH_PE_sdata8, reader.ReadEncodedPointer(data + 1, google_breakpad::DW_EH_PE_sdata8,
&pointer_size)); &pointer_size));
EXPECT_EQ(8U, pointer_size); EXPECT_EQ(8U, pointer_size);
} }
@ -510,8 +510,8 @@ TEST_F(Reader, DW_EH_PE_pcrel) {
ByteReader reader(ENDIANNESS_BIG); ByteReader reader(ENDIANNESS_BIG);
reader.SetAddressSize(4); reader.SetAddressSize(4);
DwarfPointerEncoding encoding = DwarfPointerEncoding encoding =
DwarfPointerEncoding(dwarf2reader::DW_EH_PE_pcrel DwarfPointerEncoding(google_breakpad::DW_EH_PE_pcrel
| dwarf2reader::DW_EH_PE_absptr); | google_breakpad::DW_EH_PE_absptr);
reader.SetCFIDataBase(0x89951377, data); reader.SetCFIDataBase(0x89951377, data);
EXPECT_EQ(0x89951377 + 3 + 0x14c8c402, EXPECT_EQ(0x89951377 + 3 + 0x14c8c402,
reader.ReadEncodedPointer(data + 3, encoding, &pointer_size)); reader.ReadEncodedPointer(data + 3, encoding, &pointer_size));
@ -526,8 +526,8 @@ TEST_F(Reader, DW_EH_PE_textrel) {
reader.SetAddressSize(4); reader.SetAddressSize(4);
reader.SetTextBase(0xb91beaf0); reader.SetTextBase(0xb91beaf0);
DwarfPointerEncoding encoding = DwarfPointerEncoding encoding =
DwarfPointerEncoding(dwarf2reader::DW_EH_PE_textrel DwarfPointerEncoding(google_breakpad::DW_EH_PE_textrel
| dwarf2reader::DW_EH_PE_sdata2); | google_breakpad::DW_EH_PE_sdata2);
EXPECT_EQ((0xb91beaf0 + 0xffffc917) & 0xffffffff, EXPECT_EQ((0xb91beaf0 + 0xffffc917) & 0xffffffff,
reader.ReadEncodedPointer(data + 3, encoding, &pointer_size)); reader.ReadEncodedPointer(data + 3, encoding, &pointer_size));
EXPECT_EQ(2U, pointer_size); EXPECT_EQ(2U, pointer_size);
@ -541,8 +541,8 @@ TEST_F(Reader, DW_EH_PE_datarel) {
reader.SetAddressSize(8); reader.SetAddressSize(8);
reader.SetDataBase(0xbef308bd25ce74f0ULL); reader.SetDataBase(0xbef308bd25ce74f0ULL);
DwarfPointerEncoding encoding = DwarfPointerEncoding encoding =
DwarfPointerEncoding(dwarf2reader::DW_EH_PE_datarel DwarfPointerEncoding(google_breakpad::DW_EH_PE_datarel
| dwarf2reader::DW_EH_PE_sleb128); | google_breakpad::DW_EH_PE_sleb128);
EXPECT_EQ(0xbef308bd25ce74f0ULL + 0xfffffffffffa013bULL, EXPECT_EQ(0xbef308bd25ce74f0ULL + 0xfffffffffffa013bULL,
reader.ReadEncodedPointer(data + 2, encoding, &pointer_size)); reader.ReadEncodedPointer(data + 2, encoding, &pointer_size));
EXPECT_EQ(3U, pointer_size); EXPECT_EQ(3U, pointer_size);
@ -556,8 +556,8 @@ TEST_F(Reader, DW_EH_PE_funcrel) {
reader.SetAddressSize(4); reader.SetAddressSize(4);
reader.SetFunctionBase(0x823c3520); reader.SetFunctionBase(0x823c3520);
DwarfPointerEncoding encoding = DwarfPointerEncoding encoding =
DwarfPointerEncoding(dwarf2reader::DW_EH_PE_funcrel DwarfPointerEncoding(google_breakpad::DW_EH_PE_funcrel
| dwarf2reader::DW_EH_PE_udata2); | google_breakpad::DW_EH_PE_udata2);
EXPECT_EQ(0x823c3520 + 0xd148, EXPECT_EQ(0x823c3520 + 0xd148,
reader.ReadEncodedPointer(data + 5, encoding, &pointer_size)); reader.ReadEncodedPointer(data + 5, encoding, &pointer_size));
EXPECT_EQ(2U, pointer_size); EXPECT_EQ(2U, pointer_size);
@ -567,48 +567,48 @@ TEST(UsableBase, CFI) {
static const uint8_t data[] = { 0x42 }; static const uint8_t data[] = { 0x42 };
ByteReader reader(ENDIANNESS_BIG); ByteReader reader(ENDIANNESS_BIG);
reader.SetCFIDataBase(0xb31cbd20, data); reader.SetCFIDataBase(0xb31cbd20, data);
EXPECT_TRUE(reader.UsableEncoding(dwarf2reader::DW_EH_PE_absptr)); EXPECT_TRUE(reader.UsableEncoding(google_breakpad::DW_EH_PE_absptr));
EXPECT_TRUE(reader.UsableEncoding(dwarf2reader::DW_EH_PE_pcrel)); EXPECT_TRUE(reader.UsableEncoding(google_breakpad::DW_EH_PE_pcrel));
EXPECT_FALSE(reader.UsableEncoding(dwarf2reader::DW_EH_PE_textrel)); EXPECT_FALSE(reader.UsableEncoding(google_breakpad::DW_EH_PE_textrel));
EXPECT_FALSE(reader.UsableEncoding(dwarf2reader::DW_EH_PE_datarel)); EXPECT_FALSE(reader.UsableEncoding(google_breakpad::DW_EH_PE_datarel));
EXPECT_FALSE(reader.UsableEncoding(dwarf2reader::DW_EH_PE_funcrel)); EXPECT_FALSE(reader.UsableEncoding(google_breakpad::DW_EH_PE_funcrel));
EXPECT_FALSE(reader.UsableEncoding(dwarf2reader::DW_EH_PE_omit)); EXPECT_FALSE(reader.UsableEncoding(google_breakpad::DW_EH_PE_omit));
EXPECT_FALSE(reader.UsableEncoding(DwarfPointerEncoding(0x60))); EXPECT_FALSE(reader.UsableEncoding(DwarfPointerEncoding(0x60)));
} }
TEST(UsableBase, Text) { TEST(UsableBase, Text) {
ByteReader reader(ENDIANNESS_BIG); ByteReader reader(ENDIANNESS_BIG);
reader.SetTextBase(0xa899ccb9); reader.SetTextBase(0xa899ccb9);
EXPECT_TRUE(reader.UsableEncoding(dwarf2reader::DW_EH_PE_absptr)); EXPECT_TRUE(reader.UsableEncoding(google_breakpad::DW_EH_PE_absptr));
EXPECT_FALSE(reader.UsableEncoding(dwarf2reader::DW_EH_PE_pcrel)); EXPECT_FALSE(reader.UsableEncoding(google_breakpad::DW_EH_PE_pcrel));
EXPECT_TRUE(reader.UsableEncoding(dwarf2reader::DW_EH_PE_textrel)); EXPECT_TRUE(reader.UsableEncoding(google_breakpad::DW_EH_PE_textrel));
EXPECT_FALSE(reader.UsableEncoding(dwarf2reader::DW_EH_PE_datarel)); EXPECT_FALSE(reader.UsableEncoding(google_breakpad::DW_EH_PE_datarel));
EXPECT_FALSE(reader.UsableEncoding(dwarf2reader::DW_EH_PE_funcrel)); EXPECT_FALSE(reader.UsableEncoding(google_breakpad::DW_EH_PE_funcrel));
EXPECT_FALSE(reader.UsableEncoding(dwarf2reader::DW_EH_PE_omit)); EXPECT_FALSE(reader.UsableEncoding(google_breakpad::DW_EH_PE_omit));
EXPECT_FALSE(reader.UsableEncoding(DwarfPointerEncoding(0x60))); EXPECT_FALSE(reader.UsableEncoding(DwarfPointerEncoding(0x60)));
} }
TEST(UsableBase, Data) { TEST(UsableBase, Data) {
ByteReader reader(ENDIANNESS_BIG); ByteReader reader(ENDIANNESS_BIG);
reader.SetDataBase(0xf7b10bcd); reader.SetDataBase(0xf7b10bcd);
EXPECT_TRUE(reader.UsableEncoding(dwarf2reader::DW_EH_PE_absptr)); EXPECT_TRUE(reader.UsableEncoding(google_breakpad::DW_EH_PE_absptr));
EXPECT_FALSE(reader.UsableEncoding(dwarf2reader::DW_EH_PE_pcrel)); EXPECT_FALSE(reader.UsableEncoding(google_breakpad::DW_EH_PE_pcrel));
EXPECT_FALSE(reader.UsableEncoding(dwarf2reader::DW_EH_PE_textrel)); EXPECT_FALSE(reader.UsableEncoding(google_breakpad::DW_EH_PE_textrel));
EXPECT_TRUE(reader.UsableEncoding(dwarf2reader::DW_EH_PE_datarel)); EXPECT_TRUE(reader.UsableEncoding(google_breakpad::DW_EH_PE_datarel));
EXPECT_FALSE(reader.UsableEncoding(dwarf2reader::DW_EH_PE_funcrel)); EXPECT_FALSE(reader.UsableEncoding(google_breakpad::DW_EH_PE_funcrel));
EXPECT_FALSE(reader.UsableEncoding(dwarf2reader::DW_EH_PE_omit)); EXPECT_FALSE(reader.UsableEncoding(google_breakpad::DW_EH_PE_omit));
EXPECT_FALSE(reader.UsableEncoding(DwarfPointerEncoding(0x60))); EXPECT_FALSE(reader.UsableEncoding(DwarfPointerEncoding(0x60)));
} }
TEST(UsableBase, Function) { TEST(UsableBase, Function) {
ByteReader reader(ENDIANNESS_BIG); ByteReader reader(ENDIANNESS_BIG);
reader.SetFunctionBase(0xc2c0ed81); reader.SetFunctionBase(0xc2c0ed81);
EXPECT_TRUE(reader.UsableEncoding(dwarf2reader::DW_EH_PE_absptr)); EXPECT_TRUE(reader.UsableEncoding(google_breakpad::DW_EH_PE_absptr));
EXPECT_FALSE(reader.UsableEncoding(dwarf2reader::DW_EH_PE_pcrel)); EXPECT_FALSE(reader.UsableEncoding(google_breakpad::DW_EH_PE_pcrel));
EXPECT_FALSE(reader.UsableEncoding(dwarf2reader::DW_EH_PE_textrel)); EXPECT_FALSE(reader.UsableEncoding(google_breakpad::DW_EH_PE_textrel));
EXPECT_FALSE(reader.UsableEncoding(dwarf2reader::DW_EH_PE_datarel)); EXPECT_FALSE(reader.UsableEncoding(google_breakpad::DW_EH_PE_datarel));
EXPECT_TRUE(reader.UsableEncoding(dwarf2reader::DW_EH_PE_funcrel)); EXPECT_TRUE(reader.UsableEncoding(google_breakpad::DW_EH_PE_funcrel));
EXPECT_FALSE(reader.UsableEncoding(dwarf2reader::DW_EH_PE_omit)); EXPECT_FALSE(reader.UsableEncoding(google_breakpad::DW_EH_PE_omit));
EXPECT_FALSE(reader.UsableEncoding(DwarfPointerEncoding(0x60))); EXPECT_FALSE(reader.UsableEncoding(DwarfPointerEncoding(0x60)));
} }
@ -616,12 +616,12 @@ TEST(UsableBase, ClearFunction) {
ByteReader reader(ENDIANNESS_BIG); ByteReader reader(ENDIANNESS_BIG);
reader.SetFunctionBase(0xc2c0ed81); reader.SetFunctionBase(0xc2c0ed81);
reader.ClearFunctionBase(); reader.ClearFunctionBase();
EXPECT_TRUE(reader.UsableEncoding(dwarf2reader::DW_EH_PE_absptr)); EXPECT_TRUE(reader.UsableEncoding(google_breakpad::DW_EH_PE_absptr));
EXPECT_FALSE(reader.UsableEncoding(dwarf2reader::DW_EH_PE_pcrel)); EXPECT_FALSE(reader.UsableEncoding(google_breakpad::DW_EH_PE_pcrel));
EXPECT_FALSE(reader.UsableEncoding(dwarf2reader::DW_EH_PE_textrel)); EXPECT_FALSE(reader.UsableEncoding(google_breakpad::DW_EH_PE_textrel));
EXPECT_FALSE(reader.UsableEncoding(dwarf2reader::DW_EH_PE_datarel)); EXPECT_FALSE(reader.UsableEncoding(google_breakpad::DW_EH_PE_datarel));
EXPECT_FALSE(reader.UsableEncoding(dwarf2reader::DW_EH_PE_funcrel)); EXPECT_FALSE(reader.UsableEncoding(google_breakpad::DW_EH_PE_funcrel));
EXPECT_FALSE(reader.UsableEncoding(dwarf2reader::DW_EH_PE_omit)); EXPECT_FALSE(reader.UsableEncoding(google_breakpad::DW_EH_PE_omit));
EXPECT_FALSE(reader.UsableEncoding(DwarfPointerEncoding(0x60))); EXPECT_FALSE(reader.UsableEncoding(DwarfPointerEncoding(0x60)));
} }
@ -641,7 +641,7 @@ class Aligned: public AlignedFixture, public Test { };
TEST_F(Aligned, DW_EH_PE_aligned0) { TEST_F(Aligned, DW_EH_PE_aligned0) {
reader.SetCFIDataBase(0xb440305c, data); reader.SetCFIDataBase(0xb440305c, data);
EXPECT_EQ(0xfe6e93d8U, EXPECT_EQ(0xfe6e93d8U,
reader.ReadEncodedPointer(data, dwarf2reader::DW_EH_PE_aligned, reader.ReadEncodedPointer(data, google_breakpad::DW_EH_PE_aligned,
&pointer_size)); &pointer_size));
EXPECT_EQ(4U, pointer_size); EXPECT_EQ(4U, pointer_size);
} }
@ -649,7 +649,7 @@ TEST_F(Aligned, DW_EH_PE_aligned0) {
TEST_F(Aligned, DW_EH_PE_aligned1) { TEST_F(Aligned, DW_EH_PE_aligned1) {
reader.SetCFIDataBase(0xb440305d, data); reader.SetCFIDataBase(0xb440305d, data);
EXPECT_EQ(0xd834d51cU, EXPECT_EQ(0xd834d51cU,
reader.ReadEncodedPointer(data, dwarf2reader::DW_EH_PE_aligned, reader.ReadEncodedPointer(data, google_breakpad::DW_EH_PE_aligned,
&pointer_size)); &pointer_size));
EXPECT_EQ(7U, pointer_size); EXPECT_EQ(7U, pointer_size);
} }
@ -657,7 +657,7 @@ TEST_F(Aligned, DW_EH_PE_aligned1) {
TEST_F(Aligned, DW_EH_PE_aligned2) { TEST_F(Aligned, DW_EH_PE_aligned2) {
reader.SetCFIDataBase(0xb440305e, data); reader.SetCFIDataBase(0xb440305e, data);
EXPECT_EQ(0x93d834d5U, EXPECT_EQ(0x93d834d5U,
reader.ReadEncodedPointer(data, dwarf2reader::DW_EH_PE_aligned, reader.ReadEncodedPointer(data, google_breakpad::DW_EH_PE_aligned,
&pointer_size)); &pointer_size));
EXPECT_EQ(6U, pointer_size); EXPECT_EQ(6U, pointer_size);
} }
@ -665,7 +665,7 @@ TEST_F(Aligned, DW_EH_PE_aligned2) {
TEST_F(Aligned, DW_EH_PE_aligned3) { TEST_F(Aligned, DW_EH_PE_aligned3) {
reader.SetCFIDataBase(0xb440305f, data); reader.SetCFIDataBase(0xb440305f, data);
EXPECT_EQ(0x6e93d834U, EXPECT_EQ(0x6e93d834U,
reader.ReadEncodedPointer(data, dwarf2reader::DW_EH_PE_aligned, reader.ReadEncodedPointer(data, google_breakpad::DW_EH_PE_aligned,
&pointer_size)); &pointer_size));
EXPECT_EQ(5U, pointer_size); EXPECT_EQ(5U, pointer_size);
} }
@ -674,7 +674,7 @@ TEST_F(Aligned, DW_EH_PE_aligned11) {
reader.SetCFIDataBase(0xb4403061, data); reader.SetCFIDataBase(0xb4403061, data);
EXPECT_EQ(0xd834d51cU, EXPECT_EQ(0xd834d51cU,
reader.ReadEncodedPointer(data + 1, reader.ReadEncodedPointer(data + 1,
dwarf2reader::DW_EH_PE_aligned, google_breakpad::DW_EH_PE_aligned,
&pointer_size)); &pointer_size));
EXPECT_EQ(6U, pointer_size); EXPECT_EQ(6U, pointer_size);
} }
@ -683,7 +683,7 @@ TEST_F(Aligned, DW_EH_PE_aligned30) {
reader.SetCFIDataBase(0xb4403063, data); reader.SetCFIDataBase(0xb4403063, data);
EXPECT_EQ(0x6e93d834U, EXPECT_EQ(0x6e93d834U,
reader.ReadEncodedPointer(data + 1, reader.ReadEncodedPointer(data + 1,
dwarf2reader::DW_EH_PE_aligned, google_breakpad::DW_EH_PE_aligned,
&pointer_size)); &pointer_size));
EXPECT_EQ(4U, pointer_size); EXPECT_EQ(4U, pointer_size);
} }
@ -692,7 +692,7 @@ TEST_F(Aligned, DW_EH_PE_aligned23) {
reader.SetCFIDataBase(0xb4403062, data); reader.SetCFIDataBase(0xb4403062, data);
EXPECT_EQ(0x1cd3ac2bU, EXPECT_EQ(0x1cd3ac2bU,
reader.ReadEncodedPointer(data + 3, reader.ReadEncodedPointer(data + 3,
dwarf2reader::DW_EH_PE_aligned, google_breakpad::DW_EH_PE_aligned,
&pointer_size)); &pointer_size));
EXPECT_EQ(7U, pointer_size); EXPECT_EQ(7U, pointer_size);
} }
@ -701,7 +701,7 @@ TEST_F(Aligned, DW_EH_PE_aligned03) {
reader.SetCFIDataBase(0xb4403064, data); reader.SetCFIDataBase(0xb4403064, data);
EXPECT_EQ(0x34d51cd3U, EXPECT_EQ(0x34d51cd3U,
reader.ReadEncodedPointer(data + 3, reader.ReadEncodedPointer(data + 3,
dwarf2reader::DW_EH_PE_aligned, google_breakpad::DW_EH_PE_aligned,
&pointer_size)); &pointer_size));
EXPECT_EQ(5U, pointer_size); EXPECT_EQ(5U, pointer_size);
} }

View file

@ -39,8 +39,6 @@
namespace google_breakpad { namespace google_breakpad {
using dwarf2reader::DwarfPointerEncoding;
CFISection& CFISection::CIEHeader(uint64_t code_alignment_factor, CFISection& CFISection::CIEHeader(uint64_t code_alignment_factor,
int data_alignment_factor, int data_alignment_factor,
unsigned return_address_register, unsigned return_address_register,
@ -115,7 +113,7 @@ CFISection& CFISection::FDEHeader(Label cie_pointer,
CFISection& CFISection::FinishEntry() { CFISection& CFISection::FinishEntry() {
assert(entry_length_); assert(entry_length_);
Align(address_size_, dwarf2reader::DW_CFA_nop); Align(address_size_, DW_CFA_nop);
entry_length_->length = Here() - entry_length_->start; entry_length_->length = Here() - entry_length_->start;
delete entry_length_; delete entry_length_;
entry_length_ = NULL; entry_length_ = NULL;
@ -127,24 +125,24 @@ CFISection& CFISection::EncodedPointer(uint64_t address,
DwarfPointerEncoding encoding, DwarfPointerEncoding encoding,
const EncodedPointerBases& bases) { const EncodedPointerBases& bases) {
// Omitted data is extremely easy to emit. // Omitted data is extremely easy to emit.
if (encoding == dwarf2reader::DW_EH_PE_omit) if (encoding == DW_EH_PE_omit)
return *this; return *this;
// If (encoding & dwarf2reader::DW_EH_PE_indirect) != 0, then we assume // If (encoding & DW_EH_PE_indirect) != 0, then we assume
// that ADDRESS is the address at which the pointer is stored --- in // that ADDRESS is the address at which the pointer is stored --- in
// other words, that bit has no effect on how we write the pointer. // other words, that bit has no effect on how we write the pointer.
encoding = DwarfPointerEncoding(encoding & ~dwarf2reader::DW_EH_PE_indirect); encoding = DwarfPointerEncoding(encoding & ~DW_EH_PE_indirect);
// Find the base address to which this pointer is relative. The upper // Find the base address to which this pointer is relative. The upper
// nybble of the encoding specifies this. // nybble of the encoding specifies this.
uint64_t base; uint64_t base;
switch (encoding & 0xf0) { switch (encoding & 0xf0) {
case dwarf2reader::DW_EH_PE_absptr: base = 0; break; case DW_EH_PE_absptr: base = 0; break;
case dwarf2reader::DW_EH_PE_pcrel: base = bases.cfi + Size(); break; case DW_EH_PE_pcrel: base = bases.cfi + Size(); break;
case dwarf2reader::DW_EH_PE_textrel: base = bases.text; break; case DW_EH_PE_textrel: base = bases.text; break;
case dwarf2reader::DW_EH_PE_datarel: base = bases.data; break; case DW_EH_PE_datarel: base = bases.data; break;
case dwarf2reader::DW_EH_PE_funcrel: base = fde_start_address_; break; case DW_EH_PE_funcrel: base = fde_start_address_; break;
case dwarf2reader::DW_EH_PE_aligned: base = 0; break; case DW_EH_PE_aligned: base = 0; break;
default: abort(); default: abort();
}; };
@ -153,7 +151,7 @@ CFISection& CFISection::EncodedPointer(uint64_t address,
address -= base; address -= base;
// Align the pointer, if required. // Align the pointer, if required.
if ((encoding & 0xf0) == dwarf2reader::DW_EH_PE_aligned) if ((encoding & 0xf0) == DW_EH_PE_aligned)
Align(AddressSize()); Align(AddressSize());
// Append ADDRESS to this section in the appropriate form. For the // Append ADDRESS to this section in the appropriate form. For the
@ -161,30 +159,30 @@ CFISection& CFISection::EncodedPointer(uint64_t address,
// unsigned encodings, because ADDRESS has already been extended to 64 // unsigned encodings, because ADDRESS has already been extended to 64
// bits before it was passed to us. // bits before it was passed to us.
switch (encoding & 0x0f) { switch (encoding & 0x0f) {
case dwarf2reader::DW_EH_PE_absptr: case DW_EH_PE_absptr:
Address(address); Address(address);
break; break;
case dwarf2reader::DW_EH_PE_uleb128: case DW_EH_PE_uleb128:
ULEB128(address); ULEB128(address);
break; break;
case dwarf2reader::DW_EH_PE_sleb128: case DW_EH_PE_sleb128:
LEB128(address); LEB128(address);
break; break;
case dwarf2reader::DW_EH_PE_udata2: case DW_EH_PE_udata2:
case dwarf2reader::DW_EH_PE_sdata2: case DW_EH_PE_sdata2:
D16(address); D16(address);
break; break;
case dwarf2reader::DW_EH_PE_udata4: case DW_EH_PE_udata4:
case dwarf2reader::DW_EH_PE_sdata4: case DW_EH_PE_sdata4:
D32(address); D32(address);
break; break;
case dwarf2reader::DW_EH_PE_udata8: case DW_EH_PE_udata8:
case dwarf2reader::DW_EH_PE_sdata8: case DW_EH_PE_sdata8:
D64(address); D64(address);
break; break;

View file

@ -39,7 +39,7 @@
#include "common/dwarf/dwarf2diehandler.h" #include "common/dwarf/dwarf2diehandler.h"
#include "common/using_std_string.h" #include "common/using_std_string.h"
namespace dwarf2reader { namespace google_breakpad {
DIEDispatcher::~DIEDispatcher() { DIEDispatcher::~DIEDispatcher() {
while (!die_handlers_.empty()) { while (!die_handlers_.empty()) {
@ -196,4 +196,4 @@ void DIEDispatcher::ProcessAttributeSignature(uint64_t offset,
current.handler_->ProcessAttributeSignature(attr, form, signature); current.handler_->ProcessAttributeSignature(attr, form, signature);
} }
} // namespace dwarf2reader } // namespace google_breakpad

View file

@ -166,7 +166,7 @@
#include "common/dwarf/dwarf2reader.h" #include "common/dwarf/dwarf2reader.h"
#include "common/using_std_string.h" #include "common/using_std_string.h"
namespace dwarf2reader { namespace google_breakpad {
// A base class for handlers for specific DIE types. The series of // A base class for handlers for specific DIE types. The series of
// calls made on a DIE handler is as follows: // calls made on a DIE handler is as follows:
@ -361,5 +361,5 @@ class DIEDispatcher: public Dwarf2Handler {
RootDIEHandler* root_handler_; RootDIEHandler* root_handler_;
}; };
} // namespace dwarf2reader } // namespace google_breakpad
#endif // COMMON_DWARF_DWARF2DIEHANDLER_H__ #endif // COMMON_DWARF_DWARF2DIEHANDLER_H__

View file

@ -53,12 +53,12 @@ using ::testing::Return;
using ::testing::Sequence; using ::testing::Sequence;
using ::testing::StrEq; using ::testing::StrEq;
using dwarf2reader::DIEDispatcher; using google_breakpad::DIEDispatcher;
using dwarf2reader::DIEHandler; using google_breakpad::DIEHandler;
using dwarf2reader::DwarfAttribute; using google_breakpad::DwarfAttribute;
using dwarf2reader::DwarfForm; using google_breakpad::DwarfForm;
using dwarf2reader::DwarfTag; using google_breakpad::DwarfTag;
using dwarf2reader::RootDIEHandler; using google_breakpad::RootDIEHandler;
class MockDIEHandler: public DIEHandler { class MockDIEHandler: public DIEHandler {
public: public:

View file

@ -31,7 +31,7 @@
#ifndef COMMON_DWARF_DWARF2ENUMS_H__ #ifndef COMMON_DWARF_DWARF2ENUMS_H__
#define COMMON_DWARF_DWARF2ENUMS_H__ #define COMMON_DWARF_DWARF2ENUMS_H__
namespace dwarf2reader { namespace google_breakpad {
// These enums do not follow the google3 style only because they are // These enums do not follow the google3 style only because they are
// known universally (specs, other implementations) by the names in // known universally (specs, other implementations) by the names in
@ -740,5 +740,5 @@ enum DwarfPointerEncoding
DW_EH_PE_indirect = 0x80 DW_EH_PE_indirect = 0x80
}; };
} // namespace dwarf2reader } // namespace google_breakpad
#endif // COMMON_DWARF_DWARF2ENUMS_H__ #endif // COMMON_DWARF_DWARF2ENUMS_H__

View file

@ -28,8 +28,8 @@
// CFI reader author: Jim Blandy <jimb@mozilla.com> <jimb@red-bean.com> // CFI reader author: Jim Blandy <jimb@mozilla.com> <jimb@red-bean.com>
// Implementation of dwarf2reader::LineInfo, dwarf2reader::CompilationUnit, // Implementation of LineInfo, CompilationUnit,
// and dwarf2reader::CallFrameInfo. See dwarf2reader.h for details. // and CallFrameInfo. See dwarf2reader.h for details.
#include "common/dwarf/dwarf2reader.h" #include "common/dwarf/dwarf2reader.h"
@ -51,7 +51,7 @@
#include "common/using_std_string.h" #include "common/using_std_string.h"
#include "google_breakpad/common/breakpad_types.h" #include "google_breakpad/common/breakpad_types.h"
namespace dwarf2reader { namespace google_breakpad {
const SectionMap::const_iterator GetSectionByName(const SectionMap& const SectionMap::const_iterator GetSectionByName(const SectionMap&
sections, const char *name) { sections, const char *name) {
@ -517,8 +517,8 @@ const uint8_t* CompilationUnit::ProcessOffsetBaseAttribute(
// This is the important one here! // This is the important one here!
case DW_FORM_sec_offset: case DW_FORM_sec_offset:
if (attr == dwarf2reader::DW_AT_str_offsets_base || if (attr == DW_AT_str_offsets_base ||
attr == dwarf2reader::DW_AT_addr_base) attr == DW_AT_addr_base)
ProcessAttributeUnsigned(dieoffset, attr, form, ProcessAttributeUnsigned(dieoffset, attr, form,
reader_->ReadOffset(start)); reader_->ReadOffset(start));
else else
@ -3414,4 +3414,4 @@ void CallFrameInfo::Reporter::ClearingCFARule(uint64_t offset,
section_.c_str(), insn_offset); section_.c_str(), insn_offset);
} }
} // namespace dwarf2reader } // namespace google_breakpad

View file

@ -56,7 +56,7 @@
#include "common/using_std_string.h" #include "common/using_std_string.h"
#include "common/dwarf/elf_reader.h" #include "common/dwarf/elf_reader.h"
namespace dwarf2reader { namespace google_breakpad {
struct LineStateMachine; struct LineStateMachine;
class Dwarf2Handler; class Dwarf2Handler;
class LineInfoHandler; class LineInfoHandler;
@ -1489,6 +1489,6 @@ class CallFrameInfo::Reporter {
string section_; string section_;
}; };
} // namespace dwarf2reader } // namespace google_breakpad
#endif // UTIL_DEBUGINFO_DWARF2READER_H__ #endif // UTIL_DEBUGINFO_DWARF2READER_H__

View file

@ -29,7 +29,7 @@
// Original author: Jim Blandy <jimb@mozilla.com> <jimb@red-bean.com> // Original author: Jim Blandy <jimb@mozilla.com> <jimb@red-bean.com>
// dwarf2reader_cfi_unittest.cc: Unit tests for dwarf2reader::CallFrameInfo // dwarf2reader_cfi_unittest.cc: Unit tests for google_breakpad::CallFrameInfo
#include <stdint.h> #include <stdint.h>
#include <stdlib.h> #include <stdlib.h>
@ -72,11 +72,11 @@ using google_breakpad::test_assembler::kBigEndian;
using google_breakpad::test_assembler::kLittleEndian; using google_breakpad::test_assembler::kLittleEndian;
using google_breakpad::test_assembler::Section; using google_breakpad::test_assembler::Section;
using dwarf2reader::DwarfPointerEncoding; using google_breakpad::DwarfPointerEncoding;
using dwarf2reader::ENDIANNESS_BIG; using google_breakpad::ENDIANNESS_BIG;
using dwarf2reader::ENDIANNESS_LITTLE; using google_breakpad::ENDIANNESS_LITTLE;
using dwarf2reader::ByteReader; using google_breakpad::ByteReader;
using dwarf2reader::CallFrameInfo; using google_breakpad::CallFrameInfo;
using std::vector; using std::vector;
using testing::InSequence; using testing::InSequence;
@ -306,7 +306,7 @@ TEST_F(CFI, BadId32) {
TEST_F(CFI, SingleCIE) { TEST_F(CFI, SingleCIE) {
CFISection section(kLittleEndian, 4); CFISection section(kLittleEndian, 4);
section.CIEHeader(0xffe799a8, 0x3398dcdd, 0x6e9683de, 3, ""); section.CIEHeader(0xffe799a8, 0x3398dcdd, 0x6e9683de, 3, "");
section.Append(10, dwarf2reader::DW_CFA_nop); section.Append(10, google_breakpad::DW_CFA_nop);
section.FinishEntry(); section.FinishEntry();
PERHAPS_WRITE_DEBUG_FRAME_FILE("SingleCIE", section); PERHAPS_WRITE_DEBUG_FRAME_FILE("SingleCIE", section);
@ -763,7 +763,7 @@ struct CFIInsnFixture: public CFIFixture {
.Mark(&cie_label) .Mark(&cie_label)
.CIEHeader(code_factor, data_factor, return_register, version, .CIEHeader(code_factor, data_factor, return_register, version,
"") "")
.D8(dwarf2reader::DW_CFA_def_cfa) .D8(google_breakpad::DW_CFA_def_cfa)
.ULEB128(cfa_base_register) .ULEB128(cfa_base_register)
.ULEB128(cfa_offset) .ULEB128(cfa_offset)
.FinishEntry(); .FinishEntry();
@ -788,7 +788,7 @@ struct CFIInsnFixture: public CFIFixture {
void ParseSection(CFISection *section, bool succeeds = true) { void ParseSection(CFISection *section, bool succeeds = true) {
string contents; string contents;
EXPECT_TRUE(section->GetContents(&contents)); EXPECT_TRUE(section->GetContents(&contents));
dwarf2reader::Endianness endianness; google_breakpad::Endianness endianness;
if (section->endianness() == kBigEndian) if (section->endianness() == kBigEndian)
endianness = ENDIANNESS_BIG; endianness = ENDIANNESS_BIG;
else { else {
@ -823,10 +823,10 @@ TEST_F(CFIInsn, DW_CFA_set_loc) {
CFISection section(kBigEndian, 4); CFISection section(kBigEndian, 4);
StockCIEAndFDE(&section); StockCIEAndFDE(&section);
section section
.D8(dwarf2reader::DW_CFA_set_loc).D32(0xb1ee3e7a) .D8(google_breakpad::DW_CFA_set_loc).D32(0xb1ee3e7a)
// Use DW_CFA_def_cfa to force a handler call that we can use to // Use DW_CFA_def_cfa to force a handler call that we can use to
// check the effect of the DW_CFA_set_loc. // check the effect of the DW_CFA_set_loc.
.D8(dwarf2reader::DW_CFA_def_cfa).ULEB128(0x4defb431).ULEB128(0x6d17b0ee) .D8(google_breakpad::DW_CFA_def_cfa).ULEB128(0x4defb431).ULEB128(0x6d17b0ee)
.FinishEntry(); .FinishEntry();
PERHAPS_WRITE_DEBUG_FRAME_FILE("DW_CFA_set_loc", section); PERHAPS_WRITE_DEBUG_FRAME_FILE("DW_CFA_set_loc", section);
@ -844,10 +844,10 @@ TEST_F(CFIInsn, DW_CFA_advance_loc) {
CFISection section(kBigEndian, 8); CFISection section(kBigEndian, 8);
StockCIEAndFDE(&section); StockCIEAndFDE(&section);
section section
.D8(dwarf2reader::DW_CFA_advance_loc | 0x2a) .D8(google_breakpad::DW_CFA_advance_loc | 0x2a)
// Use DW_CFA_def_cfa to force a handler call that we can use to // Use DW_CFA_def_cfa to force a handler call that we can use to
// check the effect of the DW_CFA_advance_loc. // check the effect of the DW_CFA_advance_loc.
.D8(dwarf2reader::DW_CFA_def_cfa).ULEB128(0x5bbb3715).ULEB128(0x0186c7bf) .D8(google_breakpad::DW_CFA_def_cfa).ULEB128(0x5bbb3715).ULEB128(0x0186c7bf)
.FinishEntry(); .FinishEntry();
PERHAPS_WRITE_DEBUG_FRAME_FILE("DW_CFA_advance_loc", section); PERHAPS_WRITE_DEBUG_FRAME_FILE("DW_CFA_advance_loc", section);
@ -866,8 +866,8 @@ TEST_F(CFIInsn, DW_CFA_advance_loc1) {
CFISection section(kLittleEndian, 8); CFISection section(kLittleEndian, 8);
StockCIEAndFDE(&section); StockCIEAndFDE(&section);
section section
.D8(dwarf2reader::DW_CFA_advance_loc1).D8(0xd8) .D8(google_breakpad::DW_CFA_advance_loc1).D8(0xd8)
.D8(dwarf2reader::DW_CFA_def_cfa).ULEB128(0x69d5696a).ULEB128(0x1eb7fc93) .D8(google_breakpad::DW_CFA_def_cfa).ULEB128(0x69d5696a).ULEB128(0x1eb7fc93)
.FinishEntry(); .FinishEntry();
PERHAPS_WRITE_DEBUG_FRAME_FILE("DW_CFA_advance_loc1", section); PERHAPS_WRITE_DEBUG_FRAME_FILE("DW_CFA_advance_loc1", section);
@ -886,8 +886,8 @@ TEST_F(CFIInsn, DW_CFA_advance_loc2) {
CFISection section(kLittleEndian, 4); CFISection section(kLittleEndian, 4);
StockCIEAndFDE(&section); StockCIEAndFDE(&section);
section section
.D8(dwarf2reader::DW_CFA_advance_loc2).D16(0x3adb) .D8(google_breakpad::DW_CFA_advance_loc2).D16(0x3adb)
.D8(dwarf2reader::DW_CFA_def_cfa).ULEB128(0x3a368bed).ULEB128(0x3194ee37) .D8(google_breakpad::DW_CFA_def_cfa).ULEB128(0x3a368bed).ULEB128(0x3194ee37)
.FinishEntry(); .FinishEntry();
PERHAPS_WRITE_DEBUG_FRAME_FILE("DW_CFA_advance_loc2", section); PERHAPS_WRITE_DEBUG_FRAME_FILE("DW_CFA_advance_loc2", section);
@ -906,8 +906,8 @@ TEST_F(CFIInsn, DW_CFA_advance_loc4) {
CFISection section(kBigEndian, 8); CFISection section(kBigEndian, 8);
StockCIEAndFDE(&section); StockCIEAndFDE(&section);
section section
.D8(dwarf2reader::DW_CFA_advance_loc4).D32(0x15813c88) .D8(google_breakpad::DW_CFA_advance_loc4).D32(0x15813c88)
.D8(dwarf2reader::DW_CFA_def_cfa).ULEB128(0x135270c5).ULEB128(0x24bad7cb) .D8(google_breakpad::DW_CFA_def_cfa).ULEB128(0x135270c5).ULEB128(0x24bad7cb)
.FinishEntry(); .FinishEntry();
PERHAPS_WRITE_DEBUG_FRAME_FILE("DW_CFA_advance_loc4", section); PERHAPS_WRITE_DEBUG_FRAME_FILE("DW_CFA_advance_loc4", section);
@ -927,8 +927,8 @@ TEST_F(CFIInsn, DW_CFA_MIPS_advance_loc8) {
CFISection section(kBigEndian, 8); CFISection section(kBigEndian, 8);
StockCIEAndFDE(&section); StockCIEAndFDE(&section);
section section
.D8(dwarf2reader::DW_CFA_MIPS_advance_loc8).D64(0x3c4f3945b92c14ULL) .D8(google_breakpad::DW_CFA_MIPS_advance_loc8).D64(0x3c4f3945b92c14ULL)
.D8(dwarf2reader::DW_CFA_def_cfa).ULEB128(0xe17ed602).ULEB128(0x3d162e7f) .D8(google_breakpad::DW_CFA_def_cfa).ULEB128(0xe17ed602).ULEB128(0x3d162e7f)
.FinishEntry(); .FinishEntry();
PERHAPS_WRITE_DEBUG_FRAME_FILE("DW_CFA_advance_loc8", section); PERHAPS_WRITE_DEBUG_FRAME_FILE("DW_CFA_advance_loc8", section);
@ -947,7 +947,7 @@ TEST_F(CFIInsn, DW_CFA_def_cfa) {
CFISection section(kLittleEndian, 4); CFISection section(kLittleEndian, 4);
StockCIEAndFDE(&section); StockCIEAndFDE(&section);
section section
.D8(dwarf2reader::DW_CFA_def_cfa).ULEB128(0x4e363a85).ULEB128(0x815f9aa7) .D8(google_breakpad::DW_CFA_def_cfa).ULEB128(0x4e363a85).ULEB128(0x815f9aa7)
.FinishEntry(); .FinishEntry();
PERHAPS_WRITE_DEBUG_FRAME_FILE("DW_CFA_def_cfa", section); PERHAPS_WRITE_DEBUG_FRAME_FILE("DW_CFA_def_cfa", section);
@ -964,8 +964,8 @@ TEST_F(CFIInsn, DW_CFA_def_cfa_sf) {
CFISection section(kBigEndian, 4); CFISection section(kBigEndian, 4);
StockCIEAndFDE(&section); StockCIEAndFDE(&section);
section section
.D8(dwarf2reader::DW_CFA_def_cfa_sf).ULEB128(0x8ccb32b7).LEB128(0x9ea) .D8(google_breakpad::DW_CFA_def_cfa_sf).ULEB128(0x8ccb32b7).LEB128(0x9ea)
.D8(dwarf2reader::DW_CFA_def_cfa_sf).ULEB128(0x9b40f5da).LEB128(-0x40a2) .D8(google_breakpad::DW_CFA_def_cfa_sf).ULEB128(0x9b40f5da).LEB128(-0x40a2)
.FinishEntry(); .FinishEntry();
EXPECT_CALL(handler, EXPECT_CALL(handler,
@ -985,7 +985,7 @@ TEST_F(CFIInsn, DW_CFA_def_cfa_register) {
CFISection section(kLittleEndian, 8); CFISection section(kLittleEndian, 8);
StockCIEAndFDE(&section); StockCIEAndFDE(&section);
section section
.D8(dwarf2reader::DW_CFA_def_cfa_register).ULEB128(0x3e7e9363) .D8(google_breakpad::DW_CFA_def_cfa_register).ULEB128(0x3e7e9363)
.FinishEntry(); .FinishEntry();
EXPECT_CALL(handler, EXPECT_CALL(handler,
@ -1002,8 +1002,8 @@ TEST_F(CFIInsn, DW_CFA_def_cfa_registerBadRule) {
CFISection section(kBigEndian, 4); CFISection section(kBigEndian, 4);
StockCIEAndFDE(&section); StockCIEAndFDE(&section);
section section
.D8(dwarf2reader::DW_CFA_def_cfa_expression).Block("needle in a haystack") .D8(google_breakpad::DW_CFA_def_cfa_expression).Block("needle in a haystack")
.D8(dwarf2reader::DW_CFA_def_cfa_register).ULEB128(0xf1b49e49) .D8(google_breakpad::DW_CFA_def_cfa_register).ULEB128(0xf1b49e49)
.FinishEntry(); .FinishEntry();
EXPECT_CALL(handler, EXPECT_CALL(handler,
@ -1019,7 +1019,7 @@ TEST_F(CFIInsn, DW_CFA_def_cfa_offset) {
CFISection section(kBigEndian, 4); CFISection section(kBigEndian, 4);
StockCIEAndFDE(&section); StockCIEAndFDE(&section);
section section
.D8(dwarf2reader::DW_CFA_def_cfa_offset).ULEB128(0x1e8e3b9b) .D8(google_breakpad::DW_CFA_def_cfa_offset).ULEB128(0x1e8e3b9b)
.FinishEntry(); .FinishEntry();
EXPECT_CALL(handler, EXPECT_CALL(handler,
@ -1035,8 +1035,8 @@ TEST_F(CFIInsn, DW_CFA_def_cfa_offset_sf) {
CFISection section(kLittleEndian, 4); CFISection section(kLittleEndian, 4);
StockCIEAndFDE(&section); StockCIEAndFDE(&section);
section section
.D8(dwarf2reader::DW_CFA_def_cfa_offset_sf).LEB128(0x970) .D8(google_breakpad::DW_CFA_def_cfa_offset_sf).LEB128(0x970)
.D8(dwarf2reader::DW_CFA_def_cfa_offset_sf).LEB128(-0x2cd) .D8(google_breakpad::DW_CFA_def_cfa_offset_sf).LEB128(-0x2cd)
.FinishEntry(); .FinishEntry();
EXPECT_CALL(handler, EXPECT_CALL(handler,
@ -1058,8 +1058,8 @@ TEST_F(CFIInsn, DW_CFA_def_cfa_offsetBadRule) {
CFISection section(kBigEndian, 4); CFISection section(kBigEndian, 4);
StockCIEAndFDE(&section); StockCIEAndFDE(&section);
section section
.D8(dwarf2reader::DW_CFA_def_cfa_expression).Block("six ways to Sunday") .D8(google_breakpad::DW_CFA_def_cfa_expression).Block("six ways to Sunday")
.D8(dwarf2reader::DW_CFA_def_cfa_offset).ULEB128(0x1e8e3b9b) .D8(google_breakpad::DW_CFA_def_cfa_offset).ULEB128(0x1e8e3b9b)
.FinishEntry(); .FinishEntry();
EXPECT_CALL(handler, EXPECT_CALL(handler,
@ -1074,7 +1074,7 @@ TEST_F(CFIInsn, DW_CFA_def_cfa_expression) {
CFISection section(kLittleEndian, 8); CFISection section(kLittleEndian, 8);
StockCIEAndFDE(&section); StockCIEAndFDE(&section);
section section
.D8(dwarf2reader::DW_CFA_def_cfa_expression).Block("eating crow") .D8(google_breakpad::DW_CFA_def_cfa_expression).Block("eating crow")
.FinishEntry(); .FinishEntry();
EXPECT_CALL(handler, ValExpressionRule(fde_start, kCFARegister, EXPECT_CALL(handler, ValExpressionRule(fde_start, kCFARegister,
@ -1089,7 +1089,7 @@ TEST_F(CFIInsn, DW_CFA_undefined) {
CFISection section(kLittleEndian, 4); CFISection section(kLittleEndian, 4);
StockCIEAndFDE(&section); StockCIEAndFDE(&section);
section section
.D8(dwarf2reader::DW_CFA_undefined).ULEB128(0x300ce45d) .D8(google_breakpad::DW_CFA_undefined).ULEB128(0x300ce45d)
.FinishEntry(); .FinishEntry();
EXPECT_CALL(handler, UndefinedRule(fde_start, 0x300ce45d)) EXPECT_CALL(handler, UndefinedRule(fde_start, 0x300ce45d))
@ -1103,7 +1103,7 @@ TEST_F(CFIInsn, DW_CFA_same_value) {
CFISection section(kLittleEndian, 4); CFISection section(kLittleEndian, 4);
StockCIEAndFDE(&section); StockCIEAndFDE(&section);
section section
.D8(dwarf2reader::DW_CFA_same_value).ULEB128(0x3865a760) .D8(google_breakpad::DW_CFA_same_value).ULEB128(0x3865a760)
.FinishEntry(); .FinishEntry();
EXPECT_CALL(handler, SameValueRule(fde_start, 0x3865a760)) EXPECT_CALL(handler, SameValueRule(fde_start, 0x3865a760))
@ -1117,7 +1117,7 @@ TEST_F(CFIInsn, DW_CFA_offset) {
CFISection section(kBigEndian, 4); CFISection section(kBigEndian, 4);
StockCIEAndFDE(&section); StockCIEAndFDE(&section);
section section
.D8(dwarf2reader::DW_CFA_offset | 0x2c).ULEB128(0x9f6) .D8(google_breakpad::DW_CFA_offset | 0x2c).ULEB128(0x9f6)
.FinishEntry(); .FinishEntry();
EXPECT_CALL(handler, EXPECT_CALL(handler,
@ -1132,7 +1132,7 @@ TEST_F(CFIInsn, DW_CFA_offset_extended) {
CFISection section(kBigEndian, 4); CFISection section(kBigEndian, 4);
StockCIEAndFDE(&section); StockCIEAndFDE(&section);
section section
.D8(dwarf2reader::DW_CFA_offset_extended).ULEB128(0x402b).ULEB128(0xb48) .D8(google_breakpad::DW_CFA_offset_extended).ULEB128(0x402b).ULEB128(0xb48)
.FinishEntry(); .FinishEntry();
EXPECT_CALL(handler, EXPECT_CALL(handler,
@ -1147,9 +1147,9 @@ TEST_F(CFIInsn, DW_CFA_offset_extended_sf) {
CFISection section(kBigEndian, 8); CFISection section(kBigEndian, 8);
StockCIEAndFDE(&section); StockCIEAndFDE(&section);
section section
.D8(dwarf2reader::DW_CFA_offset_extended_sf) .D8(google_breakpad::DW_CFA_offset_extended_sf)
.ULEB128(0x997c23ee).LEB128(0x2d00) .ULEB128(0x997c23ee).LEB128(0x2d00)
.D8(dwarf2reader::DW_CFA_offset_extended_sf) .D8(google_breakpad::DW_CFA_offset_extended_sf)
.ULEB128(0x9519eb82).LEB128(-0xa77) .ULEB128(0x9519eb82).LEB128(-0xa77)
.FinishEntry(); .FinishEntry();
@ -1170,7 +1170,7 @@ TEST_F(CFIInsn, DW_CFA_val_offset) {
CFISection section(kBigEndian, 4); CFISection section(kBigEndian, 4);
StockCIEAndFDE(&section); StockCIEAndFDE(&section);
section section
.D8(dwarf2reader::DW_CFA_val_offset).ULEB128(0x623562fe).ULEB128(0x673) .D8(google_breakpad::DW_CFA_val_offset).ULEB128(0x623562fe).ULEB128(0x673)
.FinishEntry(); .FinishEntry();
EXPECT_CALL(handler, EXPECT_CALL(handler,
@ -1186,8 +1186,8 @@ TEST_F(CFIInsn, DW_CFA_val_offset_sf) {
CFISection section(kBigEndian, 4); CFISection section(kBigEndian, 4);
StockCIEAndFDE(&section); StockCIEAndFDE(&section);
section section
.D8(dwarf2reader::DW_CFA_val_offset_sf).ULEB128(0x6f4f).LEB128(0xaab) .D8(google_breakpad::DW_CFA_val_offset_sf).ULEB128(0x6f4f).LEB128(0xaab)
.D8(dwarf2reader::DW_CFA_val_offset_sf).ULEB128(0x2483).LEB128(-0x8a2) .D8(google_breakpad::DW_CFA_val_offset_sf).ULEB128(0x2483).LEB128(-0x8a2)
.FinishEntry(); .FinishEntry();
EXPECT_CALL(handler, EXPECT_CALL(handler,
@ -1207,7 +1207,7 @@ TEST_F(CFIInsn, DW_CFA_register) {
CFISection section(kLittleEndian, 8); CFISection section(kLittleEndian, 8);
StockCIEAndFDE(&section); StockCIEAndFDE(&section);
section section
.D8(dwarf2reader::DW_CFA_register).ULEB128(0x278d18f9).ULEB128(0x1a684414) .D8(google_breakpad::DW_CFA_register).ULEB128(0x278d18f9).ULEB128(0x1a684414)
.FinishEntry(); .FinishEntry();
EXPECT_CALL(handler, RegisterRule(fde_start, 0x278d18f9, 0x1a684414)) EXPECT_CALL(handler, RegisterRule(fde_start, 0x278d18f9, 0x1a684414))
@ -1221,7 +1221,7 @@ TEST_F(CFIInsn, DW_CFA_expression) {
CFISection section(kBigEndian, 8); CFISection section(kBigEndian, 8);
StockCIEAndFDE(&section); StockCIEAndFDE(&section);
section section
.D8(dwarf2reader::DW_CFA_expression).ULEB128(0xa1619fb2) .D8(google_breakpad::DW_CFA_expression).ULEB128(0xa1619fb2)
.Block("plus ça change, plus c'est la même chose") .Block("plus ça change, plus c'est la même chose")
.FinishEntry(); .FinishEntry();
@ -1238,7 +1238,7 @@ TEST_F(CFIInsn, DW_CFA_val_expression) {
CFISection section(kBigEndian, 4); CFISection section(kBigEndian, 4);
StockCIEAndFDE(&section); StockCIEAndFDE(&section);
section section
.D8(dwarf2reader::DW_CFA_val_expression).ULEB128(0xc5e4a9e3) .D8(google_breakpad::DW_CFA_val_expression).ULEB128(0xc5e4a9e3)
.Block("he who has the gold makes the rules") .Block("he who has the gold makes the rules")
.FinishEntry(); .FinishEntry();
@ -1265,18 +1265,18 @@ TEST_F(CFIInsn, DW_CFA_restore) {
.CIEHeader(code_factor, data_factor, return_register, version, .CIEHeader(code_factor, data_factor, return_register, version,
"") "")
// Provide a CFA rule, because register rules require them. // Provide a CFA rule, because register rules require them.
.D8(dwarf2reader::DW_CFA_def_cfa).ULEB128(0x6ca1d50e).ULEB128(0x372e38e8) .D8(google_breakpad::DW_CFA_def_cfa).ULEB128(0x6ca1d50e).ULEB128(0x372e38e8)
// Provide an offset(N) rule for register 0x3c. // Provide an offset(N) rule for register 0x3c.
.D8(dwarf2reader::DW_CFA_offset | 0x3c).ULEB128(0xb348) .D8(google_breakpad::DW_CFA_offset | 0x3c).ULEB128(0xb348)
.FinishEntry() .FinishEntry()
// In the FDE... // In the FDE...
.FDEHeader(cie, fde_start, fde_size) .FDEHeader(cie, fde_start, fde_size)
// At a second address, provide a new offset(N) rule for register 0x3c. // At a second address, provide a new offset(N) rule for register 0x3c.
.D8(dwarf2reader::DW_CFA_advance_loc | 0x13) .D8(google_breakpad::DW_CFA_advance_loc | 0x13)
.D8(dwarf2reader::DW_CFA_offset | 0x3c).ULEB128(0x9a50) .D8(google_breakpad::DW_CFA_offset | 0x3c).ULEB128(0x9a50)
// At a third address, restore the original rule for register 0x3c. // At a third address, restore the original rule for register 0x3c.
.D8(dwarf2reader::DW_CFA_advance_loc | 0x01) .D8(google_breakpad::DW_CFA_advance_loc | 0x01)
.D8(dwarf2reader::DW_CFA_restore | 0x3c) .D8(google_breakpad::DW_CFA_restore | 0x3c)
.FinishEntry(); .FinishEntry();
{ {
@ -1321,16 +1321,16 @@ TEST_F(CFIInsn, DW_CFA_restoreNoRule) {
.Mark(&cie) .Mark(&cie)
.CIEHeader(code_factor, data_factor, return_register, version, "") .CIEHeader(code_factor, data_factor, return_register, version, "")
// Provide a CFA rule, because register rules require them. // Provide a CFA rule, because register rules require them.
.D8(dwarf2reader::DW_CFA_def_cfa).ULEB128(0x470aa334).ULEB128(0x099ef127) .D8(google_breakpad::DW_CFA_def_cfa).ULEB128(0x470aa334).ULEB128(0x099ef127)
.FinishEntry() .FinishEntry()
// In the FDE... // In the FDE...
.FDEHeader(cie, fde_start, fde_size) .FDEHeader(cie, fde_start, fde_size)
// At a second address, provide an offset(N) rule for register 0x2c. // At a second address, provide an offset(N) rule for register 0x2c.
.D8(dwarf2reader::DW_CFA_advance_loc | 0x7) .D8(google_breakpad::DW_CFA_advance_loc | 0x7)
.D8(dwarf2reader::DW_CFA_offset | 0x2c).ULEB128(0x1f47) .D8(google_breakpad::DW_CFA_offset | 0x2c).ULEB128(0x1f47)
// At a third address, restore the (missing) CIE rule for register 0x2c. // At a third address, restore the (missing) CIE rule for register 0x2c.
.D8(dwarf2reader::DW_CFA_advance_loc | 0xb) .D8(google_breakpad::DW_CFA_advance_loc | 0xb)
.D8(dwarf2reader::DW_CFA_restore | 0x2c) .D8(google_breakpad::DW_CFA_restore | 0x2c)
.FinishEntry(); .FinishEntry();
{ {
@ -1371,20 +1371,20 @@ TEST_F(CFIInsn, DW_CFA_restore_extended) {
.CIEHeader(code_factor, data_factor, return_register, version, .CIEHeader(code_factor, data_factor, return_register, version,
"", true /* dwarf64 */ ) "", true /* dwarf64 */ )
// Provide a CFA rule, because register rules require them. // Provide a CFA rule, because register rules require them.
.D8(dwarf2reader::DW_CFA_def_cfa).ULEB128(0x56fa0edd).ULEB128(0x097f78a5) .D8(google_breakpad::DW_CFA_def_cfa).ULEB128(0x56fa0edd).ULEB128(0x097f78a5)
// Provide an offset(N) rule for register 0x0f9b8a1c. // Provide an offset(N) rule for register 0x0f9b8a1c.
.D8(dwarf2reader::DW_CFA_offset_extended) .D8(google_breakpad::DW_CFA_offset_extended)
.ULEB128(0x0f9b8a1c).ULEB128(0xc979) .ULEB128(0x0f9b8a1c).ULEB128(0xc979)
.FinishEntry() .FinishEntry()
// In the FDE... // In the FDE...
.FDEHeader(cie, fde_start, fde_size) .FDEHeader(cie, fde_start, fde_size)
// At a second address, provide a new offset(N) rule for reg 0x0f9b8a1c. // At a second address, provide a new offset(N) rule for reg 0x0f9b8a1c.
.D8(dwarf2reader::DW_CFA_advance_loc | 0x3) .D8(google_breakpad::DW_CFA_advance_loc | 0x3)
.D8(dwarf2reader::DW_CFA_offset_extended) .D8(google_breakpad::DW_CFA_offset_extended)
.ULEB128(0x0f9b8a1c).ULEB128(0x3b7b) .ULEB128(0x0f9b8a1c).ULEB128(0x3b7b)
// At a third address, restore the original rule for register 0x0f9b8a1c. // At a third address, restore the original rule for register 0x0f9b8a1c.
.D8(dwarf2reader::DW_CFA_advance_loc | 0x04) .D8(google_breakpad::DW_CFA_advance_loc | 0x04)
.D8(dwarf2reader::DW_CFA_restore_extended).ULEB128(0x0f9b8a1c) .D8(google_breakpad::DW_CFA_restore_extended).ULEB128(0x0f9b8a1c)
.FinishEntry(); .FinishEntry();
{ {
@ -1433,21 +1433,21 @@ TEST_F(CFIInsn, DW_CFA_remember_and_restore_state) {
// 5 offset(N) no rule new "same value" rule // 5 offset(N) no rule new "same value" rule
section section
// Create the "incoming" state, which we will save and later restore. // Create the "incoming" state, which we will save and later restore.
.D8(dwarf2reader::DW_CFA_offset | 2).ULEB128(0x9806) .D8(google_breakpad::DW_CFA_offset | 2).ULEB128(0x9806)
.D8(dwarf2reader::DW_CFA_offset | 3).ULEB128(0x995d) .D8(google_breakpad::DW_CFA_offset | 3).ULEB128(0x995d)
.D8(dwarf2reader::DW_CFA_offset | 4).ULEB128(0x7055) .D8(google_breakpad::DW_CFA_offset | 4).ULEB128(0x7055)
.D8(dwarf2reader::DW_CFA_remember_state) .D8(google_breakpad::DW_CFA_remember_state)
// Advance to a new instruction; an implementation could legitimately // Advance to a new instruction; an implementation could legitimately
// ignore all but the final rule for a given register at a given address. // ignore all but the final rule for a given register at a given address.
.D8(dwarf2reader::DW_CFA_advance_loc | 1) .D8(google_breakpad::DW_CFA_advance_loc | 1)
// Create the "outgoing" state, which we will discard. // Create the "outgoing" state, which we will discard.
.D8(dwarf2reader::DW_CFA_offset | 1).ULEB128(0xea1a) .D8(google_breakpad::DW_CFA_offset | 1).ULEB128(0xea1a)
.D8(dwarf2reader::DW_CFA_register).ULEB128(2).ULEB128(0x1d2a3767) .D8(google_breakpad::DW_CFA_register).ULEB128(2).ULEB128(0x1d2a3767)
.D8(dwarf2reader::DW_CFA_offset | 3).ULEB128(0xdd29) .D8(google_breakpad::DW_CFA_offset | 3).ULEB128(0xdd29)
.D8(dwarf2reader::DW_CFA_offset | 5).ULEB128(0xf1ce) .D8(google_breakpad::DW_CFA_offset | 5).ULEB128(0xf1ce)
// At a third address, restore the incoming state. // At a third address, restore the incoming state.
.D8(dwarf2reader::DW_CFA_advance_loc | 1) .D8(google_breakpad::DW_CFA_advance_loc | 1)
.D8(dwarf2reader::DW_CFA_restore_state) .D8(google_breakpad::DW_CFA_restore_state)
.FinishEntry(); .FinishEntry();
uint64_t addr = fde_start; uint64_t addr = fde_start;
@ -1496,11 +1496,11 @@ TEST_F(CFIInsn, DW_CFA_remember_and_restore_stateCFA) {
StockCIEAndFDE(&section); StockCIEAndFDE(&section);
section section
.D8(dwarf2reader::DW_CFA_remember_state) .D8(google_breakpad::DW_CFA_remember_state)
.D8(dwarf2reader::DW_CFA_advance_loc | 1) .D8(google_breakpad::DW_CFA_advance_loc | 1)
.D8(dwarf2reader::DW_CFA_def_cfa_offset).ULEB128(0x90481102) .D8(google_breakpad::DW_CFA_def_cfa_offset).ULEB128(0x90481102)
.D8(dwarf2reader::DW_CFA_advance_loc | 1) .D8(google_breakpad::DW_CFA_advance_loc | 1)
.D8(dwarf2reader::DW_CFA_restore_state) .D8(google_breakpad::DW_CFA_restore_state)
.FinishEntry(); .FinishEntry();
EXPECT_CALL(handler, ValOffsetRule(fde_start + code_factor, kCFARegister, EXPECT_CALL(handler, ValOffsetRule(fde_start + code_factor, kCFARegister,
@ -1519,9 +1519,9 @@ TEST_F(CFIInsn, DW_CFA_nop) {
CFISection section(kLittleEndian, 4); CFISection section(kLittleEndian, 4);
StockCIEAndFDE(&section); StockCIEAndFDE(&section);
section section
.D8(dwarf2reader::DW_CFA_nop) .D8(google_breakpad::DW_CFA_nop)
.D8(dwarf2reader::DW_CFA_def_cfa).ULEB128(0x3fb8d4f1).ULEB128(0x078dc67b) .D8(google_breakpad::DW_CFA_def_cfa).ULEB128(0x3fb8d4f1).ULEB128(0x078dc67b)
.D8(dwarf2reader::DW_CFA_nop) .D8(google_breakpad::DW_CFA_nop)
.FinishEntry(); .FinishEntry();
EXPECT_CALL(handler, EXPECT_CALL(handler,
@ -1536,7 +1536,7 @@ TEST_F(CFIInsn, DW_CFA_GNU_window_save) {
CFISection section(kBigEndian, 4); CFISection section(kBigEndian, 4);
StockCIEAndFDE(&section); StockCIEAndFDE(&section);
section section
.D8(dwarf2reader::DW_CFA_GNU_window_save) .D8(google_breakpad::DW_CFA_GNU_window_save)
.FinishEntry(); .FinishEntry();
// Don't include all the rules in any particular sequence. // Don't include all the rules in any particular sequence.
@ -1561,9 +1561,9 @@ TEST_F(CFIInsn, DW_CFA_GNU_args_size) {
CFISection section(kLittleEndian, 8); CFISection section(kLittleEndian, 8);
StockCIEAndFDE(&section); StockCIEAndFDE(&section);
section section
.D8(dwarf2reader::DW_CFA_GNU_args_size).ULEB128(0xeddfa520) .D8(google_breakpad::DW_CFA_GNU_args_size).ULEB128(0xeddfa520)
// Verify that we see this, meaning we parsed the above properly. // Verify that we see this, meaning we parsed the above properly.
.D8(dwarf2reader::DW_CFA_offset | 0x23).ULEB128(0x269) .D8(google_breakpad::DW_CFA_offset | 0x23).ULEB128(0x269)
.FinishEntry(); .FinishEntry();
EXPECT_CALL(handler, EXPECT_CALL(handler,
@ -1578,7 +1578,7 @@ TEST_F(CFIInsn, DW_CFA_GNU_negative_offset_extended) {
CFISection section(kLittleEndian, 4); CFISection section(kLittleEndian, 4);
StockCIEAndFDE(&section); StockCIEAndFDE(&section);
section section
.D8(dwarf2reader::DW_CFA_GNU_negative_offset_extended) .D8(google_breakpad::DW_CFA_GNU_negative_offset_extended)
.ULEB128(0x430cc87a).ULEB128(0x613) .ULEB128(0x430cc87a).ULEB128(0x613)
.FinishEntry(); .FinishEntry();
@ -1599,19 +1599,19 @@ TEST_F(CFIInsn, SkipFDE) {
// CIE, used by all FDEs. // CIE, used by all FDEs.
.Mark(&cie) .Mark(&cie)
.CIEHeader(0x010269f2, 0x9177, 0xedca5849, 2, "") .CIEHeader(0x010269f2, 0x9177, 0xedca5849, 2, "")
.D8(dwarf2reader::DW_CFA_def_cfa).ULEB128(0x42ed390b).ULEB128(0x98f43aad) .D8(google_breakpad::DW_CFA_def_cfa).ULEB128(0x42ed390b).ULEB128(0x98f43aad)
.FinishEntry() .FinishEntry()
// First FDE. // First FDE.
.FDEHeader(cie, 0xa870ebdd, 0x60f6aa4) .FDEHeader(cie, 0xa870ebdd, 0x60f6aa4)
.D8(dwarf2reader::DW_CFA_register).ULEB128(0x3a860351).ULEB128(0x6c9a6bcf) .D8(google_breakpad::DW_CFA_register).ULEB128(0x3a860351).ULEB128(0x6c9a6bcf)
.FinishEntry() .FinishEntry()
// Second FDE. // Second FDE.
.FDEHeader(cie, 0xc534f7c0, 0xf6552e9, true /* dwarf64 */) .FDEHeader(cie, 0xc534f7c0, 0xf6552e9, true /* dwarf64 */)
.D8(dwarf2reader::DW_CFA_register).ULEB128(0x1b62c234).ULEB128(0x26586b18) .D8(google_breakpad::DW_CFA_register).ULEB128(0x1b62c234).ULEB128(0x26586b18)
.FinishEntry() .FinishEntry()
// Third FDE. // Third FDE.
.FDEHeader(cie, 0xf681cfc8, 0x7e4594e) .FDEHeader(cie, 0xf681cfc8, 0x7e4594e)
.D8(dwarf2reader::DW_CFA_register).ULEB128(0x26c53934).ULEB128(0x18eeb8a4) .D8(google_breakpad::DW_CFA_register).ULEB128(0x26c53934).ULEB128(0x18eeb8a4)
.FinishEntry(); .FinishEntry();
{ {
@ -1652,8 +1652,8 @@ TEST_F(CFIInsn, QuitMidentry) {
CFISection section(kLittleEndian, 8); CFISection section(kLittleEndian, 8);
StockCIEAndFDE(&section); StockCIEAndFDE(&section);
section section
.D8(dwarf2reader::DW_CFA_register).ULEB128(0xe0cf850d).ULEB128(0x15aab431) .D8(google_breakpad::DW_CFA_register).ULEB128(0xe0cf850d).ULEB128(0x15aab431)
.D8(dwarf2reader::DW_CFA_expression).ULEB128(0x46750aa5).Block("meat") .D8(google_breakpad::DW_CFA_expression).ULEB128(0x46750aa5).Block("meat")
.FinishEntry(); .FinishEntry();
EXPECT_CALL(handler, RegisterRule(fde_start, 0xe0cf850d, 0x15aab431)) EXPECT_CALL(handler, RegisterRule(fde_start, 0xe0cf850d, 0x15aab431))
@ -1670,10 +1670,10 @@ TEST_F(CFIRestore, RestoreUndefinedRuleUnchanged) {
CFISection section(kLittleEndian, 4); CFISection section(kLittleEndian, 4);
StockCIEAndFDE(&section); StockCIEAndFDE(&section);
section section
.D8(dwarf2reader::DW_CFA_undefined).ULEB128(0x0bac878e) .D8(google_breakpad::DW_CFA_undefined).ULEB128(0x0bac878e)
.D8(dwarf2reader::DW_CFA_remember_state) .D8(google_breakpad::DW_CFA_remember_state)
.D8(dwarf2reader::DW_CFA_advance_loc | 1) .D8(google_breakpad::DW_CFA_advance_loc | 1)
.D8(dwarf2reader::DW_CFA_restore_state) .D8(google_breakpad::DW_CFA_restore_state)
.FinishEntry(); .FinishEntry();
EXPECT_CALL(handler, UndefinedRule(fde_start, 0x0bac878e)) EXPECT_CALL(handler, UndefinedRule(fde_start, 0x0bac878e))
@ -1687,12 +1687,12 @@ TEST_F(CFIRestore, RestoreUndefinedRuleChanged) {
CFISection section(kLittleEndian, 4); CFISection section(kLittleEndian, 4);
StockCIEAndFDE(&section); StockCIEAndFDE(&section);
section section
.D8(dwarf2reader::DW_CFA_undefined).ULEB128(0x7dedff5f) .D8(google_breakpad::DW_CFA_undefined).ULEB128(0x7dedff5f)
.D8(dwarf2reader::DW_CFA_remember_state) .D8(google_breakpad::DW_CFA_remember_state)
.D8(dwarf2reader::DW_CFA_advance_loc | 1) .D8(google_breakpad::DW_CFA_advance_loc | 1)
.D8(dwarf2reader::DW_CFA_same_value).ULEB128(0x7dedff5f) .D8(google_breakpad::DW_CFA_same_value).ULEB128(0x7dedff5f)
.D8(dwarf2reader::DW_CFA_advance_loc | 1) .D8(google_breakpad::DW_CFA_advance_loc | 1)
.D8(dwarf2reader::DW_CFA_restore_state) .D8(google_breakpad::DW_CFA_restore_state)
.FinishEntry(); .FinishEntry();
EXPECT_CALL(handler, UndefinedRule(fde_start, 0x7dedff5f)) EXPECT_CALL(handler, UndefinedRule(fde_start, 0x7dedff5f))
@ -1710,10 +1710,10 @@ TEST_F(CFIRestore, RestoreSameValueRuleUnchanged) {
CFISection section(kLittleEndian, 4); CFISection section(kLittleEndian, 4);
StockCIEAndFDE(&section); StockCIEAndFDE(&section);
section section
.D8(dwarf2reader::DW_CFA_same_value).ULEB128(0xadbc9b3a) .D8(google_breakpad::DW_CFA_same_value).ULEB128(0xadbc9b3a)
.D8(dwarf2reader::DW_CFA_remember_state) .D8(google_breakpad::DW_CFA_remember_state)
.D8(dwarf2reader::DW_CFA_advance_loc | 1) .D8(google_breakpad::DW_CFA_advance_loc | 1)
.D8(dwarf2reader::DW_CFA_restore_state) .D8(google_breakpad::DW_CFA_restore_state)
.FinishEntry(); .FinishEntry();
EXPECT_CALL(handler, SameValueRule(fde_start, 0xadbc9b3a)) EXPECT_CALL(handler, SameValueRule(fde_start, 0xadbc9b3a))
@ -1727,12 +1727,12 @@ TEST_F(CFIRestore, RestoreSameValueRuleChanged) {
CFISection section(kLittleEndian, 4); CFISection section(kLittleEndian, 4);
StockCIEAndFDE(&section); StockCIEAndFDE(&section);
section section
.D8(dwarf2reader::DW_CFA_same_value).ULEB128(0x3d90dcb5) .D8(google_breakpad::DW_CFA_same_value).ULEB128(0x3d90dcb5)
.D8(dwarf2reader::DW_CFA_remember_state) .D8(google_breakpad::DW_CFA_remember_state)
.D8(dwarf2reader::DW_CFA_advance_loc | 1) .D8(google_breakpad::DW_CFA_advance_loc | 1)
.D8(dwarf2reader::DW_CFA_undefined).ULEB128(0x3d90dcb5) .D8(google_breakpad::DW_CFA_undefined).ULEB128(0x3d90dcb5)
.D8(dwarf2reader::DW_CFA_advance_loc | 1) .D8(google_breakpad::DW_CFA_advance_loc | 1)
.D8(dwarf2reader::DW_CFA_restore_state) .D8(google_breakpad::DW_CFA_restore_state)
.FinishEntry(); .FinishEntry();
EXPECT_CALL(handler, SameValueRule(fde_start, 0x3d90dcb5)) EXPECT_CALL(handler, SameValueRule(fde_start, 0x3d90dcb5))
@ -1750,10 +1750,10 @@ TEST_F(CFIRestore, RestoreOffsetRuleUnchanged) {
CFISection section(kLittleEndian, 4); CFISection section(kLittleEndian, 4);
StockCIEAndFDE(&section); StockCIEAndFDE(&section);
section section
.D8(dwarf2reader::DW_CFA_offset | 0x14).ULEB128(0xb6f) .D8(google_breakpad::DW_CFA_offset | 0x14).ULEB128(0xb6f)
.D8(dwarf2reader::DW_CFA_remember_state) .D8(google_breakpad::DW_CFA_remember_state)
.D8(dwarf2reader::DW_CFA_advance_loc | 1) .D8(google_breakpad::DW_CFA_advance_loc | 1)
.D8(dwarf2reader::DW_CFA_restore_state) .D8(google_breakpad::DW_CFA_restore_state)
.FinishEntry(); .FinishEntry();
EXPECT_CALL(handler, OffsetRule(fde_start, 0x14, EXPECT_CALL(handler, OffsetRule(fde_start, 0x14,
@ -1768,12 +1768,12 @@ TEST_F(CFIRestore, RestoreOffsetRuleChanged) {
CFISection section(kLittleEndian, 4); CFISection section(kLittleEndian, 4);
StockCIEAndFDE(&section); StockCIEAndFDE(&section);
section section
.D8(dwarf2reader::DW_CFA_offset | 0x21).ULEB128(0xeb7) .D8(google_breakpad::DW_CFA_offset | 0x21).ULEB128(0xeb7)
.D8(dwarf2reader::DW_CFA_remember_state) .D8(google_breakpad::DW_CFA_remember_state)
.D8(dwarf2reader::DW_CFA_advance_loc | 1) .D8(google_breakpad::DW_CFA_advance_loc | 1)
.D8(dwarf2reader::DW_CFA_undefined).ULEB128(0x21) .D8(google_breakpad::DW_CFA_undefined).ULEB128(0x21)
.D8(dwarf2reader::DW_CFA_advance_loc | 1) .D8(google_breakpad::DW_CFA_advance_loc | 1)
.D8(dwarf2reader::DW_CFA_restore_state) .D8(google_breakpad::DW_CFA_restore_state)
.FinishEntry(); .FinishEntry();
EXPECT_CALL(handler, OffsetRule(fde_start, 0x21, EXPECT_CALL(handler, OffsetRule(fde_start, 0x21,
@ -1793,12 +1793,12 @@ TEST_F(CFIRestore, RestoreOffsetRuleChangedOffset) {
CFISection section(kLittleEndian, 4); CFISection section(kLittleEndian, 4);
StockCIEAndFDE(&section); StockCIEAndFDE(&section);
section section
.D8(dwarf2reader::DW_CFA_offset | 0x21).ULEB128(0x134) .D8(google_breakpad::DW_CFA_offset | 0x21).ULEB128(0x134)
.D8(dwarf2reader::DW_CFA_remember_state) .D8(google_breakpad::DW_CFA_remember_state)
.D8(dwarf2reader::DW_CFA_advance_loc | 1) .D8(google_breakpad::DW_CFA_advance_loc | 1)
.D8(dwarf2reader::DW_CFA_offset | 0x21).ULEB128(0xf4f) .D8(google_breakpad::DW_CFA_offset | 0x21).ULEB128(0xf4f)
.D8(dwarf2reader::DW_CFA_advance_loc | 1) .D8(google_breakpad::DW_CFA_advance_loc | 1)
.D8(dwarf2reader::DW_CFA_restore_state) .D8(google_breakpad::DW_CFA_restore_state)
.FinishEntry(); .FinishEntry();
EXPECT_CALL(handler, OffsetRule(fde_start, 0x21, EXPECT_CALL(handler, OffsetRule(fde_start, 0x21,
@ -1819,10 +1819,10 @@ TEST_F(CFIRestore, RestoreValOffsetRuleUnchanged) {
CFISection section(kLittleEndian, 4); CFISection section(kLittleEndian, 4);
StockCIEAndFDE(&section); StockCIEAndFDE(&section);
section section
.D8(dwarf2reader::DW_CFA_val_offset).ULEB128(0x829caee6).ULEB128(0xe4c) .D8(google_breakpad::DW_CFA_val_offset).ULEB128(0x829caee6).ULEB128(0xe4c)
.D8(dwarf2reader::DW_CFA_remember_state) .D8(google_breakpad::DW_CFA_remember_state)
.D8(dwarf2reader::DW_CFA_advance_loc | 1) .D8(google_breakpad::DW_CFA_advance_loc | 1)
.D8(dwarf2reader::DW_CFA_restore_state) .D8(google_breakpad::DW_CFA_restore_state)
.FinishEntry(); .FinishEntry();
EXPECT_CALL(handler, ValOffsetRule(fde_start, 0x829caee6, EXPECT_CALL(handler, ValOffsetRule(fde_start, 0x829caee6,
@ -1837,12 +1837,12 @@ TEST_F(CFIRestore, RestoreValOffsetRuleChanged) {
CFISection section(kLittleEndian, 4); CFISection section(kLittleEndian, 4);
StockCIEAndFDE(&section); StockCIEAndFDE(&section);
section section
.D8(dwarf2reader::DW_CFA_val_offset).ULEB128(0xf17c36d6).ULEB128(0xeb7) .D8(google_breakpad::DW_CFA_val_offset).ULEB128(0xf17c36d6).ULEB128(0xeb7)
.D8(dwarf2reader::DW_CFA_remember_state) .D8(google_breakpad::DW_CFA_remember_state)
.D8(dwarf2reader::DW_CFA_advance_loc | 1) .D8(google_breakpad::DW_CFA_advance_loc | 1)
.D8(dwarf2reader::DW_CFA_undefined).ULEB128(0xf17c36d6) .D8(google_breakpad::DW_CFA_undefined).ULEB128(0xf17c36d6)
.D8(dwarf2reader::DW_CFA_advance_loc | 1) .D8(google_breakpad::DW_CFA_advance_loc | 1)
.D8(dwarf2reader::DW_CFA_restore_state) .D8(google_breakpad::DW_CFA_restore_state)
.FinishEntry(); .FinishEntry();
EXPECT_CALL(handler, ValOffsetRule(fde_start, 0xf17c36d6, EXPECT_CALL(handler, ValOffsetRule(fde_start, 0xf17c36d6,
@ -1862,12 +1862,12 @@ TEST_F(CFIRestore, RestoreValOffsetRuleChangedValOffset) {
CFISection section(kLittleEndian, 4); CFISection section(kLittleEndian, 4);
StockCIEAndFDE(&section); StockCIEAndFDE(&section);
section section
.D8(dwarf2reader::DW_CFA_val_offset).ULEB128(0x2cf0ab1b).ULEB128(0x562) .D8(google_breakpad::DW_CFA_val_offset).ULEB128(0x2cf0ab1b).ULEB128(0x562)
.D8(dwarf2reader::DW_CFA_remember_state) .D8(google_breakpad::DW_CFA_remember_state)
.D8(dwarf2reader::DW_CFA_advance_loc | 1) .D8(google_breakpad::DW_CFA_advance_loc | 1)
.D8(dwarf2reader::DW_CFA_val_offset).ULEB128(0x2cf0ab1b).ULEB128(0xe88) .D8(google_breakpad::DW_CFA_val_offset).ULEB128(0x2cf0ab1b).ULEB128(0xe88)
.D8(dwarf2reader::DW_CFA_advance_loc | 1) .D8(google_breakpad::DW_CFA_advance_loc | 1)
.D8(dwarf2reader::DW_CFA_restore_state) .D8(google_breakpad::DW_CFA_restore_state)
.FinishEntry(); .FinishEntry();
EXPECT_CALL(handler, ValOffsetRule(fde_start, 0x2cf0ab1b, EXPECT_CALL(handler, ValOffsetRule(fde_start, 0x2cf0ab1b,
@ -1888,10 +1888,10 @@ TEST_F(CFIRestore, RestoreRegisterRuleUnchanged) {
CFISection section(kLittleEndian, 4); CFISection section(kLittleEndian, 4);
StockCIEAndFDE(&section); StockCIEAndFDE(&section);
section section
.D8(dwarf2reader::DW_CFA_register).ULEB128(0x77514acc).ULEB128(0x464de4ce) .D8(google_breakpad::DW_CFA_register).ULEB128(0x77514acc).ULEB128(0x464de4ce)
.D8(dwarf2reader::DW_CFA_remember_state) .D8(google_breakpad::DW_CFA_remember_state)
.D8(dwarf2reader::DW_CFA_advance_loc | 1) .D8(google_breakpad::DW_CFA_advance_loc | 1)
.D8(dwarf2reader::DW_CFA_restore_state) .D8(google_breakpad::DW_CFA_restore_state)
.FinishEntry(); .FinishEntry();
EXPECT_CALL(handler, RegisterRule(fde_start, 0x77514acc, 0x464de4ce)) EXPECT_CALL(handler, RegisterRule(fde_start, 0x77514acc, 0x464de4ce))
@ -1905,12 +1905,12 @@ TEST_F(CFIRestore, RestoreRegisterRuleChanged) {
CFISection section(kLittleEndian, 4); CFISection section(kLittleEndian, 4);
StockCIEAndFDE(&section); StockCIEAndFDE(&section);
section section
.D8(dwarf2reader::DW_CFA_register).ULEB128(0xe39acce5).ULEB128(0x095f1559) .D8(google_breakpad::DW_CFA_register).ULEB128(0xe39acce5).ULEB128(0x095f1559)
.D8(dwarf2reader::DW_CFA_remember_state) .D8(google_breakpad::DW_CFA_remember_state)
.D8(dwarf2reader::DW_CFA_advance_loc | 1) .D8(google_breakpad::DW_CFA_advance_loc | 1)
.D8(dwarf2reader::DW_CFA_undefined).ULEB128(0xe39acce5) .D8(google_breakpad::DW_CFA_undefined).ULEB128(0xe39acce5)
.D8(dwarf2reader::DW_CFA_advance_loc | 1) .D8(google_breakpad::DW_CFA_advance_loc | 1)
.D8(dwarf2reader::DW_CFA_restore_state) .D8(google_breakpad::DW_CFA_restore_state)
.FinishEntry(); .FinishEntry();
EXPECT_CALL(handler, RegisterRule(fde_start, 0xe39acce5, 0x095f1559)) EXPECT_CALL(handler, RegisterRule(fde_start, 0xe39acce5, 0x095f1559))
@ -1929,12 +1929,12 @@ TEST_F(CFIRestore, RestoreRegisterRuleChangedRegister) {
CFISection section(kLittleEndian, 4); CFISection section(kLittleEndian, 4);
StockCIEAndFDE(&section); StockCIEAndFDE(&section);
section section
.D8(dwarf2reader::DW_CFA_register).ULEB128(0xd40e21b1).ULEB128(0x16607d6a) .D8(google_breakpad::DW_CFA_register).ULEB128(0xd40e21b1).ULEB128(0x16607d6a)
.D8(dwarf2reader::DW_CFA_remember_state) .D8(google_breakpad::DW_CFA_remember_state)
.D8(dwarf2reader::DW_CFA_advance_loc | 1) .D8(google_breakpad::DW_CFA_advance_loc | 1)
.D8(dwarf2reader::DW_CFA_register).ULEB128(0xd40e21b1).ULEB128(0xbabb4742) .D8(google_breakpad::DW_CFA_register).ULEB128(0xd40e21b1).ULEB128(0xbabb4742)
.D8(dwarf2reader::DW_CFA_advance_loc | 1) .D8(google_breakpad::DW_CFA_advance_loc | 1)
.D8(dwarf2reader::DW_CFA_restore_state) .D8(google_breakpad::DW_CFA_restore_state)
.FinishEntry(); .FinishEntry();
EXPECT_CALL(handler, RegisterRule(fde_start, 0xd40e21b1, 0x16607d6a)) EXPECT_CALL(handler, RegisterRule(fde_start, 0xd40e21b1, 0x16607d6a))
@ -1954,10 +1954,10 @@ TEST_F(CFIRestore, RestoreExpressionRuleUnchanged) {
CFISection section(kLittleEndian, 4); CFISection section(kLittleEndian, 4);
StockCIEAndFDE(&section); StockCIEAndFDE(&section);
section section
.D8(dwarf2reader::DW_CFA_expression).ULEB128(0x666ae152).Block("dwarf") .D8(google_breakpad::DW_CFA_expression).ULEB128(0x666ae152).Block("dwarf")
.D8(dwarf2reader::DW_CFA_remember_state) .D8(google_breakpad::DW_CFA_remember_state)
.D8(dwarf2reader::DW_CFA_advance_loc | 1) .D8(google_breakpad::DW_CFA_advance_loc | 1)
.D8(dwarf2reader::DW_CFA_restore_state) .D8(google_breakpad::DW_CFA_restore_state)
.FinishEntry(); .FinishEntry();
EXPECT_CALL(handler, ExpressionRule(fde_start, 0x666ae152, "dwarf")) EXPECT_CALL(handler, ExpressionRule(fde_start, 0x666ae152, "dwarf"))
@ -1971,12 +1971,12 @@ TEST_F(CFIRestore, RestoreExpressionRuleChanged) {
CFISection section(kLittleEndian, 4); CFISection section(kLittleEndian, 4);
StockCIEAndFDE(&section); StockCIEAndFDE(&section);
section section
.D8(dwarf2reader::DW_CFA_expression).ULEB128(0xb5ca5c46).Block("elf") .D8(google_breakpad::DW_CFA_expression).ULEB128(0xb5ca5c46).Block("elf")
.D8(dwarf2reader::DW_CFA_remember_state) .D8(google_breakpad::DW_CFA_remember_state)
.D8(dwarf2reader::DW_CFA_advance_loc | 1) .D8(google_breakpad::DW_CFA_advance_loc | 1)
.D8(dwarf2reader::DW_CFA_undefined).ULEB128(0xb5ca5c46) .D8(google_breakpad::DW_CFA_undefined).ULEB128(0xb5ca5c46)
.D8(dwarf2reader::DW_CFA_advance_loc | 1) .D8(google_breakpad::DW_CFA_advance_loc | 1)
.D8(dwarf2reader::DW_CFA_restore_state) .D8(google_breakpad::DW_CFA_restore_state)
.FinishEntry(); .FinishEntry();
EXPECT_CALL(handler, ExpressionRule(fde_start, 0xb5ca5c46, "elf")) EXPECT_CALL(handler, ExpressionRule(fde_start, 0xb5ca5c46, "elf"))
@ -1995,12 +1995,12 @@ TEST_F(CFIRestore, RestoreExpressionRuleChangedExpression) {
CFISection section(kLittleEndian, 4); CFISection section(kLittleEndian, 4);
StockCIEAndFDE(&section); StockCIEAndFDE(&section);
section section
.D8(dwarf2reader::DW_CFA_expression).ULEB128(0x500f5739).Block("smurf") .D8(google_breakpad::DW_CFA_expression).ULEB128(0x500f5739).Block("smurf")
.D8(dwarf2reader::DW_CFA_remember_state) .D8(google_breakpad::DW_CFA_remember_state)
.D8(dwarf2reader::DW_CFA_advance_loc | 1) .D8(google_breakpad::DW_CFA_advance_loc | 1)
.D8(dwarf2reader::DW_CFA_expression).ULEB128(0x500f5739).Block("orc") .D8(google_breakpad::DW_CFA_expression).ULEB128(0x500f5739).Block("orc")
.D8(dwarf2reader::DW_CFA_advance_loc | 1) .D8(google_breakpad::DW_CFA_advance_loc | 1)
.D8(dwarf2reader::DW_CFA_restore_state) .D8(google_breakpad::DW_CFA_restore_state)
.FinishEntry(); .FinishEntry();
EXPECT_CALL(handler, ExpressionRule(fde_start, 0x500f5739, "smurf")) EXPECT_CALL(handler, ExpressionRule(fde_start, 0x500f5739, "smurf"))
@ -2021,11 +2021,11 @@ TEST_F(CFIRestore, RestoreValExpressionRuleUnchanged) {
CFISection section(kLittleEndian, 4); CFISection section(kLittleEndian, 4);
StockCIEAndFDE(&section); StockCIEAndFDE(&section);
section section
.D8(dwarf2reader::DW_CFA_val_expression).ULEB128(0x666ae152) .D8(google_breakpad::DW_CFA_val_expression).ULEB128(0x666ae152)
.Block("hideous") .Block("hideous")
.D8(dwarf2reader::DW_CFA_remember_state) .D8(google_breakpad::DW_CFA_remember_state)
.D8(dwarf2reader::DW_CFA_advance_loc | 1) .D8(google_breakpad::DW_CFA_advance_loc | 1)
.D8(dwarf2reader::DW_CFA_restore_state) .D8(google_breakpad::DW_CFA_restore_state)
.FinishEntry(); .FinishEntry();
EXPECT_CALL(handler, ValExpressionRule(fde_start, 0x666ae152, "hideous")) EXPECT_CALL(handler, ValExpressionRule(fde_start, 0x666ae152, "hideous"))
@ -2039,13 +2039,13 @@ TEST_F(CFIRestore, RestoreValExpressionRuleChanged) {
CFISection section(kLittleEndian, 4); CFISection section(kLittleEndian, 4);
StockCIEAndFDE(&section); StockCIEAndFDE(&section);
section section
.D8(dwarf2reader::DW_CFA_val_expression).ULEB128(0xb5ca5c46) .D8(google_breakpad::DW_CFA_val_expression).ULEB128(0xb5ca5c46)
.Block("revolting") .Block("revolting")
.D8(dwarf2reader::DW_CFA_remember_state) .D8(google_breakpad::DW_CFA_remember_state)
.D8(dwarf2reader::DW_CFA_advance_loc | 1) .D8(google_breakpad::DW_CFA_advance_loc | 1)
.D8(dwarf2reader::DW_CFA_undefined).ULEB128(0xb5ca5c46) .D8(google_breakpad::DW_CFA_undefined).ULEB128(0xb5ca5c46)
.D8(dwarf2reader::DW_CFA_advance_loc | 1) .D8(google_breakpad::DW_CFA_advance_loc | 1)
.D8(dwarf2reader::DW_CFA_restore_state) .D8(google_breakpad::DW_CFA_restore_state)
.FinishEntry(); .FinishEntry();
PERHAPS_WRITE_DEBUG_FRAME_FILE("RestoreValExpressionRuleChanged", section); PERHAPS_WRITE_DEBUG_FRAME_FILE("RestoreValExpressionRuleChanged", section);
@ -2066,14 +2066,14 @@ TEST_F(CFIRestore, RestoreValExpressionRuleChangedValExpression) {
CFISection section(kLittleEndian, 4); CFISection section(kLittleEndian, 4);
StockCIEAndFDE(&section); StockCIEAndFDE(&section);
section section
.D8(dwarf2reader::DW_CFA_val_expression).ULEB128(0x500f5739) .D8(google_breakpad::DW_CFA_val_expression).ULEB128(0x500f5739)
.Block("repulsive") .Block("repulsive")
.D8(dwarf2reader::DW_CFA_remember_state) .D8(google_breakpad::DW_CFA_remember_state)
.D8(dwarf2reader::DW_CFA_advance_loc | 1) .D8(google_breakpad::DW_CFA_advance_loc | 1)
.D8(dwarf2reader::DW_CFA_val_expression).ULEB128(0x500f5739) .D8(google_breakpad::DW_CFA_val_expression).ULEB128(0x500f5739)
.Block("nauseous") .Block("nauseous")
.D8(dwarf2reader::DW_CFA_advance_loc | 1) .D8(google_breakpad::DW_CFA_advance_loc | 1)
.D8(dwarf2reader::DW_CFA_restore_state) .D8(google_breakpad::DW_CFA_restore_state)
.FinishEntry(); .FinishEntry();
PERHAPS_WRITE_DEBUG_FRAME_FILE("RestoreValExpressionRuleChangedValExpression", PERHAPS_WRITE_DEBUG_FRAME_FILE("RestoreValExpressionRuleChangedValExpression",
@ -2110,7 +2110,7 @@ struct EHFrameFixture: public CFIInsnFixture {
EXPECT_TRUE(section->ContainsEHFrame()); EXPECT_TRUE(section->ContainsEHFrame());
string contents; string contents;
EXPECT_TRUE(section->GetContents(&contents)); EXPECT_TRUE(section->GetContents(&contents));
dwarf2reader::Endianness endianness; google_breakpad::Endianness endianness;
if (section->endianness() == kBigEndian) if (section->endianness() == kBigEndian)
endianness = ENDIANNESS_BIG; endianness = ENDIANNESS_BIG;
else { else {
@ -2142,11 +2142,11 @@ TEST_F(EHFrame, Terminator) {
section section
.Mark(&cie) .Mark(&cie)
.CIEHeader(9968, 2466, 67, 1, "") .CIEHeader(9968, 2466, 67, 1, "")
.D8(dwarf2reader::DW_CFA_def_cfa).ULEB128(3772).ULEB128(1372) .D8(google_breakpad::DW_CFA_def_cfa).ULEB128(3772).ULEB128(1372)
.FinishEntry() .FinishEntry()
.FDEHeader(cie, 0x848037a1, 0x7b30475e) .FDEHeader(cie, 0x848037a1, 0x7b30475e)
.D8(dwarf2reader::DW_CFA_set_loc).D32(0x17713850) .D8(google_breakpad::DW_CFA_set_loc).D32(0x17713850)
.D8(dwarf2reader::DW_CFA_undefined).ULEB128(5721) .D8(google_breakpad::DW_CFA_undefined).ULEB128(5721)
.FinishEntry() .FinishEntry()
.D32(0) // Terminate the sequence. .D32(0) // Terminate the sequence.
// This FDE should be ignored. // This FDE should be ignored.
@ -2172,12 +2172,12 @@ TEST_F(EHFrame, Terminator) {
// The parser should recognize the Linux Standards Base 'z' augmentations. // The parser should recognize the Linux Standards Base 'z' augmentations.
TEST_F(EHFrame, SimpleFDE) { TEST_F(EHFrame, SimpleFDE) {
DwarfPointerEncoding lsda_encoding = DwarfPointerEncoding lsda_encoding =
DwarfPointerEncoding(dwarf2reader::DW_EH_PE_indirect DwarfPointerEncoding(google_breakpad::DW_EH_PE_indirect
| dwarf2reader::DW_EH_PE_datarel | google_breakpad::DW_EH_PE_datarel
| dwarf2reader::DW_EH_PE_sdata2); | google_breakpad::DW_EH_PE_sdata2);
DwarfPointerEncoding fde_encoding = DwarfPointerEncoding fde_encoding =
DwarfPointerEncoding(dwarf2reader::DW_EH_PE_textrel DwarfPointerEncoding(google_breakpad::DW_EH_PE_textrel
| dwarf2reader::DW_EH_PE_udata2); | google_breakpad::DW_EH_PE_udata2);
section.SetPointerEncoding(fde_encoding); section.SetPointerEncoding(fde_encoding);
section.SetEncodedPointerBases(encoded_pointer_bases); section.SetEncodedPointerBases(encoded_pointer_bases);
@ -2187,17 +2187,17 @@ TEST_F(EHFrame, SimpleFDE) {
.CIEHeader(4873, 7012, 100, 1, "zSLPR") .CIEHeader(4873, 7012, 100, 1, "zSLPR")
.ULEB128(7) // Augmentation data length .ULEB128(7) // Augmentation data length
.D8(lsda_encoding) // LSDA pointer format .D8(lsda_encoding) // LSDA pointer format
.D8(dwarf2reader::DW_EH_PE_pcrel) // personality pointer format .D8(google_breakpad::DW_EH_PE_pcrel) // personality pointer format
.EncodedPointer(0x97baa00, dwarf2reader::DW_EH_PE_pcrel) // and value .EncodedPointer(0x97baa00, google_breakpad::DW_EH_PE_pcrel) // and value
.D8(fde_encoding) // FDE pointer format .D8(fde_encoding) // FDE pointer format
.D8(dwarf2reader::DW_CFA_def_cfa).ULEB128(6706).ULEB128(31) .D8(google_breakpad::DW_CFA_def_cfa).ULEB128(6706).ULEB128(31)
.FinishEntry() .FinishEntry()
.FDEHeader(cie, 0x540f6b56, 0xf686) .FDEHeader(cie, 0x540f6b56, 0xf686)
.ULEB128(2) // Augmentation data length .ULEB128(2) // Augmentation data length
.EncodedPointer(0xe3eab475, lsda_encoding) // LSDA pointer, signed .EncodedPointer(0xe3eab475, lsda_encoding) // LSDA pointer, signed
.D8(dwarf2reader::DW_CFA_set_loc) .D8(google_breakpad::DW_CFA_set_loc)
.EncodedPointer(0x540fa4ce, fde_encoding) .EncodedPointer(0x540fa4ce, fde_encoding)
.D8(dwarf2reader::DW_CFA_undefined).ULEB128(0x675e) .D8(google_breakpad::DW_CFA_undefined).ULEB128(0x675e)
.FinishEntry() .FinishEntry()
.D32(0); // terminator .D32(0); // terminator
@ -2228,12 +2228,12 @@ TEST_F(EHFrame, EmptyZ) {
.Mark(&cie) .Mark(&cie)
.CIEHeader(5955, 5805, 228, 1, "z") .CIEHeader(5955, 5805, 228, 1, "z")
.ULEB128(0) // Augmentation data length .ULEB128(0) // Augmentation data length
.D8(dwarf2reader::DW_CFA_def_cfa).ULEB128(3629).ULEB128(247) .D8(google_breakpad::DW_CFA_def_cfa).ULEB128(3629).ULEB128(247)
.FinishEntry() .FinishEntry()
.FDEHeader(cie, 0xda007738, 0xfb55c641) .FDEHeader(cie, 0xda007738, 0xfb55c641)
.ULEB128(0) // Augmentation data length .ULEB128(0) // Augmentation data length
.D8(dwarf2reader::DW_CFA_advance_loc1).D8(11) .D8(google_breakpad::DW_CFA_advance_loc1).D8(11)
.D8(dwarf2reader::DW_CFA_undefined).ULEB128(3769) .D8(google_breakpad::DW_CFA_undefined).ULEB128(3769)
.FinishEntry(); .FinishEntry();
PERHAPS_WRITE_EH_FRAME_FILE("EHFrame.EmptyZ", section); PERHAPS_WRITE_EH_FRAME_FILE("EHFrame.EmptyZ", section);
@ -2257,12 +2257,12 @@ TEST_F(EHFrame, BadZ) {
.Mark(&cie) .Mark(&cie)
.CIEHeader(6937, 1045, 142, 1, "zQ") .CIEHeader(6937, 1045, 142, 1, "zQ")
.ULEB128(0) // Augmentation data length .ULEB128(0) // Augmentation data length
.D8(dwarf2reader::DW_CFA_def_cfa).ULEB128(9006).ULEB128(7725) .D8(google_breakpad::DW_CFA_def_cfa).ULEB128(9006).ULEB128(7725)
.FinishEntry() .FinishEntry()
.FDEHeader(cie, 0x1293efa8, 0x236f53f2) .FDEHeader(cie, 0x1293efa8, 0x236f53f2)
.ULEB128(0) // Augmentation data length .ULEB128(0) // Augmentation data length
.D8(dwarf2reader::DW_CFA_advance_loc | 12) .D8(google_breakpad::DW_CFA_advance_loc | 12)
.D8(dwarf2reader::DW_CFA_register).ULEB128(5667).ULEB128(3462) .D8(google_breakpad::DW_CFA_register).ULEB128(5667).ULEB128(3462)
.FinishEntry(); .FinishEntry();
PERHAPS_WRITE_EH_FRAME_FILE("EHFrame.BadZ", section); PERHAPS_WRITE_EH_FRAME_FILE("EHFrame.BadZ", section);
@ -2276,8 +2276,8 @@ TEST_F(EHFrame, BadZ) {
TEST_F(EHFrame, zL) { TEST_F(EHFrame, zL) {
Label cie; Label cie;
DwarfPointerEncoding lsda_encoding = DwarfPointerEncoding lsda_encoding =
DwarfPointerEncoding(dwarf2reader::DW_EH_PE_funcrel DwarfPointerEncoding(google_breakpad::DW_EH_PE_funcrel
| dwarf2reader::DW_EH_PE_udata2); | google_breakpad::DW_EH_PE_udata2);
section section
.Mark(&cie) .Mark(&cie)
.CIEHeader(9285, 9959, 54, 1, "zL") .CIEHeader(9285, 9959, 54, 1, "zL")
@ -2306,8 +2306,8 @@ TEST_F(EHFrame, zL) {
TEST_F(EHFrame, zP) { TEST_F(EHFrame, zP) {
Label cie; Label cie;
DwarfPointerEncoding personality_encoding = DwarfPointerEncoding personality_encoding =
DwarfPointerEncoding(dwarf2reader::DW_EH_PE_datarel DwarfPointerEncoding(google_breakpad::DW_EH_PE_datarel
| dwarf2reader::DW_EH_PE_udata2); | google_breakpad::DW_EH_PE_udata2);
section section
.Mark(&cie) .Mark(&cie)
.CIEHeader(1097, 6313, 17, 1, "zP") .CIEHeader(1097, 6313, 17, 1, "zP")
@ -2335,8 +2335,8 @@ TEST_F(EHFrame, zP) {
TEST_F(EHFrame, zR) { TEST_F(EHFrame, zR) {
Label cie; Label cie;
DwarfPointerEncoding pointer_encoding = DwarfPointerEncoding pointer_encoding =
DwarfPointerEncoding(dwarf2reader::DW_EH_PE_textrel DwarfPointerEncoding(google_breakpad::DW_EH_PE_textrel
| dwarf2reader::DW_EH_PE_sdata2); | google_breakpad::DW_EH_PE_sdata2);
section.SetPointerEncoding(pointer_encoding); section.SetPointerEncoding(pointer_encoding);
section section
.Mark(&cie) .Mark(&cie)

View file

@ -29,7 +29,7 @@
// Original author: Jim Blandy <jimb@mozilla.com> <jimb@red-bean.com> // Original author: Jim Blandy <jimb@mozilla.com> <jimb@red-bean.com>
// dwarf2reader_die_unittest.cc: Unit tests for dwarf2reader::CompilationUnit // dwarf2reader_die_unittest.cc: Unit tests for google_breakpad::CompilationUnit
#include <stdint.h> #include <stdint.h>
#include <stdlib.h> #include <stdlib.h>
@ -51,16 +51,16 @@ using google_breakpad::test_assembler::Section;
using google_breakpad::test_assembler::kBigEndian; using google_breakpad::test_assembler::kBigEndian;
using google_breakpad::test_assembler::kLittleEndian; using google_breakpad::test_assembler::kLittleEndian;
using dwarf2reader::ByteReader; using google_breakpad::ByteReader;
using dwarf2reader::CompilationUnit; using google_breakpad::CompilationUnit;
using dwarf2reader::Dwarf2Handler; using google_breakpad::Dwarf2Handler;
using dwarf2reader::DwarfAttribute; using google_breakpad::DwarfAttribute;
using dwarf2reader::DwarfForm; using google_breakpad::DwarfForm;
using dwarf2reader::DwarfHasChild; using google_breakpad::DwarfHasChild;
using dwarf2reader::DwarfTag; using google_breakpad::DwarfTag;
using dwarf2reader::ENDIANNESS_BIG; using google_breakpad::ENDIANNESS_BIG;
using dwarf2reader::ENDIANNESS_LITTLE; using google_breakpad::ENDIANNESS_LITTLE;
using dwarf2reader::SectionMap; using google_breakpad::SectionMap;
using std::vector; using std::vector;
using testing::InSequence; using testing::InSequence;
@ -168,9 +168,9 @@ class DwarfHeader: public DIEFixture,
TEST_P(DwarfHeader, Header) { TEST_P(DwarfHeader, Header) {
Label abbrev_table = abbrevs.Here(); Label abbrev_table = abbrevs.Here();
abbrevs.Abbrev(1, dwarf2reader::DW_TAG_compile_unit, abbrevs.Abbrev(1, google_breakpad::DW_TAG_compile_unit,
dwarf2reader::DW_children_yes) google_breakpad::DW_children_yes)
.Attribute(dwarf2reader::DW_AT_name, dwarf2reader::DW_FORM_string) .Attribute(google_breakpad::DW_AT_name, google_breakpad::DW_FORM_string)
.EndAbbrev() .EndAbbrev()
.EndTable(); .EndTable();
@ -178,7 +178,7 @@ TEST_P(DwarfHeader, Header) {
info.set_endianness(GetParam().endianness); info.set_endianness(GetParam().endianness);
info.Header(GetParam().version, abbrev_table, GetParam().address_size, info.Header(GetParam().version, abbrev_table, GetParam().address_size,
dwarf2reader::DW_UT_compile) google_breakpad::DW_UT_compile)
.ULEB128(1) // DW_TAG_compile_unit, with children .ULEB128(1) // DW_TAG_compile_unit, with children
.AppendCString("sam") // DW_AT_name, DW_FORM_string .AppendCString("sam") // DW_AT_name, DW_FORM_string
.D8(0); // end of children .D8(0); // end of children
@ -191,10 +191,10 @@ TEST_P(DwarfHeader, Header) {
GetParam().format_size, _, GetParam().format_size, _,
GetParam().version)) GetParam().version))
.WillOnce(Return(true)); .WillOnce(Return(true));
EXPECT_CALL(handler, StartDIE(_, dwarf2reader::DW_TAG_compile_unit)) EXPECT_CALL(handler, StartDIE(_, google_breakpad::DW_TAG_compile_unit))
.WillOnce(Return(true)); .WillOnce(Return(true));
EXPECT_CALL(handler, ProcessAttributeString(_, dwarf2reader::DW_AT_name, EXPECT_CALL(handler, ProcessAttributeString(_, google_breakpad::DW_AT_name,
dwarf2reader::DW_FORM_string, google_breakpad::DW_FORM_string,
"sam")) "sam"))
.WillOnce(Return()); .WillOnce(Return());
EXPECT_CALL(handler, EndDIE(_)) EXPECT_CALL(handler, EndDIE(_))
@ -210,9 +210,9 @@ TEST_P(DwarfHeader, Header) {
TEST_P(DwarfHeader, TypeUnitHeader) { TEST_P(DwarfHeader, TypeUnitHeader) {
Label abbrev_table = abbrevs.Here(); Label abbrev_table = abbrevs.Here();
int version = 5; int version = 5;
abbrevs.Abbrev(1, dwarf2reader::DW_TAG_type_unit, abbrevs.Abbrev(1, google_breakpad::DW_TAG_type_unit,
dwarf2reader::DW_children_yes) google_breakpad::DW_children_yes)
.Attribute(dwarf2reader::DW_AT_name, dwarf2reader::DW_FORM_string) .Attribute(google_breakpad::DW_AT_name, google_breakpad::DW_FORM_string)
.EndAbbrev() .EndAbbrev()
.EndTable(); .EndTable();
@ -220,7 +220,7 @@ TEST_P(DwarfHeader, TypeUnitHeader) {
info.set_endianness(GetParam().endianness); info.set_endianness(GetParam().endianness);
info.Header(version, abbrev_table, GetParam().address_size, info.Header(version, abbrev_table, GetParam().address_size,
dwarf2reader::DW_UT_type) google_breakpad::DW_UT_type)
.ULEB128(0x41) // DW_TAG_type_unit, with children .ULEB128(0x41) // DW_TAG_type_unit, with children
.AppendCString("sam") // DW_AT_name, DW_FORM_string .AppendCString("sam") // DW_AT_name, DW_FORM_string
.D8(0); // end of children .D8(0); // end of children
@ -234,10 +234,10 @@ TEST_P(DwarfHeader, TypeUnitHeader) {
version)) version))
.WillOnce(Return(true)); .WillOnce(Return(true));
// If the type unit is handled properly, these calls will be skipped. // If the type unit is handled properly, these calls will be skipped.
EXPECT_CALL(handler, StartDIE(_, dwarf2reader::DW_TAG_type_unit)) EXPECT_CALL(handler, StartDIE(_, google_breakpad::DW_TAG_type_unit))
.Times(0); .Times(0);
EXPECT_CALL(handler, ProcessAttributeString(_, dwarf2reader::DW_AT_name, EXPECT_CALL(handler, ProcessAttributeString(_, google_breakpad::DW_AT_name,
dwarf2reader::DW_FORM_string, google_breakpad::DW_FORM_string,
"sam")) "sam"))
.Times(0); .Times(0);
EXPECT_CALL(handler, EndDIE(_)) EXPECT_CALL(handler, EndDIE(_))
@ -291,7 +291,7 @@ struct DwarfFormsFixture: public DIEFixture {
DwarfForm form) { DwarfForm form) {
// Create the abbreviation table. // Create the abbreviation table.
Label abbrev_table = abbrevs.Here(); Label abbrev_table = abbrevs.Here();
abbrevs.Abbrev(1, tag, dwarf2reader::DW_children_no) abbrevs.Abbrev(1, tag, google_breakpad::DW_children_no)
.Attribute(name, form) .Attribute(name, form)
.EndAbbrev() .EndAbbrev()
.EndTable(); .EndTable();
@ -300,7 +300,7 @@ struct DwarfFormsFixture: public DIEFixture {
info.set_format_size(params.format_size); info.set_format_size(params.format_size);
info.set_endianness(params.endianness); info.set_endianness(params.endianness);
info.Header(params.version, abbrev_table, params.address_size, info.Header(params.version, abbrev_table, params.address_size,
dwarf2reader::DW_UT_compile) google_breakpad::DW_UT_compile)
.ULEB128(1); // abbrev code .ULEB128(1); // abbrev code
} }
@ -342,9 +342,9 @@ struct DwarfForms: public DwarfFormsFixture,
public TestWithParam<DwarfHeaderParams> { }; public TestWithParam<DwarfHeaderParams> { };
TEST_P(DwarfForms, addr) { TEST_P(DwarfForms, addr) {
StartSingleAttributeDIE(GetParam(), dwarf2reader::DW_TAG_compile_unit, StartSingleAttributeDIE(GetParam(), google_breakpad::DW_TAG_compile_unit,
dwarf2reader::DW_AT_low_pc, google_breakpad::DW_AT_low_pc,
dwarf2reader::DW_FORM_addr); google_breakpad::DW_FORM_addr);
uint64_t value; uint64_t value;
if (GetParam().address_size == 4) { if (GetParam().address_size == 4) {
value = 0xc8e9ffcc; value = 0xc8e9ffcc;
@ -355,9 +355,9 @@ TEST_P(DwarfForms, addr) {
} }
info.Finish(); info.Finish();
ExpectBeginCompilationUnit(GetParam(), dwarf2reader::DW_TAG_compile_unit); ExpectBeginCompilationUnit(GetParam(), google_breakpad::DW_TAG_compile_unit);
EXPECT_CALL(handler, ProcessAttributeUnsigned(_, dwarf2reader::DW_AT_low_pc, EXPECT_CALL(handler, ProcessAttributeUnsigned(_, google_breakpad::DW_AT_low_pc,
dwarf2reader::DW_FORM_addr, google_breakpad::DW_FORM_addr,
value)) value))
.InSequence(s) .InSequence(s)
.WillOnce(Return()); .WillOnce(Return());
@ -371,19 +371,19 @@ TEST_P(DwarfForms, strx1) {
return; return;
} }
Label abbrev_table = abbrevs.Here(); Label abbrev_table = abbrevs.Here();
abbrevs.Abbrev(1, dwarf2reader::DW_TAG_compile_unit, abbrevs.Abbrev(1, google_breakpad::DW_TAG_compile_unit,
dwarf2reader::DW_children_no) google_breakpad::DW_children_no)
.Attribute(dwarf2reader::DW_AT_name, dwarf2reader::DW_FORM_strx1) .Attribute(google_breakpad::DW_AT_name, google_breakpad::DW_FORM_strx1)
.Attribute(dwarf2reader::DW_AT_low_pc, dwarf2reader::DW_FORM_addr) .Attribute(google_breakpad::DW_AT_low_pc, google_breakpad::DW_FORM_addr)
.Attribute(dwarf2reader::DW_AT_str_offsets_base, .Attribute(google_breakpad::DW_AT_str_offsets_base,
dwarf2reader::DW_FORM_sec_offset) google_breakpad::DW_FORM_sec_offset)
.EndAbbrev() .EndAbbrev()
.EndTable(); .EndTable();
info.set_format_size(GetParam().format_size); info.set_format_size(GetParam().format_size);
info.set_endianness(GetParam().endianness); info.set_endianness(GetParam().endianness);
info.Header(GetParam().version, abbrev_table, GetParam().address_size, info.Header(GetParam().version, abbrev_table, GetParam().address_size,
dwarf2reader::DW_UT_compile) google_breakpad::DW_UT_compile)
.ULEB128(1) // abbrev index .ULEB128(1) // abbrev index
.D8(2); // string index .D8(2); // string index
@ -435,13 +435,13 @@ TEST_P(DwarfForms, strx1) {
} }
ExpectBeginCompilationUnit(GetParam(), dwarf2reader::DW_TAG_compile_unit); ExpectBeginCompilationUnit(GetParam(), google_breakpad::DW_TAG_compile_unit);
EXPECT_CALL(handler, ProcessAttributeString(_, dwarf2reader::DW_AT_name, EXPECT_CALL(handler, ProcessAttributeString(_, google_breakpad::DW_AT_name,
dwarf2reader::DW_FORM_strx1, google_breakpad::DW_FORM_strx1,
"bird")) "bird"))
.WillOnce(Return()); .WillOnce(Return());
EXPECT_CALL(handler, ProcessAttributeUnsigned(_, dwarf2reader::DW_AT_low_pc, EXPECT_CALL(handler, ProcessAttributeUnsigned(_, google_breakpad::DW_AT_low_pc,
dwarf2reader::DW_FORM_addr, google_breakpad::DW_FORM_addr,
value)) value))
.InSequence(s) .InSequence(s)
.WillOnce(Return()); .WillOnce(Return());
@ -453,13 +453,13 @@ TEST_P(DwarfForms, strx1) {
TEST_P(DwarfForms, block2_empty) { TEST_P(DwarfForms, block2_empty) {
StartSingleAttributeDIE(GetParam(), (DwarfTag) 0x16e4d2f7, StartSingleAttributeDIE(GetParam(), (DwarfTag) 0x16e4d2f7,
(DwarfAttribute) 0xe52c4463, (DwarfAttribute) 0xe52c4463,
dwarf2reader::DW_FORM_block2); google_breakpad::DW_FORM_block2);
info.D16(0); info.D16(0);
info.Finish(); info.Finish();
ExpectBeginCompilationUnit(GetParam(), (DwarfTag) 0x16e4d2f7); ExpectBeginCompilationUnit(GetParam(), (DwarfTag) 0x16e4d2f7);
EXPECT_CALL(handler, ProcessAttributeBuffer(_, (DwarfAttribute) 0xe52c4463, EXPECT_CALL(handler, ProcessAttributeBuffer(_, (DwarfAttribute) 0xe52c4463,
dwarf2reader::DW_FORM_block2, google_breakpad::DW_FORM_block2,
_, 0)) _, 0))
.InSequence(s) .InSequence(s)
.WillOnce(Return()); .WillOnce(Return());
@ -471,7 +471,7 @@ TEST_P(DwarfForms, block2_empty) {
TEST_P(DwarfForms, block2) { TEST_P(DwarfForms, block2) {
StartSingleAttributeDIE(GetParam(), (DwarfTag) 0x16e4d2f7, StartSingleAttributeDIE(GetParam(), (DwarfTag) 0x16e4d2f7,
(DwarfAttribute) 0xe52c4463, (DwarfAttribute) 0xe52c4463,
dwarf2reader::DW_FORM_block2); google_breakpad::DW_FORM_block2);
unsigned char data[258]; unsigned char data[258];
memset(data, '*', sizeof(data)); memset(data, '*', sizeof(data));
info.D16(sizeof(data)) info.D16(sizeof(data))
@ -480,7 +480,7 @@ TEST_P(DwarfForms, block2) {
ExpectBeginCompilationUnit(GetParam(), (DwarfTag) 0x16e4d2f7); ExpectBeginCompilationUnit(GetParam(), (DwarfTag) 0x16e4d2f7);
EXPECT_CALL(handler, ProcessAttributeBuffer(_, (DwarfAttribute) 0xe52c4463, EXPECT_CALL(handler, ProcessAttributeBuffer(_, (DwarfAttribute) 0xe52c4463,
dwarf2reader::DW_FORM_block2, google_breakpad::DW_FORM_block2,
Pointee('*'), 258)) Pointee('*'), 258))
.InSequence(s) .InSequence(s)
.WillOnce(Return()); .WillOnce(Return());
@ -492,14 +492,14 @@ TEST_P(DwarfForms, block2) {
TEST_P(DwarfForms, flag_present) { TEST_P(DwarfForms, flag_present) {
StartSingleAttributeDIE(GetParam(), (DwarfTag) 0x3e449ac2, StartSingleAttributeDIE(GetParam(), (DwarfTag) 0x3e449ac2,
(DwarfAttribute) 0x359d1972, (DwarfAttribute) 0x359d1972,
dwarf2reader::DW_FORM_flag_present); google_breakpad::DW_FORM_flag_present);
// DW_FORM_flag_present occupies no space in the DIE. // DW_FORM_flag_present occupies no space in the DIE.
info.Finish(); info.Finish();
ExpectBeginCompilationUnit(GetParam(), (DwarfTag) 0x3e449ac2); ExpectBeginCompilationUnit(GetParam(), (DwarfTag) 0x3e449ac2);
EXPECT_CALL(handler, EXPECT_CALL(handler,
ProcessAttributeUnsigned(_, (DwarfAttribute) 0x359d1972, ProcessAttributeUnsigned(_, (DwarfAttribute) 0x359d1972,
dwarf2reader::DW_FORM_flag_present, google_breakpad::DW_FORM_flag_present,
1)) 1))
.InSequence(s) .InSequence(s)
.WillOnce(Return()); .WillOnce(Return());
@ -511,7 +511,7 @@ TEST_P(DwarfForms, flag_present) {
TEST_P(DwarfForms, sec_offset) { TEST_P(DwarfForms, sec_offset) {
StartSingleAttributeDIE(GetParam(), (DwarfTag) 0x1d971689, StartSingleAttributeDIE(GetParam(), (DwarfTag) 0x1d971689,
(DwarfAttribute) 0xa060bfd1, (DwarfAttribute) 0xa060bfd1,
dwarf2reader::DW_FORM_sec_offset); google_breakpad::DW_FORM_sec_offset);
uint64_t value; uint64_t value;
if (GetParam().format_size == 4) { if (GetParam().format_size == 4) {
value = 0xacc9c388; value = 0xacc9c388;
@ -524,7 +524,7 @@ TEST_P(DwarfForms, sec_offset) {
ExpectBeginCompilationUnit(GetParam(), (DwarfTag) 0x1d971689); ExpectBeginCompilationUnit(GetParam(), (DwarfTag) 0x1d971689);
EXPECT_CALL(handler, ProcessAttributeUnsigned(_, (DwarfAttribute) 0xa060bfd1, EXPECT_CALL(handler, ProcessAttributeUnsigned(_, (DwarfAttribute) 0xa060bfd1,
dwarf2reader::DW_FORM_sec_offset, google_breakpad::DW_FORM_sec_offset,
value)) value))
.InSequence(s) .InSequence(s)
.WillOnce(Return()); .WillOnce(Return());
@ -536,14 +536,14 @@ TEST_P(DwarfForms, sec_offset) {
TEST_P(DwarfForms, exprloc) { TEST_P(DwarfForms, exprloc) {
StartSingleAttributeDIE(GetParam(), (DwarfTag) 0xb6d167bb, StartSingleAttributeDIE(GetParam(), (DwarfTag) 0xb6d167bb,
(DwarfAttribute) 0xba3ae5cb, (DwarfAttribute) 0xba3ae5cb,
dwarf2reader::DW_FORM_exprloc); google_breakpad::DW_FORM_exprloc);
info.ULEB128(29) info.ULEB128(29)
.Append(29, 173); .Append(29, 173);
info.Finish(); info.Finish();
ExpectBeginCompilationUnit(GetParam(), (DwarfTag) 0xb6d167bb); ExpectBeginCompilationUnit(GetParam(), (DwarfTag) 0xb6d167bb);
EXPECT_CALL(handler, ProcessAttributeBuffer(_, (DwarfAttribute) 0xba3ae5cb, EXPECT_CALL(handler, ProcessAttributeBuffer(_, (DwarfAttribute) 0xba3ae5cb,
dwarf2reader::DW_FORM_exprloc, google_breakpad::DW_FORM_exprloc,
Pointee(173), 29)) Pointee(173), 29))
.InSequence(s) .InSequence(s)
.WillOnce(Return()); .WillOnce(Return());
@ -555,13 +555,13 @@ TEST_P(DwarfForms, exprloc) {
TEST_P(DwarfForms, ref_sig8) { TEST_P(DwarfForms, ref_sig8) {
StartSingleAttributeDIE(GetParam(), (DwarfTag) 0x253e7b2b, StartSingleAttributeDIE(GetParam(), (DwarfTag) 0x253e7b2b,
(DwarfAttribute) 0xd708d908, (DwarfAttribute) 0xd708d908,
dwarf2reader::DW_FORM_ref_sig8); google_breakpad::DW_FORM_ref_sig8);
info.D64(0xf72fa0cb6ddcf9d6ULL); info.D64(0xf72fa0cb6ddcf9d6ULL);
info.Finish(); info.Finish();
ExpectBeginCompilationUnit(GetParam(), (DwarfTag) 0x253e7b2b); ExpectBeginCompilationUnit(GetParam(), (DwarfTag) 0x253e7b2b);
EXPECT_CALL(handler, ProcessAttributeSignature(_, (DwarfAttribute) 0xd708d908, EXPECT_CALL(handler, ProcessAttributeSignature(_, (DwarfAttribute) 0xd708d908,
dwarf2reader::DW_FORM_ref_sig8, google_breakpad::DW_FORM_ref_sig8,
0xf72fa0cb6ddcf9d6ULL)) 0xf72fa0cb6ddcf9d6ULL))
.InSequence(s) .InSequence(s)
.WillOnce(Return()); .WillOnce(Return());
@ -579,13 +579,13 @@ TEST_P(DwarfForms, ref_sig8_not_first) {
info.Append(98, '*'); info.Append(98, '*');
StartSingleAttributeDIE(GetParam(), (DwarfTag) 0x253e7b2b, StartSingleAttributeDIE(GetParam(), (DwarfTag) 0x253e7b2b,
(DwarfAttribute) 0xd708d908, (DwarfAttribute) 0xd708d908,
dwarf2reader::DW_FORM_ref_sig8); google_breakpad::DW_FORM_ref_sig8);
info.D64(0xf72fa0cb6ddcf9d6ULL); info.D64(0xf72fa0cb6ddcf9d6ULL);
info.Finish(); info.Finish();
ExpectBeginCompilationUnit(GetParam(), (DwarfTag) 0x253e7b2b, 98); ExpectBeginCompilationUnit(GetParam(), (DwarfTag) 0x253e7b2b, 98);
EXPECT_CALL(handler, ProcessAttributeSignature(_, (DwarfAttribute) 0xd708d908, EXPECT_CALL(handler, ProcessAttributeSignature(_, (DwarfAttribute) 0xd708d908,
dwarf2reader::DW_FORM_ref_sig8, google_breakpad::DW_FORM_ref_sig8,
0xf72fa0cb6ddcf9d6ULL)) 0xf72fa0cb6ddcf9d6ULL))
.InSequence(s) .InSequence(s)
.WillOnce(Return()); .WillOnce(Return());
@ -599,23 +599,23 @@ TEST_P(DwarfForms, implicit_const) {
const uint64_t implicit_constant_value = 0x1234; const uint64_t implicit_constant_value = 0x1234;
// Create the abbreviation table. // Create the abbreviation table.
Label abbrev_table = abbrevs.Here(); Label abbrev_table = abbrevs.Here();
abbrevs.Abbrev(1, (DwarfTag) 0x253e7b2b, dwarf2reader::DW_children_no) abbrevs.Abbrev(1, (DwarfTag) 0x253e7b2b, google_breakpad::DW_children_no)
.Attribute((DwarfAttribute) 0xd708d908, .Attribute((DwarfAttribute) 0xd708d908,
dwarf2reader::DW_FORM_implicit_const) google_breakpad::DW_FORM_implicit_const)
.ULEB128(implicit_constant_value); .ULEB128(implicit_constant_value);
abbrevs.EndAbbrev().EndTable(); abbrevs.EndAbbrev().EndTable();
info.set_format_size(params.format_size); info.set_format_size(params.format_size);
info.set_endianness(params.endianness); info.set_endianness(params.endianness);
info.Header(params.version, abbrev_table, params.address_size, info.Header(params.version, abbrev_table, params.address_size,
dwarf2reader::DW_UT_compile) google_breakpad::DW_UT_compile)
.ULEB128(1); // abbrev code .ULEB128(1); // abbrev code
info.Finish(); info.Finish();
ExpectBeginCompilationUnit(GetParam(), (DwarfTag) 0x253e7b2b); ExpectBeginCompilationUnit(GetParam(), (DwarfTag) 0x253e7b2b);
EXPECT_CALL(handler, EXPECT_CALL(handler,
ProcessAttributeUnsigned(_, (DwarfAttribute) 0xd708d908, ProcessAttributeUnsigned(_, (DwarfAttribute) 0xd708d908,
dwarf2reader::DW_FORM_implicit_const, google_breakpad::DW_FORM_implicit_const,
implicit_constant_value)) implicit_constant_value))
.InSequence(s) .InSequence(s)
.WillOnce(Return()); .WillOnce(Return());
@ -653,15 +653,15 @@ INSTANTIATE_TEST_SUITE_P(
DwarfHeaderParams(kBigEndian, 8, 4, 4, 1), DwarfHeaderParams(kBigEndian, 8, 4, 4, 1),
DwarfHeaderParams(kBigEndian, 8, 4, 8, 1))); DwarfHeaderParams(kBigEndian, 8, 4, 8, 1)));
class MockRangeListHandler: public dwarf2reader::RangeListHandler { class MockRangeListHandler: public google_breakpad::RangeListHandler {
public: public:
MOCK_METHOD(void, AddRange, (uint64_t begin, uint64_t end)); MOCK_METHOD(void, AddRange, (uint64_t begin, uint64_t end));
MOCK_METHOD(void, Finish, ()); MOCK_METHOD(void, Finish, ());
}; };
TEST(RangeList, Dwarf4ReadRangeList) { TEST(RangeList, Dwarf4ReadRangeList) {
using dwarf2reader::RangeListReader; using google_breakpad::RangeListReader;
using dwarf2reader::DW_FORM_sec_offset; using google_breakpad::DW_FORM_sec_offset;
// Create a dwarf4 .debug_ranges section. // Create a dwarf4 .debug_ranges section.
google_breakpad::test_assembler::Section ranges(kBigEndian); google_breakpad::test_assembler::Section ranges(kBigEndian);
@ -688,7 +688,7 @@ TEST(RangeList, Dwarf4ReadRangeList) {
cu_info.size_ = section_contents.size(); cu_info.size_ = section_contents.size();
MockRangeListHandler handler; MockRangeListHandler handler;
dwarf2reader::RangeListReader range_list_reader(&byte_reader, &cu_info, google_breakpad::RangeListReader range_list_reader(&byte_reader, &cu_info,
&handler); &handler);
EXPECT_CALL(handler, AddRange(2, 3)); EXPECT_CALL(handler, AddRange(2, 3));
EXPECT_CALL(handler, AddRange(4, 5)); EXPECT_CALL(handler, AddRange(4, 5));
@ -699,17 +699,17 @@ TEST(RangeList, Dwarf4ReadRangeList) {
} }
TEST(RangeList, Dwarf5ReadRangeList_rnglists) { TEST(RangeList, Dwarf5ReadRangeList_rnglists) {
using dwarf2reader::RangeListReader; using google_breakpad::RangeListReader;
using dwarf2reader::DW_RLE_base_addressx; using google_breakpad::DW_RLE_base_addressx;
using dwarf2reader::DW_RLE_startx_endx; using google_breakpad::DW_RLE_startx_endx;
using dwarf2reader::DW_RLE_startx_length; using google_breakpad::DW_RLE_startx_length;
using dwarf2reader::DW_RLE_offset_pair; using google_breakpad::DW_RLE_offset_pair;
using dwarf2reader::DW_RLE_end_of_list; using google_breakpad::DW_RLE_end_of_list;
using dwarf2reader::DW_RLE_base_address; using google_breakpad::DW_RLE_base_address;
using dwarf2reader::DW_RLE_start_end; using google_breakpad::DW_RLE_start_end;
using dwarf2reader::DW_RLE_start_length; using google_breakpad::DW_RLE_start_length;
using dwarf2reader::DW_FORM_sec_offset; using google_breakpad::DW_FORM_sec_offset;
using dwarf2reader::DW_FORM_rnglistx; using google_breakpad::DW_FORM_rnglistx;
// Size of header // Size of header
const uint64_t header_size = 12; const uint64_t header_size = 12;
@ -814,7 +814,7 @@ TEST(RangeList, Dwarf5ReadRangeList_rnglists) {
byte_reader.SetOffsetSize(4); byte_reader.SetOffsetSize(4);
byte_reader.SetAddressSize(4); byte_reader.SetAddressSize(4);
MockRangeListHandler handler; MockRangeListHandler handler;
dwarf2reader::RangeListReader range_list_reader1(&byte_reader, &cu_info, google_breakpad::RangeListReader range_list_reader1(&byte_reader, &cu_info,
&handler); &handler);
EXPECT_CALL(handler, AddRange(2, 3)); EXPECT_CALL(handler, AddRange(2, 3));
EXPECT_CALL(handler, AddRange(4, 5)); EXPECT_CALL(handler, AddRange(4, 5));
@ -830,7 +830,7 @@ TEST(RangeList, Dwarf5ReadRangeList_rnglists) {
// Set to new ranges_base // Set to new ranges_base
cu_info.ranges_base_ = ranges_base_2; cu_info.ranges_base_ = ranges_base_2;
dwarf2reader::RangeListReader range_list_reader2(&byte_reader, &cu_info, google_breakpad::RangeListReader range_list_reader2(&byte_reader, &cu_info,
&handler); &handler);
EXPECT_CALL(handler, AddRange(2, 3)); EXPECT_CALL(handler, AddRange(2, 3));
EXPECT_CALL(handler, AddRange(4, 5)); EXPECT_CALL(handler, AddRange(4, 5));
@ -846,17 +846,17 @@ TEST(RangeList, Dwarf5ReadRangeList_rnglists) {
} }
TEST(RangeList, Dwarf5ReadRangeList_sec_offset) { TEST(RangeList, Dwarf5ReadRangeList_sec_offset) {
using dwarf2reader::RangeListReader; using google_breakpad::RangeListReader;
using dwarf2reader::DW_RLE_base_addressx; using google_breakpad::DW_RLE_base_addressx;
using dwarf2reader::DW_RLE_startx_endx; using google_breakpad::DW_RLE_startx_endx;
using dwarf2reader::DW_RLE_startx_length; using google_breakpad::DW_RLE_startx_length;
using dwarf2reader::DW_RLE_offset_pair; using google_breakpad::DW_RLE_offset_pair;
using dwarf2reader::DW_RLE_end_of_list; using google_breakpad::DW_RLE_end_of_list;
using dwarf2reader::DW_RLE_base_address; using google_breakpad::DW_RLE_base_address;
using dwarf2reader::DW_RLE_start_end; using google_breakpad::DW_RLE_start_end;
using dwarf2reader::DW_RLE_start_length; using google_breakpad::DW_RLE_start_length;
using dwarf2reader::DW_FORM_sec_offset; using google_breakpad::DW_FORM_sec_offset;
using dwarf2reader::DW_FORM_rnglistx; using google_breakpad::DW_FORM_rnglistx;
// Size of length field in header // Size of length field in header
const uint64_t length_size = 4; const uint64_t length_size = 4;
@ -936,7 +936,7 @@ TEST(RangeList, Dwarf5ReadRangeList_sec_offset) {
byte_reader.SetOffsetSize(4); byte_reader.SetOffsetSize(4);
byte_reader.SetAddressSize(4); byte_reader.SetAddressSize(4);
MockRangeListHandler handler; MockRangeListHandler handler;
dwarf2reader::RangeListReader range_list_reader(&byte_reader, &cu_info, google_breakpad::RangeListReader range_list_reader(&byte_reader, &cu_info,
&handler); &handler);
EXPECT_CALL(handler, AddRange(2, 3)); EXPECT_CALL(handler, AddRange(2, 3));
EXPECT_CALL(handler, AddRange(4, 5)); EXPECT_CALL(handler, AddRange(4, 5));

View file

@ -29,7 +29,7 @@
// Original author: Sterling Augustine <saugustine@google.com> // Original author: Sterling Augustine <saugustine@google.com>
// dwarf2reader_lineinfo_unittest.cc: Unit tests for dwarf2reader::LineInfo // dwarf2reader_lineinfo_unittest.cc: Unit tests for google_breakpad::LineInfo
#include <stdint.h> #include <stdint.h>
#include <stdlib.h> #include <stdlib.h>
@ -49,7 +49,7 @@ using testing::Sequence;
using testing::Test; using testing::Test;
using testing::_; using testing::_;
using namespace dwarf2reader; using namespace google_breakpad;
namespace { namespace {

View file

@ -44,7 +44,7 @@
#include "google_breakpad/common/breakpad_types.h" #include "google_breakpad/common/breakpad_types.h"
using testing::_; using testing::_;
using namespace dwarf2reader; using namespace google_breakpad;
namespace { namespace {

View file

@ -45,9 +45,9 @@
// DWARF compilation units. // DWARF compilation units.
class TestCompilationUnit: public google_breakpad::test_assembler::Section { class TestCompilationUnit: public google_breakpad::test_assembler::Section {
public: public:
typedef dwarf2reader::DwarfTag DwarfTag; typedef google_breakpad::DwarfTag DwarfTag;
typedef dwarf2reader::DwarfAttribute DwarfAttribute; typedef google_breakpad::DwarfAttribute DwarfAttribute;
typedef dwarf2reader::DwarfForm DwarfForm; typedef google_breakpad::DwarfForm DwarfForm;
typedef google_breakpad::test_assembler::Label Label; typedef google_breakpad::test_assembler::Label Label;
// Set the section's DWARF format size (the 32-bit DWARF format or the // Set the section's DWARF format size (the 32-bit DWARF format or the
@ -87,7 +87,7 @@ class TestCompilationUnit: public google_breakpad::test_assembler::Section {
D8(header_type); // DW_UT_compile, DW_UT_type, etc. D8(header_type); // DW_UT_compile, DW_UT_type, etc.
D8(address_size); D8(address_size);
SectionOffset(abbrev_offset); SectionOffset(abbrev_offset);
if (header_type == dwarf2reader::DW_UT_type) { if (header_type == google_breakpad::DW_UT_type) {
uint64_t dummy_type_signature = 0xdeadbeef; uint64_t dummy_type_signature = 0xdeadbeef;
uint64_t dummy_type_offset = 0x2b; uint64_t dummy_type_offset = 0x2b;
D64(dummy_type_signature); D64(dummy_type_signature);
@ -122,10 +122,10 @@ class TestCompilationUnit: public google_breakpad::test_assembler::Section {
// abbreviation tables. // abbreviation tables.
class TestAbbrevTable: public google_breakpad::test_assembler::Section { class TestAbbrevTable: public google_breakpad::test_assembler::Section {
public: public:
typedef dwarf2reader::DwarfTag DwarfTag; typedef google_breakpad::DwarfTag DwarfTag;
typedef dwarf2reader::DwarfAttribute DwarfAttribute; typedef google_breakpad::DwarfAttribute DwarfAttribute;
typedef dwarf2reader::DwarfForm DwarfForm; typedef google_breakpad::DwarfForm DwarfForm;
typedef dwarf2reader::DwarfHasChild DwarfHasChild; typedef google_breakpad::DwarfHasChild DwarfHasChild;
typedef google_breakpad::test_assembler::Label Label; typedef google_breakpad::test_assembler::Label Label;
// Start a new abbreviation table entry for abbreviation code |code|, // Start a new abbreviation table entry for abbreviation code |code|,

View file

@ -108,7 +108,7 @@ const char kPLTFunctionSuffix[] = "@plt";
} // namespace } // namespace
namespace dwarf2reader { namespace google_breakpad {
template <class ElfArch> class ElfReaderImpl; template <class ElfArch> class ElfReaderImpl;
@ -1271,4 +1271,4 @@ bool ElfReader::IsNonStrippedELFBinary(const string& path) {
bool ElfReader::IsNonDebugStrippedELFBinary(const string& path) { bool ElfReader::IsNonDebugStrippedELFBinary(const string& path) {
return IsNonStrippedELFBinaryHelper(path, true); return IsNonStrippedELFBinaryHelper(path, true);
} }
} // namespace dwarf2reader } // namespace google_breakpad

View file

@ -24,7 +24,7 @@
using std::vector; using std::vector;
using std::pair; using std::pair;
namespace dwarf2reader { namespace google_breakpad {
class SymbolMap; class SymbolMap;
class Elf32; class Elf32;
@ -162,6 +162,6 @@ class ElfReader {
ElfReaderImpl<Elf64>* impl64_; ElfReaderImpl<Elf64>* impl64_;
}; };
} // namespace dwarf2reader } // namespace google_breakpad
#endif // COMMON_DWARF_ELF_READER_H__ #endif // COMMON_DWARF_ELF_READER_H__

View file

@ -42,9 +42,7 @@
#include "common/scoped_ptr.h" #include "common/scoped_ptr.h"
#include "common/using_std_string.h" #include "common/using_std_string.h"
using google_breakpad::scoped_ptr; namespace google_breakpad {
namespace dwarf2reader {
CULineInfoHandler::CULineInfoHandler(std::vector<SourceFileInfo>* files, CULineInfoHandler::CULineInfoHandler(std::vector<SourceFileInfo>* files,
std::vector<string>* dirs, std::vector<string>* dirs,
@ -227,4 +225,4 @@ void CUFunctionInfoHandler::EndDIE(uint64_t offset) {
current_function_info_)); current_function_info_));
} }
} // namespace dwarf2reader } // namespace google_breakpad

View file

@ -43,7 +43,7 @@
#include "common/using_std_string.h" #include "common/using_std_string.h"
namespace dwarf2reader { namespace google_breakpad {
struct FunctionInfo { struct FunctionInfo {
// Name of the function // Name of the function
@ -187,5 +187,5 @@ class CUFunctionInfoHandler: public Dwarf2Handler {
uint64_t current_compilation_unit_offset_; uint64_t current_compilation_unit_offset_;
}; };
} // namespace dwarf2reader } // namespace google_breakpad
#endif // COMMON_DWARF_FUNCTIONINFO_H__ #endif // COMMON_DWARF_FUNCTIONINFO_H__

View file

@ -32,7 +32,7 @@
#include <stdint.h> #include <stdint.h>
namespace dwarf2reader { namespace google_breakpad {
// This is the format of a DWARF2/3 line state machine that we process // This is the format of a DWARF2/3 line state machine that we process
// opcodes using. There is no need for anything outside the lineinfo // opcodes using. There is no need for anything outside the lineinfo
@ -57,7 +57,7 @@ struct LineStateMachine {
bool end_sequence; bool end_sequence;
}; };
} // namespace dwarf2reader } // namespace google_breakpad
#endif // COMMON_DWARF_LINE_STATE_MACHINE_H__ #endif // COMMON_DWARF_LINE_STATE_MACHINE_H__

View file

@ -147,7 +147,7 @@ bool DwarfCFIToModule::Entry(size_t offset, uint64_t address, uint64_t length,
unsigned return_address) { unsigned return_address) {
assert(!entry_); assert(!entry_);
// If dwarf2reader::CallFrameInfo can handle this version and // If CallFrameInfo can handle this version and
// augmentation, then we should be okay with that, so there's no // augmentation, then we should be okay with that, so there's no
// need to check them here. // need to check them here.

View file

@ -52,7 +52,6 @@
namespace google_breakpad { namespace google_breakpad {
using dwarf2reader::CallFrameInfo;
using google_breakpad::Module; using google_breakpad::Module;
using std::set; using std::set;
using std::vector; using std::vector;
@ -121,7 +120,7 @@ class DwarfCFIToModule: public CallFrameInfo::Handler {
static vector<string> MakeVector(const char* const* strings, size_t size); static vector<string> MakeVector(const char* const* strings, size_t size);
}; };
// Create a handler for the dwarf2reader::CallFrameInfo parser that // Create a handler for the CallFrameInfo parser that
// records the stack unwinding information it receives in MODULE. // records the stack unwinding information it receives in MODULE.
// //
// Use REGISTER_NAMES[I] as the name of register number I; *this // Use REGISTER_NAMES[I] as the name of register number I; *this

View file

@ -153,7 +153,7 @@ void DwarfCUToModule::FileContext::ClearSectionMapForTest() {
section_map_.clear(); section_map_.clear();
} }
const dwarf2reader::SectionMap& const SectionMap&
DwarfCUToModule::FileContext::section_map() const { DwarfCUToModule::FileContext::section_map() const {
return section_map_; return section_map_;
} }
@ -183,7 +183,7 @@ struct DwarfCUToModule::CUContext {
language(Language::CPlusPlus), language(Language::CPlusPlus),
low_pc(0), low_pc(0),
high_pc(0), high_pc(0),
ranges_form(dwarf2reader::DW_FORM_sec_offset), ranges_form(DW_FORM_sec_offset),
ranges_data(0), ranges_data(0),
ranges_base(0), ranges_base(0),
str_offsets_base(0) { } str_offsets_base(0) { }
@ -218,7 +218,7 @@ struct DwarfCUToModule::CUContext {
uint64_t high_pc; uint64_t high_pc;
// Ranges for this CU are read according to this form. // Ranges for this CU are read according to this form.
enum dwarf2reader::DwarfForm ranges_form; enum DwarfForm ranges_form;
uint64_t ranges_data; uint64_t ranges_data;
// Offset into .debug_rngslists where this CU's ranges are stored. // Offset into .debug_rngslists where this CU's ranges are stored.
@ -235,24 +235,24 @@ struct DwarfCUToModule::CUContext {
// Collect all the data from the CU that a RangeListReader needs to read a // Collect all the data from the CU that a RangeListReader needs to read a
// range. // range.
bool AssembleRangeListInfo( bool AssembleRangeListInfo(
dwarf2reader::RangeListReader::CURangesInfo* info) { RangeListReader::CURangesInfo* info) {
const dwarf2reader::SectionMap& section_map const SectionMap& section_map
= file_context->section_map(); = file_context->section_map();
info->version_ = version; info->version_ = version;
info->base_address_ = low_pc; info->base_address_ = low_pc;
info->ranges_base_ = ranges_base; info->ranges_base_ = ranges_base;
const char* section_name = (version <= 4 ? const char* section_name = (version <= 4 ?
".debug_ranges" : ".debug_rnglists"); ".debug_ranges" : ".debug_rnglists");
dwarf2reader::SectionMap::const_iterator map_entry SectionMap::const_iterator map_entry
= dwarf2reader::GetSectionByName(section_map, section_name); = GetSectionByName(section_map, section_name);
if (map_entry == section_map.end()) { if (map_entry == section_map.end()) {
return false; return false;
} }
info->buffer_ = map_entry->second.first; info->buffer_ = map_entry->second.first;
info->size_ = map_entry->second.second; info->size_ = map_entry->second.second;
if (version > 4) { if (version > 4) {
dwarf2reader::SectionMap::const_iterator map_entry SectionMap::const_iterator map_entry
= dwarf2reader::GetSectionByName(section_map, ".debug_addr"); = GetSectionByName(section_map, ".debug_addr");
if (map_entry == section_map.end()) { if (map_entry == section_map.end()) {
return false; return false;
} }
@ -289,7 +289,7 @@ struct DwarfCUToModule::DIEContext {
}; };
// An abstract base class for all the dumper's DIE handlers. // An abstract base class for all the dumper's DIE handlers.
class DwarfCUToModule::GenericDIEHandler: public dwarf2reader::DIEHandler { class DwarfCUToModule::GenericDIEHandler: public DIEHandler {
public: public:
// Create a handler for the DIE at OFFSET whose compilation unit is // Create a handler for the DIE at OFFSET whose compilation unit is
// described by CU_CONTEXT, and whose immediate context is described // described by CU_CONTEXT, and whose immediate context is described
@ -377,7 +377,7 @@ void DwarfCUToModule::GenericDIEHandler::ProcessAttributeUnsigned(
enum DwarfForm form, enum DwarfForm form,
uint64_t data) { uint64_t data) {
switch (attr) { switch (attr) {
case dwarf2reader::DW_AT_declaration: declaration_ = (data != 0); break; case DW_AT_declaration: declaration_ = (data != 0); break;
default: break; default: break;
} }
} }
@ -387,7 +387,7 @@ void DwarfCUToModule::GenericDIEHandler::ProcessAttributeReference(
enum DwarfForm form, enum DwarfForm form,
uint64_t data) { uint64_t data) {
switch (attr) { switch (attr) {
case dwarf2reader::DW_AT_specification: { case DW_AT_specification: {
FileContext* file_context = cu_context_->file_context; FileContext* file_context = cu_context_->file_context;
if (file_context->IsUnhandledInterCUReference( if (file_context->IsUnhandledInterCUReference(
data, cu_context_->reporter->cu_offset())) { data, cu_context_->reporter->cu_offset())) {
@ -426,11 +426,11 @@ void DwarfCUToModule::GenericDIEHandler::ProcessAttributeString(
enum DwarfForm form, enum DwarfForm form,
const string& data) { const string& data) {
switch (attr) { switch (attr) {
case dwarf2reader::DW_AT_name: case DW_AT_name:
name_attribute_ = AddStringToPool(data); name_attribute_ = AddStringToPool(data);
break; break;
case dwarf2reader::DW_AT_MIPS_linkage_name: case DW_AT_MIPS_linkage_name:
case dwarf2reader::DW_AT_linkage_name: { case DW_AT_linkage_name: {
string demangled; string demangled;
Language::DemangleResult result = Language::DemangleResult result =
cu_context_->language->DemangleName(data, &demangled); cu_context_->language->DemangleName(data, &demangled);
@ -522,8 +522,8 @@ class DwarfCUToModule::FuncHandler: public GenericDIEHandler {
FuncHandler(CUContext* cu_context, DIEContext* parent_context, FuncHandler(CUContext* cu_context, DIEContext* parent_context,
uint64_t offset) uint64_t offset)
: GenericDIEHandler(cu_context, parent_context, offset), : GenericDIEHandler(cu_context, parent_context, offset),
low_pc_(0), high_pc_(0), high_pc_form_(dwarf2reader::DW_FORM_addr), low_pc_(0), high_pc_(0), high_pc_form_(DW_FORM_addr),
ranges_form_(dwarf2reader::DW_FORM_sec_offset), ranges_data_(0), ranges_form_(DW_FORM_sec_offset), ranges_data_(0),
abstract_origin_(NULL), inline_(false) { } abstract_origin_(NULL), inline_(false) { }
void ProcessAttributeUnsigned(enum DwarfAttribute attr, void ProcessAttributeUnsigned(enum DwarfAttribute attr,
@ -559,14 +559,14 @@ void DwarfCUToModule::FuncHandler::ProcessAttributeUnsigned(
// If this attribute is present at all --- even if its value is // If this attribute is present at all --- even if its value is
// DW_INL_not_inlined --- then GCC may cite it as someone else's // DW_INL_not_inlined --- then GCC may cite it as someone else's
// DW_AT_abstract_origin attribute. // DW_AT_abstract_origin attribute.
case dwarf2reader::DW_AT_inline: inline_ = true; break; case DW_AT_inline: inline_ = true; break;
case dwarf2reader::DW_AT_low_pc: low_pc_ = data; break; case DW_AT_low_pc: low_pc_ = data; break;
case dwarf2reader::DW_AT_high_pc: case DW_AT_high_pc:
high_pc_form_ = form; high_pc_form_ = form;
high_pc_ = data; high_pc_ = data;
break; break;
case dwarf2reader::DW_AT_ranges: case DW_AT_ranges:
ranges_data_ = data; ranges_data_ = data;
ranges_form_ = form; ranges_form_ = form;
break; break;
@ -585,7 +585,7 @@ void DwarfCUToModule::FuncHandler::ProcessAttributeSigned(
// If this attribute is present at all --- even if its value is // If this attribute is present at all --- even if its value is
// DW_INL_not_inlined --- then GCC may cite it as someone else's // DW_INL_not_inlined --- then GCC may cite it as someone else's
// DW_AT_abstract_origin attribute. // DW_AT_abstract_origin attribute.
case dwarf2reader::DW_AT_inline: inline_ = true; break; case DW_AT_inline: inline_ = true; break;
default: default:
break; break;
@ -597,7 +597,7 @@ void DwarfCUToModule::FuncHandler::ProcessAttributeReference(
enum DwarfForm form, enum DwarfForm form,
uint64_t data) { uint64_t data) {
switch (attr) { switch (attr) {
case dwarf2reader::DW_AT_abstract_origin: { case DW_AT_abstract_origin: {
const AbstractOriginByOffset& origins = const AbstractOriginByOffset& origins =
cu_context_->file_context->file_private_->origins; cu_context_->file_context->file_private_->origins;
AbstractOriginByOffset::const_iterator origin = origins.find(data); AbstractOriginByOffset::const_iterator origin = origins.find(data);
@ -652,13 +652,13 @@ void DwarfCUToModule::FuncHandler::Finish() {
if (!ranges_data_) { if (!ranges_data_) {
// Make high_pc_ an address, if it isn't already. // Make high_pc_ an address, if it isn't already.
if (high_pc_form_ != dwarf2reader::DW_FORM_addr && if (high_pc_form_ != DW_FORM_addr &&
high_pc_form_ != dwarf2reader::DW_FORM_GNU_addr_index && high_pc_form_ != DW_FORM_GNU_addr_index &&
high_pc_form_ != dwarf2reader::DW_FORM_addrx && high_pc_form_ != DW_FORM_addrx &&
high_pc_form_ != dwarf2reader::DW_FORM_addrx1 && high_pc_form_ != DW_FORM_addrx1 &&
high_pc_form_ != dwarf2reader::DW_FORM_addrx2 && high_pc_form_ != DW_FORM_addrx2 &&
high_pc_form_ != dwarf2reader::DW_FORM_addrx3 && high_pc_form_ != DW_FORM_addrx3 &&
high_pc_form_ != dwarf2reader::DW_FORM_addrx4) { high_pc_form_ != DW_FORM_addrx4) {
high_pc_ += low_pc_; high_pc_ += low_pc_;
} }
@ -667,7 +667,7 @@ void DwarfCUToModule::FuncHandler::Finish() {
} else { } else {
RangesHandler* ranges_handler = cu_context_->ranges_handler; RangesHandler* ranges_handler = cu_context_->ranges_handler;
if (ranges_handler) { if (ranges_handler) {
dwarf2reader::RangeListReader::CURangesInfo cu_info; RangeListReader::CURangesInfo cu_info;
if (cu_context_->AssembleRangeListInfo(&cu_info)) { if (cu_context_->AssembleRangeListInfo(&cu_info)) {
if (!ranges_handler->ReadRanges(ranges_form_, ranges_data_, if (!ranges_handler->ReadRanges(ranges_form_, ranges_data_,
&cu_info, &ranges)) { &cu_info, &ranges)) {
@ -741,16 +741,16 @@ bool DwarfCUToModule::NamedScopeHandler::EndAttributes() {
return true; return true;
} }
dwarf2reader::DIEHandler* DwarfCUToModule::NamedScopeHandler::FindChildHandler( DIEHandler* DwarfCUToModule::NamedScopeHandler::FindChildHandler(
uint64_t offset, uint64_t offset,
enum DwarfTag tag) { enum DwarfTag tag) {
switch (tag) { switch (tag) {
case dwarf2reader::DW_TAG_subprogram: case DW_TAG_subprogram:
return new FuncHandler(cu_context_, &child_context_, offset); return new FuncHandler(cu_context_, &child_context_, offset);
case dwarf2reader::DW_TAG_namespace: case DW_TAG_namespace:
case dwarf2reader::DW_TAG_class_type: case DW_TAG_class_type:
case dwarf2reader::DW_TAG_structure_type: case DW_TAG_structure_type:
case dwarf2reader::DW_TAG_union_type: case DW_TAG_union_type:
return new NamedScopeHandler(cu_context_, &child_context_, offset); return new NamedScopeHandler(cu_context_, &child_context_, offset);
default: default:
return NULL; return NULL;
@ -875,7 +875,7 @@ void DwarfCUToModule::ProcessAttributeSigned(enum DwarfAttribute attr,
enum DwarfForm form, enum DwarfForm form,
int64_t data) { int64_t data) {
switch (attr) { switch (attr) {
case dwarf2reader::DW_AT_language: // source language of this CU case DW_AT_language: // source language of this CU
SetLanguage(static_cast<DwarfLanguage>(data)); SetLanguage(static_cast<DwarfLanguage>(data));
break; break;
default: default:
@ -887,34 +887,33 @@ void DwarfCUToModule::ProcessAttributeUnsigned(enum DwarfAttribute attr,
enum DwarfForm form, enum DwarfForm form,
uint64_t data) { uint64_t data) {
switch (attr) { switch (attr) {
case dwarf2reader::DW_AT_stmt_list: // Line number information. case DW_AT_stmt_list: // Line number information.
has_source_line_info_ = true; has_source_line_info_ = true;
source_line_offset_ = data; source_line_offset_ = data;
break; break;
case dwarf2reader::DW_AT_language: // source language of this CU case DW_AT_language: // source language of this CU
SetLanguage(static_cast<DwarfLanguage>(data)); SetLanguage(static_cast<DwarfLanguage>(data));
break; break;
case dwarf2reader::DW_AT_low_pc: case DW_AT_low_pc:
cu_context_->low_pc = data; cu_context_->low_pc = data;
break; break;
case dwarf2reader::DW_AT_high_pc: case DW_AT_high_pc:
cu_context_->high_pc = data; cu_context_->high_pc = data;
break; break;
case dwarf2reader::DW_AT_ranges: case DW_AT_ranges:
cu_context_->ranges_data = data; cu_context_->ranges_data = data;
cu_context_->ranges_form = form; cu_context_->ranges_form = form;
break; break;
case dwarf2reader::DW_AT_rnglists_base: case DW_AT_rnglists_base:
cu_context_->ranges_base = data; cu_context_->ranges_base = data;
break; break;
case dwarf2reader::DW_AT_addr_base: case DW_AT_addr_base:
case dwarf2reader::DW_AT_GNU_addr_base: case DW_AT_GNU_addr_base:
cu_context_->addr_base = data; cu_context_->addr_base = data;
break; break;
case dwarf2reader::DW_AT_str_offsets_base: case DW_AT_str_offsets_base:
cu_context_->str_offsets_base = data; cu_context_->str_offsets_base = data;
break; break;
default: default:
break; break;
} }
@ -922,12 +921,12 @@ void DwarfCUToModule::ProcessAttributeUnsigned(enum DwarfAttribute attr,
void DwarfCUToModule::ProcessAttributeString(enum DwarfAttribute attr, void DwarfCUToModule::ProcessAttributeString(enum DwarfAttribute attr,
enum DwarfForm form, enum DwarfForm form,
const string& data) { const string& data) {
switch (attr) { switch (attr) {
case dwarf2reader::DW_AT_name: case DW_AT_name:
cu_context_->reporter->SetCUName(data); cu_context_->reporter->SetCUName(data);
break; break;
case dwarf2reader::DW_AT_comp_dir: case DW_AT_comp_dir:
line_reader_->StartCompilationUnit(data); line_reader_->StartCompilationUnit(data);
break; break;
default: default:
@ -939,17 +938,17 @@ bool DwarfCUToModule::EndAttributes() {
return true; return true;
} }
dwarf2reader::DIEHandler* DwarfCUToModule::FindChildHandler( DIEHandler* DwarfCUToModule::FindChildHandler(
uint64_t offset, uint64_t offset,
enum DwarfTag tag) { enum DwarfTag tag) {
switch (tag) { switch (tag) {
case dwarf2reader::DW_TAG_subprogram: case DW_TAG_subprogram:
return new FuncHandler(cu_context_.get(), child_context_.get(), offset); return new FuncHandler(cu_context_.get(), child_context_.get(), offset);
case dwarf2reader::DW_TAG_namespace: case DW_TAG_namespace:
case dwarf2reader::DW_TAG_class_type: case DW_TAG_class_type:
case dwarf2reader::DW_TAG_structure_type: case DW_TAG_structure_type:
case dwarf2reader::DW_TAG_union_type: case DW_TAG_union_type:
case dwarf2reader::DW_TAG_module: case DW_TAG_module:
return new NamedScopeHandler(cu_context_.get(), child_context_.get(), return new NamedScopeHandler(cu_context_.get(), child_context_.get(),
offset); offset);
default: default:
@ -959,21 +958,21 @@ dwarf2reader::DIEHandler* DwarfCUToModule::FindChildHandler(
void DwarfCUToModule::SetLanguage(DwarfLanguage language) { void DwarfCUToModule::SetLanguage(DwarfLanguage language) {
switch (language) { switch (language) {
case dwarf2reader::DW_LANG_Java: case DW_LANG_Java:
cu_context_->language = Language::Java; cu_context_->language = Language::Java;
break; break;
case dwarf2reader::DW_LANG_Swift: case DW_LANG_Swift:
cu_context_->language = Language::Swift; cu_context_->language = Language::Swift;
break; break;
case dwarf2reader::DW_LANG_Rust: case DW_LANG_Rust:
cu_context_->language = Language::Rust; cu_context_->language = Language::Rust;
break; break;
// DWARF has no generic language code for assembly language; this is // DWARF has no generic language code for assembly language; this is
// what the GNU toolchain uses. // what the GNU toolchain uses.
case dwarf2reader::DW_LANG_Mips_Assembler: case DW_LANG_Mips_Assembler:
cu_context_->language = Language::Assembler; cu_context_->language = Language::Assembler;
break; break;
@ -989,22 +988,22 @@ void DwarfCUToModule::SetLanguage(DwarfLanguage language) {
// nested in struct types, but if it ever does, then C++'s // nested in struct types, but if it ever does, then C++'s
// notation is probably not a bad choice for that. // notation is probably not a bad choice for that.
default: default:
case dwarf2reader::DW_LANG_ObjC: case DW_LANG_ObjC:
case dwarf2reader::DW_LANG_ObjC_plus_plus: case DW_LANG_ObjC_plus_plus:
case dwarf2reader::DW_LANG_C: case DW_LANG_C:
case dwarf2reader::DW_LANG_C89: case DW_LANG_C89:
case dwarf2reader::DW_LANG_C99: case DW_LANG_C99:
case dwarf2reader::DW_LANG_C_plus_plus: case DW_LANG_C_plus_plus:
cu_context_->language = Language::CPlusPlus; cu_context_->language = Language::CPlusPlus;
break; break;
} }
} }
void DwarfCUToModule::ReadSourceLines(uint64_t offset) { void DwarfCUToModule::ReadSourceLines(uint64_t offset) {
const dwarf2reader::SectionMap& section_map const SectionMap& section_map
= cu_context_->file_context->section_map(); = cu_context_->file_context->section_map();
dwarf2reader::SectionMap::const_iterator map_entry SectionMap::const_iterator map_entry
= dwarf2reader::GetSectionByName(section_map, ".debug_line"); = GetSectionByName(section_map, ".debug_line");
if (map_entry == section_map.end()) { if (map_entry == section_map.end()) {
cu_context_->reporter->MissingSection(".debug_line"); cu_context_->reporter->MissingSection(".debug_line");
return; return;
@ -1020,14 +1019,14 @@ void DwarfCUToModule::ReadSourceLines(uint64_t offset) {
// may or may not be needed by dwarf5, so no error if they are missing. // may or may not be needed by dwarf5, so no error if they are missing.
const uint8_t* string_section_start = nullptr; const uint8_t* string_section_start = nullptr;
uint64_t string_section_length = 0; uint64_t string_section_length = 0;
map_entry = dwarf2reader::GetSectionByName(section_map, ".debug_str"); map_entry = GetSectionByName(section_map, ".debug_str");
if (map_entry != section_map.end()) { if (map_entry != section_map.end()) {
string_section_start = map_entry->second.first; string_section_start = map_entry->second.first;
string_section_length = map_entry->second.second; string_section_length = map_entry->second.second;
} }
const uint8_t* line_string_section_start = nullptr; const uint8_t* line_string_section_start = nullptr;
uint64_t line_string_section_length = 0; uint64_t line_string_section_length = 0;
map_entry = dwarf2reader::GetSectionByName(section_map, ".debug_line_str"); map_entry = GetSectionByName(section_map, ".debug_line_str");
if (map_entry != section_map.end()) { if (map_entry != section_map.end()) {
line_string_section_start = map_entry->second.first; line_string_section_start = map_entry->second.first;
line_string_section_length = map_entry->second.second; line_string_section_length = map_entry->second.second;
@ -1337,8 +1336,8 @@ bool DwarfCUToModule::StartCompilationUnit(uint64_t offset,
bool DwarfCUToModule::StartRootDIE(uint64_t offset, enum DwarfTag tag) { bool DwarfCUToModule::StartRootDIE(uint64_t offset, enum DwarfTag tag) {
// We don't deal with partial compilation units (the only other tag // We don't deal with partial compilation units (the only other tag
// likely to be used for root DIE). // likely to be used for root DIE).
return (tag == dwarf2reader::DW_TAG_compile_unit return (tag == DW_TAG_compile_unit
|| tag == dwarf2reader::DW_TAG_skeleton_unit); || tag == DW_TAG_skeleton_unit);
} }
} // namespace google_breakpad } // namespace google_breakpad

View file

@ -52,19 +52,14 @@
namespace google_breakpad { namespace google_breakpad {
using dwarf2reader::DwarfAttribute;
using dwarf2reader::DwarfForm;
using dwarf2reader::DwarfLanguage;
using dwarf2reader::DwarfTag;
// Populate a google_breakpad::Module with DWARF debugging information. // Populate a google_breakpad::Module with DWARF debugging information.
// //
// An instance of this class can be provided as a handler to a // An instance of this class can be provided as a handler to a
// dwarf2reader::DIEDispatcher, which can in turn be a handler for a // DIEDispatcher, which can in turn be a handler for a
// dwarf2reader::CompilationUnit DWARF parser. The handler uses the results // CompilationUnit DWARF parser. The handler uses the results
// of parsing to populate a google_breakpad::Module with source file, // of parsing to populate a google_breakpad::Module with source file,
// function, and source line information. // function, and source line information.
class DwarfCUToModule: public dwarf2reader::RootDIEHandler { class DwarfCUToModule: public RootDIEHandler {
struct FilePrivate; struct FilePrivate;
public: public:
// Information global to the DWARF-bearing file we are processing, // Information global to the DWARF-bearing file we are processing,
@ -91,7 +86,7 @@ class DwarfCUToModule: public dwarf2reader::RootDIEHandler {
// Clear the section map for testing. // Clear the section map for testing.
void ClearSectionMapForTest(); void ClearSectionMapForTest();
const dwarf2reader::SectionMap& section_map() const; const SectionMap& section_map() const;
private: private:
friend class DwarfCUToModule; friend class DwarfCUToModule;
@ -110,7 +105,7 @@ class DwarfCUToModule: public dwarf2reader::RootDIEHandler {
// A map of this file's sections, used for finding other DWARF // A map of this file's sections, used for finding other DWARF
// sections that the .debug_info section may refer to. // sections that the .debug_info section may refer to.
dwarf2reader::SectionMap section_map_; SectionMap section_map_;
// The Module to which we're contributing definitions. // The Module to which we're contributing definitions.
Module* module_; Module* module_;
@ -132,14 +127,14 @@ class DwarfCUToModule: public dwarf2reader::RootDIEHandler {
// Called when finishing a function to populate the function's ranges. // Called when finishing a function to populate the function's ranges.
// The entries are read according to the form and data. // The entries are read according to the form and data.
virtual bool ReadRanges( virtual bool ReadRanges(
enum dwarf2reader::DwarfForm form, uint64_t data, enum DwarfForm form, uint64_t data,
dwarf2reader::RangeListReader::CURangesInfo* cu_info, RangeListReader::CURangesInfo* cu_info,
vector<Module::Range>* ranges) = 0; vector<Module::Range>* ranges) = 0;
}; };
// An abstract base class for handlers that handle DWARF line data // An abstract base class for handlers that handle DWARF line data
// for DwarfCUToModule. DwarfCUToModule could certainly just use // for DwarfCUToModule. DwarfCUToModule could certainly just use
// dwarf2reader::LineInfo itself directly, but decoupling things // LineInfo itself directly, but decoupling things
// this way makes unit testing a little easier. // this way makes unit testing a little easier.
class LineToModuleHandler { class LineToModuleHandler {
public: public:
@ -255,7 +250,7 @@ class DwarfCUToModule: public dwarf2reader::RootDIEHandler {
// Create a DWARF debugging info handler for a compilation unit // Create a DWARF debugging info handler for a compilation unit
// within FILE_CONTEXT. This uses information received from the // within FILE_CONTEXT. This uses information received from the
// dwarf2reader::CompilationUnit DWARF parser to populate // CompilationUnit DWARF parser to populate
// FILE_CONTEXT->module. Use LINE_READER to handle the compilation // FILE_CONTEXT->module. Use LINE_READER to handle the compilation
// unit's line number data. Use REPORTER to report problems with the // unit's line number data. Use REPORTER to report problems with the
// data we find. // data we find.

View file

@ -44,12 +44,12 @@
using std::make_pair; using std::make_pair;
using std::vector; using std::vector;
using dwarf2reader::DIEHandler; using google_breakpad::DIEHandler;
using dwarf2reader::DwarfTag; using google_breakpad::DwarfTag;
using dwarf2reader::DwarfAttribute; using google_breakpad::DwarfAttribute;
using dwarf2reader::DwarfForm; using google_breakpad::DwarfForm;
using dwarf2reader::DwarfInline; using google_breakpad::DwarfInline;
using dwarf2reader::RootDIEHandler; using google_breakpad::RootDIEHandler;
using google_breakpad::DwarfCUToModule; using google_breakpad::DwarfCUToModule;
using google_breakpad::Module; using google_breakpad::Module;
@ -133,7 +133,7 @@ class CUFixtureBase {
CUFixtureBase() CUFixtureBase()
: module_("module-name", "module-os", "module-arch", "module-id"), : module_("module-name", "module-os", "module-arch", "module-id"),
file_context_("dwarf-filename", &module_, true), file_context_("dwarf-filename", &module_, true),
language_(dwarf2reader::DW_LANG_none), language_(google_breakpad::DW_LANG_none),
language_signed_(false), language_signed_(false),
appender_(&lines_), appender_(&lines_),
reporter_("dwarf-filename", 0xcf8f9bb6443d29b5LL), reporter_("dwarf-filename", 0xcf8f9bb6443d29b5LL),
@ -175,7 +175,7 @@ class CUFixtureBase {
// Use LANGUAGE for the compilation unit. More precisely, arrange // Use LANGUAGE for the compilation unit. More precisely, arrange
// for StartCU to pass the compilation unit's root DIE a // for StartCU to pass the compilation unit's root DIE a
// DW_AT_language attribute whose value is LANGUAGE. // DW_AT_language attribute whose value is LANGUAGE.
void SetLanguage(dwarf2reader::DwarfLanguage language) { void SetLanguage(google_breakpad::DwarfLanguage language) {
language_ = language; language_ = language;
} }
@ -191,7 +191,7 @@ class CUFixtureBase {
void StartCU(); void StartCU();
// Have HANDLER process some strange attribute/form/value triples. // Have HANDLER process some strange attribute/form/value triples.
void ProcessStrangeAttributes(dwarf2reader::DIEHandler* handler); void ProcessStrangeAttributes(google_breakpad::DIEHandler* handler);
// Start a child DIE of PARENT with the given tag and name. Leave // Start a child DIE of PARENT with the given tag and name. Leave
// the handler ready to hear about children: call EndAttributes, but // the handler ready to hear about children: call EndAttributes, but
@ -215,7 +215,7 @@ class CUFixtureBase {
void DefineFunction(DIEHandler* parent, const string& name, void DefineFunction(DIEHandler* parent, const string& name,
Module::Address address, Module::Address size, Module::Address address, Module::Address size,
const char* mangled_name, const char* mangled_name,
DwarfForm high_pc_form = dwarf2reader::DW_FORM_addr); DwarfForm high_pc_form = google_breakpad::DW_FORM_addr);
// Create a declaration DIE as a child of PARENT with the given // Create a declaration DIE as a child of PARENT with the given
// offset, tag and name. If NAME is the empty string, don't provide // offset, tag and name. If NAME is the empty string, don't provide
@ -240,7 +240,7 @@ class CUFixtureBase {
void AbstractInstanceDIE(DIEHandler* parent, uint64_t offset, void AbstractInstanceDIE(DIEHandler* parent, uint64_t offset,
DwarfInline type, uint64_t specification, DwarfInline type, uint64_t specification,
const string& name, const string& name,
DwarfForm form = dwarf2reader::DW_FORM_data1); DwarfForm form = google_breakpad::DW_FORM_data1);
// Create a DW_TAG_subprogram DIE as a child of PARENT that refers to // Create a DW_TAG_subprogram DIE as a child of PARENT that refers to
// ORIGIN in its DW_AT_abstract_origin attribute. If NAME is the empty // ORIGIN in its DW_AT_abstract_origin attribute. If NAME is the empty
@ -279,7 +279,7 @@ class CUFixtureBase {
// If this is not DW_LANG_none, we'll pass it as a DW_AT_language // If this is not DW_LANG_none, we'll pass it as a DW_AT_language
// attribute to the compilation unit. This defaults to DW_LANG_none. // attribute to the compilation unit. This defaults to DW_LANG_none.
dwarf2reader::DwarfLanguage language_; google_breakpad::DwarfLanguage language_;
// If this is true, report DW_AT_language as a signed value; if false, // If this is true, report DW_AT_language as a signed value; if false,
// report it as an unsigned value. // report it as an unsigned value.
@ -350,34 +350,34 @@ void CUFixtureBase::StartCU() {
0x4241b4f33720dd5cULL, 3)); 0x4241b4f33720dd5cULL, 3));
{ {
ASSERT_TRUE(root_handler_.StartRootDIE(0x02e56bfbda9e7337ULL, ASSERT_TRUE(root_handler_.StartRootDIE(0x02e56bfbda9e7337ULL,
dwarf2reader::DW_TAG_compile_unit)); google_breakpad::DW_TAG_compile_unit));
} }
root_handler_.ProcessAttributeString(dwarf2reader::DW_AT_name, root_handler_.ProcessAttributeString(google_breakpad::DW_AT_name,
dwarf2reader::DW_FORM_strp, google_breakpad::DW_FORM_strp,
"compilation-unit-name"); "compilation-unit-name");
if (!compilation_dir_.empty()) if (!compilation_dir_.empty())
root_handler_.ProcessAttributeString(dwarf2reader::DW_AT_comp_dir, root_handler_.ProcessAttributeString(google_breakpad::DW_AT_comp_dir,
dwarf2reader::DW_FORM_strp, google_breakpad::DW_FORM_strp,
compilation_dir_); compilation_dir_);
if (!lines_.empty()) if (!lines_.empty())
root_handler_.ProcessAttributeUnsigned(dwarf2reader::DW_AT_stmt_list, root_handler_.ProcessAttributeUnsigned(google_breakpad::DW_AT_stmt_list,
dwarf2reader::DW_FORM_ref4, google_breakpad::DW_FORM_ref4,
0); 0);
if (language_ != dwarf2reader::DW_LANG_none) { if (language_ != google_breakpad::DW_LANG_none) {
if (language_signed_) if (language_signed_)
root_handler_.ProcessAttributeSigned(dwarf2reader::DW_AT_language, root_handler_.ProcessAttributeSigned(google_breakpad::DW_AT_language,
dwarf2reader::DW_FORM_sdata, google_breakpad::DW_FORM_sdata,
language_); language_);
else else
root_handler_.ProcessAttributeUnsigned(dwarf2reader::DW_AT_language, root_handler_.ProcessAttributeUnsigned(google_breakpad::DW_AT_language,
dwarf2reader::DW_FORM_udata, google_breakpad::DW_FORM_udata,
language_); language_);
} }
ASSERT_TRUE(root_handler_.EndAttributes()); ASSERT_TRUE(root_handler_.EndAttributes());
} }
void CUFixtureBase::ProcessStrangeAttributes( void CUFixtureBase::ProcessStrangeAttributes(
dwarf2reader::DIEHandler* handler) { google_breakpad::DIEHandler* handler) {
handler->ProcessAttributeUnsigned((DwarfAttribute) 0xf560dead, handler->ProcessAttributeUnsigned((DwarfAttribute) 0xf560dead,
(DwarfForm) 0x4106e4db, (DwarfForm) 0x4106e4db,
0xa592571997facda1ULL); 0xa592571997facda1ULL);
@ -399,12 +399,12 @@ void CUFixtureBase::ProcessStrangeAttributes(
DIEHandler* CUFixtureBase::StartNamedDIE(DIEHandler* parent, DIEHandler* CUFixtureBase::StartNamedDIE(DIEHandler* parent,
DwarfTag tag, DwarfTag tag,
const string& name) { const string& name) {
dwarf2reader::DIEHandler* handler google_breakpad::DIEHandler* handler
= parent->FindChildHandler(0x8f4c783c0467c989ULL, tag); = parent->FindChildHandler(0x8f4c783c0467c989ULL, tag);
if (!handler) if (!handler)
return NULL; return NULL;
handler->ProcessAttributeString(dwarf2reader::DW_AT_name, handler->ProcessAttributeString(google_breakpad::DW_AT_name,
dwarf2reader::DW_FORM_strp, google_breakpad::DW_FORM_strp,
name); name);
ProcessStrangeAttributes(handler); ProcessStrangeAttributes(handler);
if (!handler->EndAttributes()) { if (!handler->EndAttributes()) {
@ -420,16 +420,16 @@ DIEHandler* CUFixtureBase::StartSpecifiedDIE(DIEHandler* parent,
DwarfTag tag, DwarfTag tag,
uint64_t specification, uint64_t specification,
const char* name) { const char* name) {
dwarf2reader::DIEHandler* handler google_breakpad::DIEHandler* handler
= parent->FindChildHandler(0x8f4c783c0467c989ULL, tag); = parent->FindChildHandler(0x8f4c783c0467c989ULL, tag);
if (!handler) if (!handler)
return NULL; return NULL;
if (name) if (name)
handler->ProcessAttributeString(dwarf2reader::DW_AT_name, handler->ProcessAttributeString(google_breakpad::DW_AT_name,
dwarf2reader::DW_FORM_strp, google_breakpad::DW_FORM_strp,
name); name);
handler->ProcessAttributeReference(dwarf2reader::DW_AT_specification, handler->ProcessAttributeReference(google_breakpad::DW_AT_specification,
dwarf2reader::DW_FORM_ref4, google_breakpad::DW_FORM_ref4,
specification); specification);
if (!handler->EndAttributes()) { if (!handler->EndAttributes()) {
handler->Finish(); handler->Finish();
@ -440,33 +440,33 @@ DIEHandler* CUFixtureBase::StartSpecifiedDIE(DIEHandler* parent,
return handler; return handler;
} }
void CUFixtureBase::DefineFunction(dwarf2reader::DIEHandler* parent, void CUFixtureBase::DefineFunction(google_breakpad::DIEHandler* parent,
const string& name, Module::Address address, const string& name, Module::Address address,
Module::Address size, Module::Address size,
const char* mangled_name, const char* mangled_name,
DwarfForm high_pc_form) { DwarfForm high_pc_form) {
dwarf2reader::DIEHandler* func google_breakpad::DIEHandler* func
= parent->FindChildHandler(0xe34797c7e68590a8LL, = parent->FindChildHandler(0xe34797c7e68590a8LL,
dwarf2reader::DW_TAG_subprogram); google_breakpad::DW_TAG_subprogram);
ASSERT_TRUE(func != NULL); ASSERT_TRUE(func != NULL);
func->ProcessAttributeString(dwarf2reader::DW_AT_name, func->ProcessAttributeString(google_breakpad::DW_AT_name,
dwarf2reader::DW_FORM_strp, google_breakpad::DW_FORM_strp,
name); name);
func->ProcessAttributeUnsigned(dwarf2reader::DW_AT_low_pc, func->ProcessAttributeUnsigned(google_breakpad::DW_AT_low_pc,
dwarf2reader::DW_FORM_addr, google_breakpad::DW_FORM_addr,
address); address);
Module::Address high_pc = size; Module::Address high_pc = size;
if (high_pc_form == dwarf2reader::DW_FORM_addr) { if (high_pc_form == google_breakpad::DW_FORM_addr) {
high_pc += address; high_pc += address;
} }
func->ProcessAttributeUnsigned(dwarf2reader::DW_AT_high_pc, func->ProcessAttributeUnsigned(google_breakpad::DW_AT_high_pc,
high_pc_form, high_pc_form,
high_pc); high_pc);
if (mangled_name) if (mangled_name)
func->ProcessAttributeString(dwarf2reader::DW_AT_MIPS_linkage_name, func->ProcessAttributeString(google_breakpad::DW_AT_MIPS_linkage_name,
dwarf2reader::DW_FORM_strp, google_breakpad::DW_FORM_strp,
mangled_name); mangled_name);
ProcessStrangeAttributes(func); ProcessStrangeAttributes(func);
@ -479,19 +479,19 @@ void CUFixtureBase::DeclarationDIE(DIEHandler* parent, uint64_t offset,
DwarfTag tag, DwarfTag tag,
const string& name, const string& name,
const string& mangled_name) { const string& mangled_name) {
dwarf2reader::DIEHandler* die = parent->FindChildHandler(offset, tag); google_breakpad::DIEHandler* die = parent->FindChildHandler(offset, tag);
ASSERT_TRUE(die != NULL); ASSERT_TRUE(die != NULL);
if (!name.empty()) if (!name.empty())
die->ProcessAttributeString(dwarf2reader::DW_AT_name, die->ProcessAttributeString(google_breakpad::DW_AT_name,
dwarf2reader::DW_FORM_strp, google_breakpad::DW_FORM_strp,
name); name);
if (!mangled_name.empty()) if (!mangled_name.empty())
die->ProcessAttributeString(dwarf2reader::DW_AT_MIPS_linkage_name, die->ProcessAttributeString(google_breakpad::DW_AT_MIPS_linkage_name,
dwarf2reader::DW_FORM_strp, google_breakpad::DW_FORM_strp,
mangled_name); mangled_name);
die->ProcessAttributeUnsigned(dwarf2reader::DW_AT_declaration, die->ProcessAttributeUnsigned(google_breakpad::DW_AT_declaration,
dwarf2reader::DW_FORM_flag, google_breakpad::DW_FORM_flag,
1); 1);
EXPECT_TRUE(die->EndAttributes()); EXPECT_TRUE(die->EndAttributes());
die->Finish(); die->Finish();
@ -504,22 +504,22 @@ void CUFixtureBase::DefinitionDIE(DIEHandler* parent,
const string& name, const string& name,
Module::Address address, Module::Address address,
Module::Address size) { Module::Address size) {
dwarf2reader::DIEHandler* die google_breakpad::DIEHandler* die
= parent->FindChildHandler(0x6ccfea031a9e6cc9ULL, tag); = parent->FindChildHandler(0x6ccfea031a9e6cc9ULL, tag);
ASSERT_TRUE(die != NULL); ASSERT_TRUE(die != NULL);
die->ProcessAttributeReference(dwarf2reader::DW_AT_specification, die->ProcessAttributeReference(google_breakpad::DW_AT_specification,
dwarf2reader::DW_FORM_ref4, google_breakpad::DW_FORM_ref4,
specification); specification);
if (!name.empty()) if (!name.empty())
die->ProcessAttributeString(dwarf2reader::DW_AT_name, die->ProcessAttributeString(google_breakpad::DW_AT_name,
dwarf2reader::DW_FORM_strp, google_breakpad::DW_FORM_strp,
name); name);
if (size) { if (size) {
die->ProcessAttributeUnsigned(dwarf2reader::DW_AT_low_pc, die->ProcessAttributeUnsigned(google_breakpad::DW_AT_low_pc,
dwarf2reader::DW_FORM_addr, google_breakpad::DW_FORM_addr,
address); address);
die->ProcessAttributeUnsigned(dwarf2reader::DW_AT_high_pc, die->ProcessAttributeUnsigned(google_breakpad::DW_AT_high_pc,
dwarf2reader::DW_FORM_addr, google_breakpad::DW_FORM_addr,
address + size); address + size);
} }
EXPECT_TRUE(die->EndAttributes()); EXPECT_TRUE(die->EndAttributes());
@ -533,21 +533,21 @@ void CUFixtureBase::AbstractInstanceDIE(DIEHandler* parent,
uint64_t specification, uint64_t specification,
const string& name, const string& name,
DwarfForm form) { DwarfForm form) {
dwarf2reader::DIEHandler* die google_breakpad::DIEHandler* die
= parent->FindChildHandler(offset, dwarf2reader::DW_TAG_subprogram); = parent->FindChildHandler(offset, google_breakpad::DW_TAG_subprogram);
ASSERT_TRUE(die != NULL); ASSERT_TRUE(die != NULL);
if (specification != 0ULL) if (specification != 0ULL)
die->ProcessAttributeReference(dwarf2reader::DW_AT_specification, die->ProcessAttributeReference(google_breakpad::DW_AT_specification,
dwarf2reader::DW_FORM_ref4, google_breakpad::DW_FORM_ref4,
specification); specification);
if (form == dwarf2reader::DW_FORM_sdata) { if (form == google_breakpad::DW_FORM_sdata) {
die->ProcessAttributeSigned(dwarf2reader::DW_AT_inline, form, type); die->ProcessAttributeSigned(google_breakpad::DW_AT_inline, form, type);
} else { } else {
die->ProcessAttributeUnsigned(dwarf2reader::DW_AT_inline, form, type); die->ProcessAttributeUnsigned(google_breakpad::DW_AT_inline, form, type);
} }
if (!name.empty()) if (!name.empty())
die->ProcessAttributeString(dwarf2reader::DW_AT_name, die->ProcessAttributeString(google_breakpad::DW_AT_name,
dwarf2reader::DW_FORM_strp, google_breakpad::DW_FORM_strp,
name); name);
EXPECT_TRUE(die->EndAttributes()); EXPECT_TRUE(die->EndAttributes());
@ -560,23 +560,23 @@ void CUFixtureBase::DefineInlineInstanceDIE(DIEHandler* parent,
uint64_t origin, uint64_t origin,
Module::Address address, Module::Address address,
Module::Address size) { Module::Address size) {
dwarf2reader::DIEHandler* func google_breakpad::DIEHandler* func
= parent->FindChildHandler(0x11c70f94c6e87ccdLL, = parent->FindChildHandler(0x11c70f94c6e87ccdLL,
dwarf2reader::DW_TAG_subprogram); google_breakpad::DW_TAG_subprogram);
ASSERT_TRUE(func != NULL); ASSERT_TRUE(func != NULL);
if (!name.empty()) { if (!name.empty()) {
func->ProcessAttributeString(dwarf2reader::DW_AT_name, func->ProcessAttributeString(google_breakpad::DW_AT_name,
dwarf2reader::DW_FORM_strp, google_breakpad::DW_FORM_strp,
name); name);
} }
func->ProcessAttributeUnsigned(dwarf2reader::DW_AT_low_pc, func->ProcessAttributeUnsigned(google_breakpad::DW_AT_low_pc,
dwarf2reader::DW_FORM_addr, google_breakpad::DW_FORM_addr,
address); address);
func->ProcessAttributeUnsigned(dwarf2reader::DW_AT_high_pc, func->ProcessAttributeUnsigned(google_breakpad::DW_AT_high_pc,
dwarf2reader::DW_FORM_addr, google_breakpad::DW_FORM_addr,
address + size); address + size);
func->ProcessAttributeReference(dwarf2reader::DW_AT_abstract_origin, func->ProcessAttributeReference(google_breakpad::DW_AT_abstract_origin,
dwarf2reader::DW_FORM_ref4, google_breakpad::DW_FORM_ref4,
origin); origin);
ProcessStrangeAttributes(func); ProcessStrangeAttributes(func);
EXPECT_TRUE(func->EndAttributes()); EXPECT_TRUE(func->EndAttributes());
@ -681,7 +681,7 @@ TEST_F(SimpleCU, OneFuncHighPcIsLength) {
StartCU(); StartCU();
DefineFunction6(&root_handler_, "function1", DefineFunction6(&root_handler_, "function1",
0x938cf8c07def4d34ULL, 0x55592d727f6cd01fLL, NULL, 0x938cf8c07def4d34ULL, 0x55592d727f6cd01fLL, NULL,
dwarf2reader::DW_FORM_udata); google_breakpad::DW_FORM_udata);
root_handler_.Finish(); root_handler_.Finish();
TestFunctionCount(1); TestFunctionCount(1);
@ -707,17 +707,17 @@ TEST_F(SimpleCU, IrrelevantRootChildren) {
StartCU(); StartCU();
EXPECT_FALSE(root_handler_ EXPECT_FALSE(root_handler_
.FindChildHandler(0x7db32bff4e2dcfb1ULL, .FindChildHandler(0x7db32bff4e2dcfb1ULL,
dwarf2reader::DW_TAG_lexical_block)); google_breakpad::DW_TAG_lexical_block));
} }
TEST_F(SimpleCU, IrrelevantNamedScopeChildren) { TEST_F(SimpleCU, IrrelevantNamedScopeChildren) {
StartCU(); StartCU();
DIEHandler* class_A_handler DIEHandler* class_A_handler
= StartNamedDIE(&root_handler_, dwarf2reader::DW_TAG_class_type, "class_A"); = StartNamedDIE(&root_handler_, google_breakpad::DW_TAG_class_type, "class_A");
EXPECT_TRUE(class_A_handler != NULL); EXPECT_TRUE(class_A_handler != NULL);
EXPECT_FALSE(class_A_handler EXPECT_FALSE(class_A_handler
->FindChildHandler(0x02e55999b865e4e9ULL, ->FindChildHandler(0x02e55999b865e4e9ULL,
dwarf2reader::DW_TAG_lexical_block)); google_breakpad::DW_TAG_lexical_block));
delete class_A_handler; delete class_A_handler;
} }
@ -735,7 +735,7 @@ TEST_F(SimpleCU, InlineFunction) {
StartCU(); StartCU();
AbstractInstanceDIE(&root_handler_, 0x1e8dac5d507ed7abULL, AbstractInstanceDIE(&root_handler_, 0x1e8dac5d507ed7abULL,
dwarf2reader::DW_INL_inlined, 0, "inline-name"); google_breakpad::DW_INL_inlined, 0, "inline-name");
DefineInlineInstanceDIE(&root_handler_, "", 0x1e8dac5d507ed7abULL, DefineInlineInstanceDIE(&root_handler_, "", 0x1e8dac5d507ed7abULL,
0x1758a0f941b71efbULL, 0x1cf154f1f545e146ULL); 0x1758a0f941b71efbULL, 0x1cf154f1f545e146ULL);
root_handler_.Finish(); root_handler_.Finish();
@ -750,8 +750,8 @@ TEST_F(SimpleCU, InlineFunctionSignedAttribute) {
StartCU(); StartCU();
AbstractInstanceDIE(&root_handler_, 0x1e8dac5d507ed7abULL, AbstractInstanceDIE(&root_handler_, 0x1e8dac5d507ed7abULL,
dwarf2reader::DW_INL_inlined, 0, "inline-name", google_breakpad::DW_INL_inlined, 0, "inline-name",
dwarf2reader::DW_FORM_sdata); google_breakpad::DW_FORM_sdata);
DefineInlineInstanceDIE(&root_handler_, "", 0x1e8dac5d507ed7abULL, DefineInlineInstanceDIE(&root_handler_, "", 0x1e8dac5d507ed7abULL,
0x1758a0f941b71efbULL, 0x1cf154f1f545e146ULL); 0x1758a0f941b71efbULL, 0x1cf154f1f545e146ULL);
root_handler_.Finish(); root_handler_.Finish();
@ -769,7 +769,7 @@ TEST_F(SimpleCU, AbstractOriginNotInlined) {
StartCU(); StartCU();
AbstractInstanceDIE(&root_handler_, 0x93e9cdad52826b39ULL, AbstractInstanceDIE(&root_handler_, 0x93e9cdad52826b39ULL,
dwarf2reader::DW_INL_not_inlined, 0, "abstract-instance"); google_breakpad::DW_INL_not_inlined, 0, "abstract-instance");
DefineInlineInstanceDIE(&root_handler_, "", 0x93e9cdad52826b39ULL, DefineInlineInstanceDIE(&root_handler_, "", 0x93e9cdad52826b39ULL,
0x2805c4531be6ca0eULL, 0x686b52155a8d4d2cULL); 0x2805c4531be6ca0eULL, 0x686b52155a8d4d2cULL);
root_handler_.Finish(); root_handler_.Finish();
@ -787,7 +787,7 @@ TEST_F(SimpleCU, UnknownAbstractOrigin) {
StartCU(); StartCU();
AbstractInstanceDIE(&root_handler_, 0x1e8dac5d507ed7abULL, AbstractInstanceDIE(&root_handler_, 0x1e8dac5d507ed7abULL,
dwarf2reader::DW_INL_inlined, 0, "inline-name"); google_breakpad::DW_INL_inlined, 0, "inline-name");
DefineInlineInstanceDIE(&root_handler_, "", 1ULL, DefineInlineInstanceDIE(&root_handler_, "", 1ULL,
0x1758a0f941b71efbULL, 0x1cf154f1f545e146ULL); 0x1758a0f941b71efbULL, 0x1cf154f1f545e146ULL);
root_handler_.Finish(); root_handler_.Finish();
@ -1045,15 +1045,15 @@ class CXXQualifiedNames: public CUFixtureBase,
public TestWithParam<DwarfTag> { }; public TestWithParam<DwarfTag> { };
INSTANTIATE_TEST_SUITE_P(VersusEnclosures, CXXQualifiedNames, INSTANTIATE_TEST_SUITE_P(VersusEnclosures, CXXQualifiedNames,
Values(dwarf2reader::DW_TAG_class_type, Values(google_breakpad::DW_TAG_class_type,
dwarf2reader::DW_TAG_structure_type, google_breakpad::DW_TAG_structure_type,
dwarf2reader::DW_TAG_union_type, google_breakpad::DW_TAG_union_type,
dwarf2reader::DW_TAG_namespace)); google_breakpad::DW_TAG_namespace));
TEST_P(CXXQualifiedNames, TwoFunctions) { TEST_P(CXXQualifiedNames, TwoFunctions) {
DwarfTag tag = GetParam(); DwarfTag tag = GetParam();
SetLanguage(dwarf2reader::DW_LANG_C_plus_plus); SetLanguage(google_breakpad::DW_LANG_C_plus_plus);
PushLine(10, 1, "filename1", 69819327); PushLine(10, 1, "filename1", 69819327);
PushLine(20, 1, "filename2", 95115701); PushLine(20, 1, "filename2", 95115701);
@ -1075,12 +1075,12 @@ TEST_P(CXXQualifiedNames, TwoFunctions) {
TEST_P(CXXQualifiedNames, FuncInEnclosureInNamespace) { TEST_P(CXXQualifiedNames, FuncInEnclosureInNamespace) {
DwarfTag tag = GetParam(); DwarfTag tag = GetParam();
SetLanguage(dwarf2reader::DW_LANG_C_plus_plus); SetLanguage(google_breakpad::DW_LANG_C_plus_plus);
PushLine(10, 1, "line-file", 69819327); PushLine(10, 1, "line-file", 69819327);
StartCU(); StartCU();
DIEHandler* namespace_handler DIEHandler* namespace_handler
= StartNamedDIE(&root_handler_, dwarf2reader::DW_TAG_namespace, = StartNamedDIE(&root_handler_, google_breakpad::DW_TAG_namespace,
"Namespace"); "Namespace");
EXPECT_TRUE(namespace_handler != NULL); EXPECT_TRUE(namespace_handler != NULL);
DIEHandler* enclosure_handler = StartNamedDIE(namespace_handler, tag, DIEHandler* enclosure_handler = StartNamedDIE(namespace_handler, tag,
@ -1098,20 +1098,20 @@ TEST_P(CXXQualifiedNames, FuncInEnclosureInNamespace) {
} }
TEST_F(CXXQualifiedNames, FunctionInClassInStructInNamespace) { TEST_F(CXXQualifiedNames, FunctionInClassInStructInNamespace) {
SetLanguage(dwarf2reader::DW_LANG_C_plus_plus); SetLanguage(google_breakpad::DW_LANG_C_plus_plus);
PushLine(10, 1, "filename1", 69819327); PushLine(10, 1, "filename1", 69819327);
StartCU(); StartCU();
DIEHandler* namespace_handler DIEHandler* namespace_handler
= StartNamedDIE(&root_handler_, dwarf2reader::DW_TAG_namespace, = StartNamedDIE(&root_handler_, google_breakpad::DW_TAG_namespace,
"namespace_A"); "namespace_A");
EXPECT_TRUE(namespace_handler != NULL); EXPECT_TRUE(namespace_handler != NULL);
DIEHandler* struct_handler DIEHandler* struct_handler
= StartNamedDIE(namespace_handler, dwarf2reader::DW_TAG_structure_type, = StartNamedDIE(namespace_handler, google_breakpad::DW_TAG_structure_type,
"struct_B"); "struct_B");
EXPECT_TRUE(struct_handler != NULL); EXPECT_TRUE(struct_handler != NULL);
DIEHandler* class_handler DIEHandler* class_handler
= StartNamedDIE(struct_handler, dwarf2reader::DW_TAG_class_type, = StartNamedDIE(struct_handler, google_breakpad::DW_TAG_class_type,
"class_C"); "class_C");
DefineFunction(class_handler, "function_D", 10, 1, NULL); DefineFunction(class_handler, "function_D", 10, 1, NULL);
class_handler->Finish(); class_handler->Finish();
@ -1127,19 +1127,19 @@ TEST_F(CXXQualifiedNames, FunctionInClassInStructInNamespace) {
} }
struct LanguageAndQualifiedName { struct LanguageAndQualifiedName {
dwarf2reader::DwarfLanguage language; google_breakpad::DwarfLanguage language;
const char* name; const char* name;
}; };
const LanguageAndQualifiedName LanguageAndQualifiedNameCases[] = { const LanguageAndQualifiedName LanguageAndQualifiedNameCases[] = {
{ dwarf2reader::DW_LANG_none, "class_A::function_B" }, { google_breakpad::DW_LANG_none, "class_A::function_B" },
{ dwarf2reader::DW_LANG_C, "class_A::function_B" }, { google_breakpad::DW_LANG_C, "class_A::function_B" },
{ dwarf2reader::DW_LANG_C89, "class_A::function_B" }, { google_breakpad::DW_LANG_C89, "class_A::function_B" },
{ dwarf2reader::DW_LANG_C99, "class_A::function_B" }, { google_breakpad::DW_LANG_C99, "class_A::function_B" },
{ dwarf2reader::DW_LANG_C_plus_plus, "class_A::function_B" }, { google_breakpad::DW_LANG_C_plus_plus, "class_A::function_B" },
{ dwarf2reader::DW_LANG_Java, "class_A.function_B" }, { google_breakpad::DW_LANG_Java, "class_A.function_B" },
{ dwarf2reader::DW_LANG_Cobol74, "class_A::function_B" }, { google_breakpad::DW_LANG_Cobol74, "class_A::function_B" },
{ dwarf2reader::DW_LANG_Mips_Assembler, NULL } { google_breakpad::DW_LANG_Mips_Assembler, NULL }
}; };
class QualifiedForLanguage class QualifiedForLanguage
@ -1157,7 +1157,7 @@ TEST_P(QualifiedForLanguage, MemberFunction) {
StartCU(); StartCU();
DIEHandler* class_handler DIEHandler* class_handler
= StartNamedDIE(&root_handler_, dwarf2reader::DW_TAG_class_type, = StartNamedDIE(&root_handler_, google_breakpad::DW_TAG_class_type,
"class_A"); "class_A");
DefineFunction(class_handler, "function_B", 10, 1, NULL); DefineFunction(class_handler, "function_B", 10, 1, NULL);
class_handler->Finish(); class_handler->Finish();
@ -1181,7 +1181,7 @@ TEST_P(QualifiedForLanguage, MemberFunctionSignedLanguage) {
StartCU(); StartCU();
DIEHandler* class_handler DIEHandler* class_handler
= StartNamedDIE(&root_handler_, dwarf2reader::DW_TAG_class_type, = StartNamedDIE(&root_handler_, google_breakpad::DW_TAG_class_type,
"class_A"); "class_A");
DefineFunction(class_handler, "function_B", 10, 1, NULL); DefineFunction(class_handler, "function_B", 10, 1, NULL);
class_handler->Finish(); class_handler->Finish();
@ -1203,8 +1203,8 @@ TEST_F(Specifications, Function) {
StartCU(); StartCU();
DeclarationDIE(&root_handler_, 0xcd3c51b946fb1eeeLL, DeclarationDIE(&root_handler_, 0xcd3c51b946fb1eeeLL,
dwarf2reader::DW_TAG_subprogram, "declaration-name", ""); google_breakpad::DW_TAG_subprogram, "declaration-name", "");
DefinitionDIE(&root_handler_, dwarf2reader::DW_TAG_subprogram, DefinitionDIE(&root_handler_, google_breakpad::DW_TAG_subprogram,
0xcd3c51b946fb1eeeLL, "", 0xcd3c51b946fb1eeeLL, "",
0x93cd3dfc1aa10097ULL, 0x0397d47a0b4ca0d4ULL); 0x93cd3dfc1aa10097ULL, 0x0397d47a0b4ca0d4ULL);
root_handler_.Finish(); root_handler_.Finish();
@ -1220,9 +1220,9 @@ TEST_F(Specifications, MangledName) {
StartCU(); StartCU();
DeclarationDIE(&root_handler_, 0xcd3c51b946fb1eeeLL, DeclarationDIE(&root_handler_, 0xcd3c51b946fb1eeeLL,
dwarf2reader::DW_TAG_subprogram, "declaration-name", google_breakpad::DW_TAG_subprogram, "declaration-name",
"_ZN1C1fEi"); "_ZN1C1fEi");
DefinitionDIE(&root_handler_, dwarf2reader::DW_TAG_subprogram, DefinitionDIE(&root_handler_, google_breakpad::DW_TAG_subprogram,
0xcd3c51b946fb1eeeLL, "", 0xcd3c51b946fb1eeeLL, "",
0x93cd3dfc1aa10097ULL, 0x0397d47a0b4ca0d4ULL); 0x93cd3dfc1aa10097ULL, 0x0397d47a0b4ca0d4ULL);
root_handler_.Finish(); root_handler_.Finish();
@ -1234,14 +1234,14 @@ TEST_F(Specifications, MangledName) {
TEST_F(Specifications, MangledNameSwift) { TEST_F(Specifications, MangledNameSwift) {
// Swift mangled names should pass through untouched. // Swift mangled names should pass through untouched.
SetLanguage(dwarf2reader::DW_LANG_Swift); SetLanguage(google_breakpad::DW_LANG_Swift);
PushLine(0x93cd3dfc1aa10097ULL, 0x0397d47a0b4ca0d4ULL, "line-file", 54883661); PushLine(0x93cd3dfc1aa10097ULL, 0x0397d47a0b4ca0d4ULL, "line-file", 54883661);
StartCU(); StartCU();
const string kName = "_TFC9swifttest5Shape17simpleDescriptionfS0_FT_Si"; const string kName = "_TFC9swifttest5Shape17simpleDescriptionfS0_FT_Si";
DeclarationDIE(&root_handler_, 0xcd3c51b946fb1eeeLL, DeclarationDIE(&root_handler_, 0xcd3c51b946fb1eeeLL,
dwarf2reader::DW_TAG_subprogram, "declaration-name", google_breakpad::DW_TAG_subprogram, "declaration-name",
kName); kName);
DefinitionDIE(&root_handler_, dwarf2reader::DW_TAG_subprogram, DefinitionDIE(&root_handler_, google_breakpad::DW_TAG_subprogram,
0xcd3c51b946fb1eeeLL, "", 0xcd3c51b946fb1eeeLL, "",
0x93cd3dfc1aa10097ULL, 0x0397d47a0b4ca0d4ULL); 0x93cd3dfc1aa10097ULL, 0x0397d47a0b4ca0d4ULL);
root_handler_.Finish(); root_handler_.Finish();
@ -1252,15 +1252,15 @@ TEST_F(Specifications, MangledNameSwift) {
} }
TEST_F(Specifications, MangledNameRust) { TEST_F(Specifications, MangledNameRust) {
SetLanguage(dwarf2reader::DW_LANG_Rust); SetLanguage(google_breakpad::DW_LANG_Rust);
PushLine(0x93cd3dfc1aa10097ULL, 0x0397d47a0b4ca0d4ULL, "line-file", 54883661); PushLine(0x93cd3dfc1aa10097ULL, 0x0397d47a0b4ca0d4ULL, "line-file", 54883661);
StartCU(); StartCU();
const string kName = "_ZN14rustc_demangle8demangle17h373defa94bffacdeE"; const string kName = "_ZN14rustc_demangle8demangle17h373defa94bffacdeE";
DeclarationDIE(&root_handler_, 0xcd3c51b946fb1eeeLL, DeclarationDIE(&root_handler_, 0xcd3c51b946fb1eeeLL,
dwarf2reader::DW_TAG_subprogram, "declaration-name", google_breakpad::DW_TAG_subprogram, "declaration-name",
kName); kName);
DefinitionDIE(&root_handler_, dwarf2reader::DW_TAG_subprogram, DefinitionDIE(&root_handler_, google_breakpad::DW_TAG_subprogram,
0xcd3c51b946fb1eeeLL, "", 0xcd3c51b946fb1eeeLL, "",
0x93cd3dfc1aa10097ULL, 0x0397d47a0b4ca0d4ULL); 0x93cd3dfc1aa10097ULL, 0x0397d47a0b4ca0d4ULL);
root_handler_.Finish(); root_handler_.Finish();
@ -1284,12 +1284,12 @@ TEST_F(Specifications, MemberFunction) {
StartCU(); StartCU();
DIEHandler* class_handler DIEHandler* class_handler
= StartNamedDIE(&root_handler_, dwarf2reader::DW_TAG_class_type, "class_A"); = StartNamedDIE(&root_handler_, google_breakpad::DW_TAG_class_type, "class_A");
DeclarationDIE(class_handler, 0x7d83028c431406e8ULL, DeclarationDIE(class_handler, 0x7d83028c431406e8ULL,
dwarf2reader::DW_TAG_subprogram, "declaration-name", ""); google_breakpad::DW_TAG_subprogram, "declaration-name", "");
class_handler->Finish(); class_handler->Finish();
delete class_handler; delete class_handler;
DefinitionDIE(&root_handler_, dwarf2reader::DW_TAG_subprogram, DefinitionDIE(&root_handler_, google_breakpad::DW_TAG_subprogram,
0x7d83028c431406e8ULL, "", 0x7d83028c431406e8ULL, "",
0x3341a248634e7170ULL, 0x5f6938ee5553b953ULL); 0x3341a248634e7170ULL, 0x5f6938ee5553b953ULL);
root_handler_.Finish(); root_handler_.Finish();
@ -1307,16 +1307,16 @@ TEST_F(Specifications, FunctionDeclarationParent) {
StartCU(); StartCU();
{ {
DIEHandler* class_handler DIEHandler* class_handler
= StartNamedDIE(&root_handler_, dwarf2reader::DW_TAG_class_type, = StartNamedDIE(&root_handler_, google_breakpad::DW_TAG_class_type,
"class_A"); "class_A");
ASSERT_TRUE(class_handler != NULL); ASSERT_TRUE(class_handler != NULL);
DeclarationDIE(class_handler, 0x0e0e877c8404544aULL, DeclarationDIE(class_handler, 0x0e0e877c8404544aULL,
dwarf2reader::DW_TAG_subprogram, "declaration-name", ""); google_breakpad::DW_TAG_subprogram, "declaration-name", "");
class_handler->Finish(); class_handler->Finish();
delete class_handler; delete class_handler;
} }
DefinitionDIE(&root_handler_, dwarf2reader::DW_TAG_subprogram, DefinitionDIE(&root_handler_, google_breakpad::DW_TAG_subprogram,
0x0e0e877c8404544aULL, "definition-name", 0x0e0e877c8404544aULL, "definition-name",
0x463c9ddf405be227ULL, 0x6a47774af5049680ULL); 0x463c9ddf405be227ULL, 0x6a47774af5049680ULL);
@ -1335,11 +1335,11 @@ TEST_F(Specifications, NamedScopeDeclarationParent) {
StartCU(); StartCU();
{ {
DIEHandler* space_handler DIEHandler* space_handler
= StartNamedDIE(&root_handler_, dwarf2reader::DW_TAG_namespace, = StartNamedDIE(&root_handler_, google_breakpad::DW_TAG_namespace,
"space_A"); "space_A");
ASSERT_TRUE(space_handler != NULL); ASSERT_TRUE(space_handler != NULL);
DeclarationDIE(space_handler, 0x419bb1d12f9a73a2ULL, DeclarationDIE(space_handler, 0x419bb1d12f9a73a2ULL,
dwarf2reader::DW_TAG_class_type, "class-declaration-name", google_breakpad::DW_TAG_class_type, "class-declaration-name",
""); "");
space_handler->Finish(); space_handler->Finish();
delete space_handler; delete space_handler;
@ -1347,7 +1347,7 @@ TEST_F(Specifications, NamedScopeDeclarationParent) {
{ {
DIEHandler* class_handler DIEHandler* class_handler
= StartSpecifiedDIE(&root_handler_, dwarf2reader::DW_TAG_class_type, = StartSpecifiedDIE(&root_handler_, google_breakpad::DW_TAG_class_type,
0x419bb1d12f9a73a2ULL, "class-definition-name"); 0x419bb1d12f9a73a2ULL, "class-definition-name");
ASSERT_TRUE(class_handler != NULL); ASSERT_TRUE(class_handler != NULL);
DefineFunction(class_handler, "function", DefineFunction(class_handler, "function",
@ -1369,9 +1369,9 @@ TEST_F(Specifications, InlineFunction) {
StartCU(); StartCU();
DeclarationDIE(&root_handler_, 0xcd3c51b946fb1eeeLL, DeclarationDIE(&root_handler_, 0xcd3c51b946fb1eeeLL,
dwarf2reader::DW_TAG_subprogram, "inline-name", ""); google_breakpad::DW_TAG_subprogram, "inline-name", "");
AbstractInstanceDIE(&root_handler_, 0x1e8dac5d507ed7abULL, AbstractInstanceDIE(&root_handler_, 0x1e8dac5d507ed7abULL,
dwarf2reader::DW_INL_inlined, 0xcd3c51b946fb1eeeLL, ""); google_breakpad::DW_INL_inlined, 0xcd3c51b946fb1eeeLL, "");
DefineInlineInstanceDIE(&root_handler_, "", 0x1e8dac5d507ed7abULL, DefineInlineInstanceDIE(&root_handler_, "", 0x1e8dac5d507ed7abULL,
0x1758a0f941b71efbULL, 0x1cf154f1f545e146ULL); 0x1758a0f941b71efbULL, 0x1cf154f1f545e146ULL);
root_handler_.Finish(); root_handler_.Finish();
@ -1388,11 +1388,11 @@ TEST_F(Specifications, InlineFunctionInNamespace) {
StartCU(); StartCU();
DIEHandler* space_handler DIEHandler* space_handler
= StartNamedDIE(&root_handler_, dwarf2reader::DW_TAG_namespace, = StartNamedDIE(&root_handler_, google_breakpad::DW_TAG_namespace,
"Namespace"); "Namespace");
ASSERT_TRUE(space_handler != NULL); ASSERT_TRUE(space_handler != NULL);
AbstractInstanceDIE(space_handler, 0x1e8dac5d507ed7abULL, AbstractInstanceDIE(space_handler, 0x1e8dac5d507ed7abULL,
dwarf2reader::DW_INL_inlined, 0LL, "func-name"); google_breakpad::DW_INL_inlined, 0LL, "func-name");
DefineInlineInstanceDIE(space_handler, "", 0x1e8dac5d507ed7abULL, DefineInlineInstanceDIE(space_handler, "", 0x1e8dac5d507ed7abULL,
0x1758a0f941b71efbULL, 0x1cf154f1f545e146ULL); 0x1758a0f941b71efbULL, 0x1cf154f1f545e146ULL);
space_handler->Finish(); space_handler->Finish();
@ -1409,7 +1409,7 @@ TEST_F(Specifications, InlineFunctionInNamespace) {
// - direct and definition // - direct and definition
TEST_F(Specifications, LongChain) { TEST_F(Specifications, LongChain) {
PushLine(0x5a0dd6bb85db754cULL, 0x3bccb213d08c7fd3ULL, "line-file", 21192926); PushLine(0x5a0dd6bb85db754cULL, 0x3bccb213d08c7fd3ULL, "line-file", 21192926);
SetLanguage(dwarf2reader::DW_LANG_C_plus_plus); SetLanguage(google_breakpad::DW_LANG_C_plus_plus);
StartCU(); StartCU();
// The structure we're building here is: // The structure we're building here is:
@ -1439,23 +1439,23 @@ TEST_F(Specifications, LongChain) {
// class_G::class_H::func_I // class_G::class_H::func_I
{ {
DIEHandler* space_A_handler DIEHandler* space_A_handler
= StartNamedDIE(&root_handler_, dwarf2reader::DW_TAG_namespace, = StartNamedDIE(&root_handler_, google_breakpad::DW_TAG_namespace,
"space_A"); "space_A");
DeclarationDIE(space_A_handler, 0x2e111126496596e2ULL, DeclarationDIE(space_A_handler, 0x2e111126496596e2ULL,
dwarf2reader::DW_TAG_namespace, "space_B", ""); google_breakpad::DW_TAG_namespace, "space_B", "");
space_A_handler->Finish(); space_A_handler->Finish();
delete space_A_handler; delete space_A_handler;
} }
{ {
DIEHandler* space_B_handler DIEHandler* space_B_handler
= StartSpecifiedDIE(&root_handler_, dwarf2reader::DW_TAG_namespace, = StartSpecifiedDIE(&root_handler_, google_breakpad::DW_TAG_namespace,
0x2e111126496596e2ULL); 0x2e111126496596e2ULL);
DIEHandler* struct_C_handler DIEHandler* struct_C_handler
= StartNamedDIE(space_B_handler, dwarf2reader::DW_TAG_structure_type, = StartNamedDIE(space_B_handler, google_breakpad::DW_TAG_structure_type,
"struct_C"); "struct_C");
DeclarationDIE(struct_C_handler, 0x20cd423bf2a25a4cULL, DeclarationDIE(struct_C_handler, 0x20cd423bf2a25a4cULL,
dwarf2reader::DW_TAG_structure_type, "struct_D", ""); google_breakpad::DW_TAG_structure_type, "struct_D", "");
struct_C_handler->Finish(); struct_C_handler->Finish();
delete struct_C_handler; delete struct_C_handler;
space_B_handler->Finish(); space_B_handler->Finish();
@ -1464,13 +1464,13 @@ TEST_F(Specifications, LongChain) {
{ {
DIEHandler* struct_D_handler DIEHandler* struct_D_handler
= StartSpecifiedDIE(&root_handler_, dwarf2reader::DW_TAG_structure_type, = StartSpecifiedDIE(&root_handler_, google_breakpad::DW_TAG_structure_type,
0x20cd423bf2a25a4cULL); 0x20cd423bf2a25a4cULL);
DIEHandler* union_E_handler DIEHandler* union_E_handler
= StartNamedDIE(struct_D_handler, dwarf2reader::DW_TAG_union_type, = StartNamedDIE(struct_D_handler, google_breakpad::DW_TAG_union_type,
"union_E"); "union_E");
DeclarationDIE(union_E_handler, 0xe25c84805aa58c32ULL, DeclarationDIE(union_E_handler, 0xe25c84805aa58c32ULL,
dwarf2reader::DW_TAG_union_type, "union_F", ""); google_breakpad::DW_TAG_union_type, "union_F", "");
union_E_handler->Finish(); union_E_handler->Finish();
delete union_E_handler; delete union_E_handler;
struct_D_handler->Finish(); struct_D_handler->Finish();
@ -1479,13 +1479,13 @@ TEST_F(Specifications, LongChain) {
{ {
DIEHandler* union_F_handler DIEHandler* union_F_handler
= StartSpecifiedDIE(&root_handler_, dwarf2reader::DW_TAG_union_type, = StartSpecifiedDIE(&root_handler_, google_breakpad::DW_TAG_union_type,
0xe25c84805aa58c32ULL); 0xe25c84805aa58c32ULL);
DIEHandler* class_G_handler DIEHandler* class_G_handler
= StartNamedDIE(union_F_handler, dwarf2reader::DW_TAG_class_type, = StartNamedDIE(union_F_handler, google_breakpad::DW_TAG_class_type,
"class_G"); "class_G");
DeclarationDIE(class_G_handler, 0xb70d960dcc173b6eULL, DeclarationDIE(class_G_handler, 0xb70d960dcc173b6eULL,
dwarf2reader::DW_TAG_class_type, "class_H", ""); google_breakpad::DW_TAG_class_type, "class_H", "");
class_G_handler->Finish(); class_G_handler->Finish();
delete class_G_handler; delete class_G_handler;
union_F_handler->Finish(); union_F_handler->Finish();
@ -1494,15 +1494,15 @@ TEST_F(Specifications, LongChain) {
{ {
DIEHandler* class_H_handler DIEHandler* class_H_handler
= StartSpecifiedDIE(&root_handler_, dwarf2reader::DW_TAG_class_type, = StartSpecifiedDIE(&root_handler_, google_breakpad::DW_TAG_class_type,
0xb70d960dcc173b6eULL); 0xb70d960dcc173b6eULL);
DeclarationDIE(class_H_handler, 0x27ff829e3bf69f37ULL, DeclarationDIE(class_H_handler, 0x27ff829e3bf69f37ULL,
dwarf2reader::DW_TAG_subprogram, "func_I", ""); google_breakpad::DW_TAG_subprogram, "func_I", "");
class_H_handler->Finish(); class_H_handler->Finish();
delete class_H_handler; delete class_H_handler;
} }
DefinitionDIE(&root_handler_, dwarf2reader::DW_TAG_subprogram, DefinitionDIE(&root_handler_, google_breakpad::DW_TAG_subprogram,
0x27ff829e3bf69f37ULL, "", 0x27ff829e3bf69f37ULL, "",
0x5a0dd6bb85db754cULL, 0x3bccb213d08c7fd3ULL); 0x5a0dd6bb85db754cULL, 0x3bccb213d08c7fd3ULL);
root_handler_.Finish(); root_handler_.Finish();
@ -1528,11 +1528,11 @@ TEST_F(Specifications, InterCU) {
DwarfCUToModule root1_handler(&fc, &lr, nullptr, &reporter_); DwarfCUToModule root1_handler(&fc, &lr, nullptr, &reporter_);
ASSERT_TRUE(root1_handler.StartCompilationUnit(0, 1, 2, 3, 3)); ASSERT_TRUE(root1_handler.StartCompilationUnit(0, 1, 2, 3, 3));
ASSERT_TRUE(root1_handler.StartRootDIE(1, ASSERT_TRUE(root1_handler.StartRootDIE(1,
dwarf2reader::DW_TAG_compile_unit)); google_breakpad::DW_TAG_compile_unit));
ProcessStrangeAttributes(&root1_handler); ProcessStrangeAttributes(&root1_handler);
ASSERT_TRUE(root1_handler.EndAttributes()); ASSERT_TRUE(root1_handler.EndAttributes());
DeclarationDIE(&root1_handler, 0xb8fbfdd5f0b26fceULL, DeclarationDIE(&root1_handler, 0xb8fbfdd5f0b26fceULL,
dwarf2reader::DW_TAG_class_type, "class_A", ""); google_breakpad::DW_TAG_class_type, "class_A", "");
root1_handler.Finish(); root1_handler.Finish();
} }
@ -1541,13 +1541,13 @@ TEST_F(Specifications, InterCU) {
DwarfCUToModule root2_handler(&fc, &lr, nullptr, &reporter_); DwarfCUToModule root2_handler(&fc, &lr, nullptr, &reporter_);
ASSERT_TRUE(root2_handler.StartCompilationUnit(0, 1, 2, 3, 3)); ASSERT_TRUE(root2_handler.StartCompilationUnit(0, 1, 2, 3, 3));
ASSERT_TRUE(root2_handler.StartRootDIE(1, ASSERT_TRUE(root2_handler.StartRootDIE(1,
dwarf2reader::DW_TAG_compile_unit)); google_breakpad::DW_TAG_compile_unit));
ASSERT_TRUE(root2_handler.EndAttributes()); ASSERT_TRUE(root2_handler.EndAttributes());
DIEHandler* class_A_handler DIEHandler* class_A_handler
= StartSpecifiedDIE(&root2_handler, dwarf2reader::DW_TAG_class_type, = StartSpecifiedDIE(&root2_handler, google_breakpad::DW_TAG_class_type,
0xb8fbfdd5f0b26fceULL); 0xb8fbfdd5f0b26fceULL);
DeclarationDIE(class_A_handler, 0xb01fef8b380bd1a2ULL, DeclarationDIE(class_A_handler, 0xb01fef8b380bd1a2ULL,
dwarf2reader::DW_TAG_subprogram, "member_func_B", ""); google_breakpad::DW_TAG_subprogram, "member_func_B", "");
class_A_handler->Finish(); class_A_handler->Finish();
delete class_A_handler; delete class_A_handler;
root2_handler.Finish(); root2_handler.Finish();
@ -1558,9 +1558,9 @@ TEST_F(Specifications, InterCU) {
DwarfCUToModule root3_handler(&fc, &lr, nullptr, &reporter_); DwarfCUToModule root3_handler(&fc, &lr, nullptr, &reporter_);
ASSERT_TRUE(root3_handler.StartCompilationUnit(0, 1, 2, 3, 3)); ASSERT_TRUE(root3_handler.StartCompilationUnit(0, 1, 2, 3, 3));
ASSERT_TRUE(root3_handler.StartRootDIE(1, ASSERT_TRUE(root3_handler.StartRootDIE(1,
dwarf2reader::DW_TAG_compile_unit)); google_breakpad::DW_TAG_compile_unit));
ASSERT_TRUE(root3_handler.EndAttributes()); ASSERT_TRUE(root3_handler.EndAttributes());
DefinitionDIE(&root3_handler, dwarf2reader::DW_TAG_subprogram, DefinitionDIE(&root3_handler, google_breakpad::DW_TAG_subprogram,
0xb01fef8b380bd1a2ULL, "", 0xb01fef8b380bd1a2ULL, "",
0x2618f00a1a711e53ULL, 0x4fd94b76d7c2caf5ULL); 0x2618f00a1a711e53ULL, 0x4fd94b76d7c2caf5ULL);
root3_handler.Finish(); root3_handler.Finish();
@ -1587,11 +1587,11 @@ TEST_F(Specifications, UnhandledInterCU) {
DwarfCUToModule root1_handler(&fc, &lr, nullptr, &reporter_); DwarfCUToModule root1_handler(&fc, &lr, nullptr, &reporter_);
ASSERT_TRUE(root1_handler.StartCompilationUnit(0, 1, 2, 3, 3)); ASSERT_TRUE(root1_handler.StartCompilationUnit(0, 1, 2, 3, 3));
ASSERT_TRUE(root1_handler.StartRootDIE(1, ASSERT_TRUE(root1_handler.StartRootDIE(1,
dwarf2reader::DW_TAG_compile_unit)); google_breakpad::DW_TAG_compile_unit));
ProcessStrangeAttributes(&root1_handler); ProcessStrangeAttributes(&root1_handler);
ASSERT_TRUE(root1_handler.EndAttributes()); ASSERT_TRUE(root1_handler.EndAttributes());
DeclarationDIE(&root1_handler, 0xb8fbfdd5f0b26fceULL, DeclarationDIE(&root1_handler, 0xb8fbfdd5f0b26fceULL,
dwarf2reader::DW_TAG_class_type, "class_A", ""); google_breakpad::DW_TAG_class_type, "class_A", "");
root1_handler.Finish(); root1_handler.Finish();
} }
@ -1600,14 +1600,14 @@ TEST_F(Specifications, UnhandledInterCU) {
DwarfCUToModule root2_handler(&fc, &lr, nullptr, &reporter_); DwarfCUToModule root2_handler(&fc, &lr, nullptr, &reporter_);
ASSERT_TRUE(root2_handler.StartCompilationUnit(0, 1, 2, 3, 3)); ASSERT_TRUE(root2_handler.StartCompilationUnit(0, 1, 2, 3, 3));
ASSERT_TRUE(root2_handler.StartRootDIE(1, ASSERT_TRUE(root2_handler.StartRootDIE(1,
dwarf2reader::DW_TAG_compile_unit)); google_breakpad::DW_TAG_compile_unit));
ASSERT_TRUE(root2_handler.EndAttributes()); ASSERT_TRUE(root2_handler.EndAttributes());
EXPECT_CALL(reporter_, UnhandledInterCUReference(_, _)).Times(1); EXPECT_CALL(reporter_, UnhandledInterCUReference(_, _)).Times(1);
DIEHandler* class_A_handler DIEHandler* class_A_handler
= StartSpecifiedDIE(&root2_handler, dwarf2reader::DW_TAG_class_type, = StartSpecifiedDIE(&root2_handler, google_breakpad::DW_TAG_class_type,
0xb8fbfdd5f0b26fceULL); 0xb8fbfdd5f0b26fceULL);
DeclarationDIE(class_A_handler, 0xb01fef8b380bd1a2ULL, DeclarationDIE(class_A_handler, 0xb01fef8b380bd1a2ULL,
dwarf2reader::DW_TAG_subprogram, "member_func_B", ""); google_breakpad::DW_TAG_subprogram, "member_func_B", "");
class_A_handler->Finish(); class_A_handler->Finish();
delete class_A_handler; delete class_A_handler;
root2_handler.Finish(); root2_handler.Finish();
@ -1618,11 +1618,11 @@ TEST_F(Specifications, UnhandledInterCU) {
DwarfCUToModule root3_handler(&fc, &lr, nullptr, &reporter_); DwarfCUToModule root3_handler(&fc, &lr, nullptr, &reporter_);
ASSERT_TRUE(root3_handler.StartCompilationUnit(0, 1, 2, 3, 3)); ASSERT_TRUE(root3_handler.StartCompilationUnit(0, 1, 2, 3, 3));
ASSERT_TRUE(root3_handler.StartRootDIE(1, ASSERT_TRUE(root3_handler.StartRootDIE(1,
dwarf2reader::DW_TAG_compile_unit)); google_breakpad::DW_TAG_compile_unit));
ASSERT_TRUE(root3_handler.EndAttributes()); ASSERT_TRUE(root3_handler.EndAttributes());
EXPECT_CALL(reporter_, UnhandledInterCUReference(_, _)).Times(1); EXPECT_CALL(reporter_, UnhandledInterCUReference(_, _)).Times(1);
EXPECT_CALL(reporter_, UnnamedFunction(_)).Times(1); EXPECT_CALL(reporter_, UnnamedFunction(_)).Times(1);
DefinitionDIE(&root3_handler, dwarf2reader::DW_TAG_subprogram, DefinitionDIE(&root3_handler, google_breakpad::DW_TAG_subprogram,
0xb01fef8b380bd1a2ULL, "", 0xb01fef8b380bd1a2ULL, "",
0x2618f00a1a711e53ULL, 0x4fd94b76d7c2caf5ULL); 0x2618f00a1a711e53ULL, 0x4fd94b76d7c2caf5ULL);
root3_handler.Finish(); root3_handler.Finish();
@ -1636,8 +1636,8 @@ TEST_F(Specifications, BadOffset) {
StartCU(); StartCU();
DeclarationDIE(&root_handler_, 0xefd7f7752c27b7e4ULL, DeclarationDIE(&root_handler_, 0xefd7f7752c27b7e4ULL,
dwarf2reader::DW_TAG_subprogram, "", ""); google_breakpad::DW_TAG_subprogram, "", "");
DefinitionDIE(&root_handler_, dwarf2reader::DW_TAG_subprogram, DefinitionDIE(&root_handler_, google_breakpad::DW_TAG_subprogram,
0x2be953efa6f9a996ULL, "function", 0x2be953efa6f9a996ULL, "function",
0xa0277efd7ce83771ULL, 0x149554a184c730c1ULL); 0xa0277efd7ce83771ULL, 0x149554a184c730c1ULL);
root_handler_.Finish(); root_handler_.Finish();
@ -1648,8 +1648,8 @@ TEST_F(Specifications, FunctionDefinitionHasOwnName) {
StartCU(); StartCU();
DeclarationDIE(&root_handler_, 0xc34ff4786cae78bdULL, DeclarationDIE(&root_handler_, 0xc34ff4786cae78bdULL,
dwarf2reader::DW_TAG_subprogram, "declaration-name", ""); google_breakpad::DW_TAG_subprogram, "declaration-name", "");
DefinitionDIE(&root_handler_, dwarf2reader::DW_TAG_subprogram, DefinitionDIE(&root_handler_, google_breakpad::DW_TAG_subprogram,
0xc34ff4786cae78bdULL, "definition-name", 0xc34ff4786cae78bdULL, "definition-name",
0xced50b3eea81022cULL, 0x08dd4d301cc7a7d2ULL); 0xced50b3eea81022cULL, 0x08dd4d301cc7a7d2ULL);
root_handler_.Finish(); root_handler_.Finish();
@ -1664,19 +1664,19 @@ TEST_F(Specifications, ClassDefinitionHasOwnName) {
StartCU(); StartCU();
DeclarationDIE(&root_handler_, 0xd0fe467ec2f1a58cULL, DeclarationDIE(&root_handler_, 0xd0fe467ec2f1a58cULL,
dwarf2reader::DW_TAG_class_type, "class-declaration-name", ""); google_breakpad::DW_TAG_class_type, "class-declaration-name", "");
dwarf2reader::DIEHandler* class_definition google_breakpad::DIEHandler* class_definition
= StartSpecifiedDIE(&root_handler_, dwarf2reader::DW_TAG_class_type, = StartSpecifiedDIE(&root_handler_, google_breakpad::DW_TAG_class_type,
0xd0fe467ec2f1a58cULL, "class-definition-name"); 0xd0fe467ec2f1a58cULL, "class-definition-name");
ASSERT_TRUE(class_definition); ASSERT_TRUE(class_definition);
DeclarationDIE(class_definition, 0x6d028229c15623dbULL, DeclarationDIE(class_definition, 0x6d028229c15623dbULL,
dwarf2reader::DW_TAG_subprogram, google_breakpad::DW_TAG_subprogram,
"function-declaration-name", ""); "function-declaration-name", "");
class_definition->Finish(); class_definition->Finish();
delete class_definition; delete class_definition;
DefinitionDIE(&root_handler_, dwarf2reader::DW_TAG_subprogram, DefinitionDIE(&root_handler_, google_breakpad::DW_TAG_subprogram,
0x6d028229c15623dbULL, "function-definition-name", 0x6d028229c15623dbULL, "function-definition-name",
0x1d0f5e0f6ce309bdULL, 0x654e1852ec3599e7ULL); 0x1d0f5e0f6ce309bdULL, 0x654e1852ec3599e7ULL);
@ -1697,20 +1697,20 @@ TEST_F(Specifications, PreferSpecificationParents) {
StartCU(); StartCU();
{ {
dwarf2reader::DIEHandler* declaration_class_handler = google_breakpad::DIEHandler* declaration_class_handler =
StartNamedDIE(&root_handler_, dwarf2reader::DW_TAG_class_type, StartNamedDIE(&root_handler_, google_breakpad::DW_TAG_class_type,
"declaration-class"); "declaration-class");
DeclarationDIE(declaration_class_handler, 0x9ddb35517455ef7aULL, DeclarationDIE(declaration_class_handler, 0x9ddb35517455ef7aULL,
dwarf2reader::DW_TAG_subprogram, "function-declaration", google_breakpad::DW_TAG_subprogram, "function-declaration",
""); "");
declaration_class_handler->Finish(); declaration_class_handler->Finish();
delete declaration_class_handler; delete declaration_class_handler;
} }
{ {
dwarf2reader::DIEHandler* definition_class_handler google_breakpad::DIEHandler* definition_class_handler
= StartNamedDIE(&root_handler_, dwarf2reader::DW_TAG_class_type, = StartNamedDIE(&root_handler_, google_breakpad::DW_TAG_class_type,
"definition-class"); "definition-class");
DefinitionDIE(definition_class_handler, dwarf2reader::DW_TAG_subprogram, DefinitionDIE(definition_class_handler, google_breakpad::DW_TAG_subprogram,
0x9ddb35517455ef7aULL, "function-definition", 0x9ddb35517455ef7aULL, "function-definition",
0xbbd9d54dce3b95b7ULL, 0x39188b7b52b0899fULL); 0xbbd9d54dce3b95b7ULL, 0x39188b7b52b0899fULL);
definition_class_handler->Finish(); definition_class_handler->Finish();
@ -1732,12 +1732,12 @@ TEST_F(CUErrors, BadStmtList) {
.StartCompilationUnit(0xc591d5b037543d7cULL, 0x11, 0xcd, .StartCompilationUnit(0xc591d5b037543d7cULL, 0x11, 0xcd,
0x2d7d19546cf6590cULL, 3)); 0x2d7d19546cf6590cULL, 3));
ASSERT_TRUE(root_handler_.StartRootDIE(0xae789dc102cfca54ULL, ASSERT_TRUE(root_handler_.StartRootDIE(0xae789dc102cfca54ULL,
dwarf2reader::DW_TAG_compile_unit)); google_breakpad::DW_TAG_compile_unit));
root_handler_.ProcessAttributeString(dwarf2reader::DW_AT_name, root_handler_.ProcessAttributeString(google_breakpad::DW_AT_name,
dwarf2reader::DW_FORM_strp, google_breakpad::DW_FORM_strp,
"compilation-unit-name"); "compilation-unit-name");
root_handler_.ProcessAttributeUnsigned(dwarf2reader::DW_AT_stmt_list, root_handler_.ProcessAttributeUnsigned(google_breakpad::DW_AT_stmt_list,
dwarf2reader::DW_FORM_ref4, google_breakpad::DW_FORM_ref4,
dummy_line_size_ + 10); dummy_line_size_ + 10);
root_handler_.EndAttributes(); root_handler_.EndAttributes();
root_handler_.Finish(); root_handler_.Finish();
@ -1789,7 +1789,7 @@ TEST_F(CUErrors, BadCURootDIETag) {
0xc9de224ccb99ac3eULL, 3)); 0xc9de224ccb99ac3eULL, 3));
ASSERT_FALSE(root_handler_.StartRootDIE(0x02e56bfbda9e7337ULL, ASSERT_FALSE(root_handler_.StartRootDIE(0x02e56bfbda9e7337ULL,
dwarf2reader::DW_TAG_subprogram)); google_breakpad::DW_TAG_subprogram));
} }
// Tests for DwarfCUToModule::Reporter. These just produce (or fail to // Tests for DwarfCUToModule::Reporter. These just produce (or fail to

View file

@ -50,7 +50,7 @@ namespace google_breakpad {
// instances from parsed DWARF line number data. // instances from parsed DWARF line number data.
// //
// An instance of this class can be provided as a handler to a // An instance of this class can be provided as a handler to a
// dwarf2reader::LineInfo DWARF line number information parser. The // LineInfo DWARF line number information parser. The
// handler accepts source location information from the parser and // handler accepts source location information from the parser and
// uses it to produce a vector of google_breakpad::Module::Line // uses it to produce a vector of google_breakpad::Module::Line
// objects, referring to google_breakpad::Module::File objects added // objects, referring to google_breakpad::Module::File objects added
@ -111,7 +111,7 @@ namespace google_breakpad {
// at address zero.) // at address zero.)
// //
// - If a line starts immediately after an omitted line, omit it too. // - If a line starts immediately after an omitted line, omit it too.
class DwarfLineToModule: public dwarf2reader::LineInfoHandler { class DwarfLineToModule: public LineInfoHandler {
public: public:
// As the DWARF line info parser passes us line records, add source // As the DWARF line info parser passes us line records, add source
// files to MODULE, and add all lines to the end of LINES. LINES // files to MODULE, and add all lines to the end of LINES. LINES

View file

@ -49,7 +49,7 @@ namespace google_breakpad {
// A class for producing a vector of google_breakpad::Module::Range // A class for producing a vector of google_breakpad::Module::Range
// instances from a parsed DWARF range list. // instances from a parsed DWARF range list.
class DwarfRangeListHandler: public dwarf2reader::RangeListHandler { class DwarfRangeListHandler: public RangeListHandler {
public: public:
DwarfRangeListHandler(vector<Module::Range>* ranges) DwarfRangeListHandler(vector<Module::Range>* ranges)
: ranges_(ranges) { } : ranges_(ranges) { }

View file

@ -228,34 +228,34 @@ bool LoadStabs(const typename ElfClass::Ehdr* elf_header,
#endif // NO_STABS_SUPPORT #endif // NO_STABS_SUPPORT
// A range handler that accepts rangelist data parsed by // A range handler that accepts rangelist data parsed by
// dwarf2reader::RangeListReader and populates a range vector (typically // google_breakpad::RangeListReader and populates a range vector (typically
// owned by a function) with the results. // owned by a function) with the results.
class DumperRangesHandler : public DwarfCUToModule::RangesHandler { class DumperRangesHandler : public DwarfCUToModule::RangesHandler {
public: public:
DumperRangesHandler(dwarf2reader::ByteReader* reader) : DumperRangesHandler(google_breakpad::ByteReader* reader) :
reader_(reader) { } reader_(reader) { }
bool ReadRanges( bool ReadRanges(
enum dwarf2reader::DwarfForm form, uint64_t data, enum google_breakpad::DwarfForm form, uint64_t data,
dwarf2reader::RangeListReader::CURangesInfo* cu_info, google_breakpad::RangeListReader::CURangesInfo* cu_info,
vector<Module::Range>* ranges) { vector<Module::Range>* ranges) {
DwarfRangeListHandler handler(ranges); DwarfRangeListHandler handler(ranges);
dwarf2reader::RangeListReader range_list_reader(reader_, cu_info, google_breakpad::RangeListReader range_list_reader(reader_, cu_info,
&handler); &handler);
return range_list_reader.ReadRanges(form, data); return range_list_reader.ReadRanges(form, data);
} }
private: private:
dwarf2reader::ByteReader* reader_; google_breakpad::ByteReader* reader_;
}; };
// A line-to-module loader that accepts line number info parsed by // A line-to-module loader that accepts line number info parsed by
// dwarf2reader::LineInfo and populates a Module and a line vector // google_breakpad::LineInfo and populates a Module and a line vector
// with the results. // with the results.
class DumperLineToModule: public DwarfCUToModule::LineToModuleHandler { class DumperLineToModule: public DwarfCUToModule::LineToModuleHandler {
public: public:
// Create a line-to-module converter using BYTE_READER. // Create a line-to-module converter using BYTE_READER.
explicit DumperLineToModule(dwarf2reader::ByteReader* byte_reader) explicit DumperLineToModule(google_breakpad::ByteReader* byte_reader)
: byte_reader_(byte_reader) { } : byte_reader_(byte_reader) { }
void StartCompilationUnit(const string& compilation_dir) { void StartCompilationUnit(const string& compilation_dir) {
compilation_dir_ = compilation_dir; compilation_dir_ = compilation_dir;
@ -267,7 +267,7 @@ class DumperLineToModule: public DwarfCUToModule::LineToModuleHandler {
uint64_t line_string_section_length, uint64_t line_string_section_length,
Module* module, std::vector<Module::Line>* lines) { Module* module, std::vector<Module::Line>* lines) {
DwarfLineToModule handler(module, compilation_dir_, lines); DwarfLineToModule handler(module, compilation_dir_, lines);
dwarf2reader::LineInfo parser(program, length, byte_reader_, google_breakpad::LineInfo parser(program, length, byte_reader_,
string_section, string_section_length, string_section, string_section_length,
line_string_section, line_string_section,
line_string_section_length, line_string_section_length,
@ -276,7 +276,7 @@ class DumperLineToModule: public DwarfCUToModule::LineToModuleHandler {
} }
private: private:
string compilation_dir_; string compilation_dir_;
dwarf2reader::ByteReader* byte_reader_; google_breakpad::ByteReader* byte_reader_;
}; };
template<typename ElfClass> template<typename ElfClass>
@ -287,9 +287,9 @@ bool LoadDwarf(const string& dwarf_filename,
Module* module) { Module* module) {
typedef typename ElfClass::Shdr Shdr; typedef typename ElfClass::Shdr Shdr;
const dwarf2reader::Endianness endianness = big_endian ? const google_breakpad::Endianness endianness = big_endian ?
dwarf2reader::ENDIANNESS_BIG : dwarf2reader::ENDIANNESS_LITTLE; google_breakpad::ENDIANNESS_BIG : google_breakpad::ENDIANNESS_LITTLE;
dwarf2reader::ByteReader byte_reader(endianness); google_breakpad::ByteReader byte_reader(endianness);
// Construct a context for this file. // Construct a context for this file.
DwarfCUToModule::FileContext file_context(dwarf_filename, DwarfCUToModule::FileContext file_context(dwarf_filename,
@ -316,7 +316,7 @@ bool LoadDwarf(const string& dwarf_filename,
// Parse all the compilation units in the .debug_info section. // Parse all the compilation units in the .debug_info section.
DumperLineToModule line_to_module(&byte_reader); DumperLineToModule line_to_module(&byte_reader);
dwarf2reader::SectionMap::const_iterator debug_info_entry = google_breakpad::SectionMap::const_iterator debug_info_entry =
file_context.section_map().find(".debug_info"); file_context.section_map().find(".debug_info");
assert(debug_info_entry != file_context.section_map().end()); assert(debug_info_entry != file_context.section_map().end());
const std::pair<const uint8_t*, uint64_t>& debug_info_section = const std::pair<const uint8_t*, uint64_t>& debug_info_section =
@ -332,9 +332,9 @@ bool LoadDwarf(const string& dwarf_filename,
DwarfCUToModule root_handler(&file_context, &line_to_module, DwarfCUToModule root_handler(&file_context, &line_to_module,
&ranges_handler, &reporter); &ranges_handler, &reporter);
// Make a Dwarf2Handler that drives the DIEHandler. // Make a Dwarf2Handler that drives the DIEHandler.
dwarf2reader::DIEDispatcher die_dispatcher(&root_handler); google_breakpad::DIEDispatcher die_dispatcher(&root_handler);
// Make a DWARF parser for the compilation unit at OFFSET. // Make a DWARF parser for the compilation unit at OFFSET.
dwarf2reader::CompilationUnit reader(dwarf_filename, google_breakpad::CompilationUnit reader(dwarf_filename,
file_context.section_map(), file_context.section_map(),
offset, offset,
&byte_reader, &byte_reader,
@ -394,8 +394,8 @@ bool LoadDwarfCFI(const string& dwarf_filename,
return false; return false;
} }
const dwarf2reader::Endianness endianness = big_endian ? const google_breakpad::Endianness endianness = big_endian ?
dwarf2reader::ENDIANNESS_BIG : dwarf2reader::ENDIANNESS_LITTLE; google_breakpad::ENDIANNESS_BIG : google_breakpad::ENDIANNESS_LITTLE;
// Find the call frame information and its size. // Find the call frame information and its size.
const uint8_t* cfi = const uint8_t* cfi =
@ -405,7 +405,7 @@ bool LoadDwarfCFI(const string& dwarf_filename,
// Plug together the parser, handler, and their entourages. // Plug together the parser, handler, and their entourages.
DwarfCFIToModule::Reporter module_reporter(dwarf_filename, section_name); DwarfCFIToModule::Reporter module_reporter(dwarf_filename, section_name);
DwarfCFIToModule handler(module, register_names, &module_reporter); DwarfCFIToModule handler(module, register_names, &module_reporter);
dwarf2reader::ByteReader byte_reader(endianness); google_breakpad::ByteReader byte_reader(endianness);
byte_reader.SetAddressSize(ElfClass::kAddrSize); byte_reader.SetAddressSize(ElfClass::kAddrSize);
@ -417,9 +417,9 @@ bool LoadDwarfCFI(const string& dwarf_filename,
if (text_section) if (text_section)
byte_reader.SetTextBase(text_section->sh_addr); byte_reader.SetTextBase(text_section->sh_addr);
dwarf2reader::CallFrameInfo::Reporter dwarf_reporter(dwarf_filename, google_breakpad::CallFrameInfo::Reporter dwarf_reporter(dwarf_filename,
section_name); section_name);
dwarf2reader::CallFrameInfo parser(cfi, cfi_size, google_breakpad::CallFrameInfo parser(cfi, cfi_size,
&byte_reader, &handler, &dwarf_reporter, &byte_reader, &handler, &dwarf_reporter,
eh_frame); eh_frame);
parser.Start(); parser.Start();
@ -530,9 +530,9 @@ string ReadDebugLink(const uint8_t* debuglink,
FDWrapper debuglink_fd_wrapper(debuglink_fd); FDWrapper debuglink_fd_wrapper(debuglink_fd);
// The CRC is the last 4 bytes in |debuglink|. // The CRC is the last 4 bytes in |debuglink|.
const dwarf2reader::Endianness endianness = big_endian ? const google_breakpad::Endianness endianness = big_endian ?
dwarf2reader::ENDIANNESS_BIG : dwarf2reader::ENDIANNESS_LITTLE; google_breakpad::ENDIANNESS_BIG : google_breakpad::ENDIANNESS_LITTLE;
dwarf2reader::ByteReader byte_reader(endianness); google_breakpad::ByteReader byte_reader(endianness);
uint32_t expected_crc = uint32_t expected_crc =
byte_reader.ReadFourBytes(&debuglink[debuglink_size - 4]); byte_reader.ReadFourBytes(&debuglink[debuglink_size - 4]);

View file

@ -74,7 +74,7 @@
#define CPU_TYPE_ARM64 (static_cast<cpu_type_t>(16777228)) #define CPU_TYPE_ARM64 (static_cast<cpu_type_t>(16777228))
#endif // CPU_TYPE_ARM64 #endif // CPU_TYPE_ARM64
using dwarf2reader::ByteReader; using google_breakpad::ByteReader;
using google_breakpad::DwarfCUToModule; using google_breakpad::DwarfCUToModule;
using google_breakpad::DwarfLineToModule; using google_breakpad::DwarfLineToModule;
using google_breakpad::DwarfRangeListHandler; using google_breakpad::DwarfRangeListHandler;
@ -315,36 +315,36 @@ string DumpSymbols::Identifier() {
} }
// A range handler that accepts rangelist data parsed by // A range handler that accepts rangelist data parsed by
// dwarf2reader::RangeListReader and populates a range vector (typically // RangeListReader and populates a range vector (typically
// owned by a function) with the results. // owned by a function) with the results.
class DumpSymbols::DumperRangesHandler: class DumpSymbols::DumperRangesHandler:
public DwarfCUToModule::RangesHandler { public DwarfCUToModule::RangesHandler {
public: public:
DumperRangesHandler(dwarf2reader::ByteReader* reader) : DumperRangesHandler(ByteReader* reader) :
reader_(reader) { } reader_(reader) { }
bool ReadRanges( bool ReadRanges(
enum dwarf2reader::DwarfForm form, uint64_t data, enum DwarfForm form, uint64_t data,
dwarf2reader::RangeListReader::CURangesInfo* cu_info, RangeListReader::CURangesInfo* cu_info,
vector<Module::Range>* ranges) { vector<Module::Range>* ranges) {
DwarfRangeListHandler handler(ranges); DwarfRangeListHandler handler(ranges);
dwarf2reader::RangeListReader range_list_reader(reader_, cu_info, RangeListReader range_list_reader(reader_, cu_info,
&handler); &handler);
return range_list_reader.ReadRanges(form, data); return range_list_reader.ReadRanges(form, data);
} }
private: private:
dwarf2reader::ByteReader* reader_; ByteReader* reader_;
}; };
// A line-to-module loader that accepts line number info parsed by // A line-to-module loader that accepts line number info parsed by
// dwarf2reader::LineInfo and populates a Module and a line vector // LineInfo and populates a Module and a line vector
// with the results. // with the results.
class DumpSymbols::DumperLineToModule: class DumpSymbols::DumperLineToModule:
public DwarfCUToModule::LineToModuleHandler { public DwarfCUToModule::LineToModuleHandler {
public: public:
// Create a line-to-module converter using BYTE_READER. // Create a line-to-module converter using BYTE_READER.
DumperLineToModule(dwarf2reader::ByteReader* byte_reader) DumperLineToModule(ByteReader* byte_reader)
: byte_reader_(byte_reader) { } : byte_reader_(byte_reader) { }
void StartCompilationUnit(const string& compilation_dir) { void StartCompilationUnit(const string& compilation_dir) {
@ -358,13 +358,13 @@ class DumpSymbols::DumperLineToModule:
uint64_t line_string_section_length, uint64_t line_string_section_length,
Module* module, vector<Module::Line>* lines) { Module* module, vector<Module::Line>* lines) {
DwarfLineToModule handler(module, compilation_dir_, lines); DwarfLineToModule handler(module, compilation_dir_, lines);
dwarf2reader::LineInfo parser(program, length, byte_reader_, LineInfo parser(program, length, byte_reader_,
nullptr, 0, nullptr, 0, &handler); nullptr, 0, nullptr, 0, &handler);
parser.Start(); parser.Start();
} }
private: private:
string compilation_dir_; string compilation_dir_;
dwarf2reader::ByteReader* byte_reader_; // WEAK ByteReader* byte_reader_; // WEAK
}; };
bool DumpSymbols::CreateEmptyModule(scoped_ptr<Module>& module) { bool DumpSymbols::CreateEmptyModule(scoped_ptr<Module>& module) {
@ -430,15 +430,15 @@ void DumpSymbols::ReadDwarf(google_breakpad::Module* module,
bool handle_inter_cu_refs) const { bool handle_inter_cu_refs) const {
// Build a byte reader of the appropriate endianness. // Build a byte reader of the appropriate endianness.
ByteReader byte_reader(macho_reader.big_endian() ByteReader byte_reader(macho_reader.big_endian()
? dwarf2reader::ENDIANNESS_BIG ? ENDIANNESS_BIG
: dwarf2reader::ENDIANNESS_LITTLE); : ENDIANNESS_LITTLE);
// Construct a context for this file. // Construct a context for this file.
DwarfCUToModule::FileContext file_context(selected_object_name_, DwarfCUToModule::FileContext file_context(selected_object_name_,
module, module,
handle_inter_cu_refs); handle_inter_cu_refs);
// Build a dwarf2reader::SectionMap from our mach_o::SectionMap. // Build a SectionMap from our mach_o::SectionMap.
for (mach_o::SectionMap::const_iterator it = dwarf_sections.begin(); for (mach_o::SectionMap::const_iterator it = dwarf_sections.begin();
it != dwarf_sections.end(); ++it) { it != dwarf_sections.end(); ++it) {
file_context.AddSectionToSectionMap( file_context.AddSectionToSectionMap(
@ -448,7 +448,7 @@ void DumpSymbols::ReadDwarf(google_breakpad::Module* module,
} }
// Find the __debug_info section. // Find the __debug_info section.
dwarf2reader::SectionMap::const_iterator debug_info_entry = SectionMap::const_iterator debug_info_entry =
file_context.section_map().find("__debug_info"); file_context.section_map().find("__debug_info");
// There had better be a __debug_info section! // There had better be a __debug_info section!
if (debug_info_entry == file_context.section_map().end()) { if (debug_info_entry == file_context.section_map().end()) {
@ -475,9 +475,9 @@ void DumpSymbols::ReadDwarf(google_breakpad::Module* module,
DwarfCUToModule root_handler(&file_context, &line_to_module, DwarfCUToModule root_handler(&file_context, &line_to_module,
&ranges_handler, &reporter); &ranges_handler, &reporter);
// Make a Dwarf2Handler that drives our DIEHandler. // Make a Dwarf2Handler that drives our DIEHandler.
dwarf2reader::DIEDispatcher die_dispatcher(&root_handler); DIEDispatcher die_dispatcher(&root_handler);
// Make a DWARF parser for the compilation unit at OFFSET. // Make a DWARF parser for the compilation unit at OFFSET.
dwarf2reader::CompilationUnit dwarf_reader(selected_object_name_, CompilationUnit dwarf_reader(selected_object_name_,
file_context.section_map(), file_context.section_map(),
offset, offset,
&byte_reader, &byte_reader,
@ -530,18 +530,18 @@ bool DumpSymbols::ReadCFI(google_breakpad::Module* module,
DwarfCFIToModule::Reporter module_reporter(selected_object_name_, DwarfCFIToModule::Reporter module_reporter(selected_object_name_,
section.section_name); section.section_name);
DwarfCFIToModule handler(module, register_names, &module_reporter); DwarfCFIToModule handler(module, register_names, &module_reporter);
dwarf2reader::ByteReader byte_reader(macho_reader.big_endian() ? ByteReader byte_reader(macho_reader.big_endian() ?
dwarf2reader::ENDIANNESS_BIG : ENDIANNESS_BIG :
dwarf2reader::ENDIANNESS_LITTLE); ENDIANNESS_LITTLE);
byte_reader.SetAddressSize(macho_reader.bits_64() ? 8 : 4); byte_reader.SetAddressSize(macho_reader.bits_64() ? 8 : 4);
// At the moment, according to folks at Apple and some cursory // At the moment, according to folks at Apple and some cursory
// investigation, Mac OS X only uses DW_EH_PE_pcrel-based pointers, so // investigation, Mac OS X only uses DW_EH_PE_pcrel-based pointers, so
// this is the only base address the CFI parser will need. // this is the only base address the CFI parser will need.
byte_reader.SetCFIDataBase(section.address, cfi); byte_reader.SetCFIDataBase(section.address, cfi);
dwarf2reader::CallFrameInfo::Reporter dwarf_reporter(selected_object_name_, CallFrameInfo::Reporter dwarf_reporter(selected_object_name_,
section.section_name); section.section_name);
dwarf2reader::CallFrameInfo parser(cfi, cfi_size, CallFrameInfo parser(cfi, cfi_size,
&byte_reader, &handler, &dwarf_reporter, &byte_reader, &handler, &dwarf_reporter,
eh_frame); eh_frame);
parser.Start(); parser.Start();