summaryrefslogtreecommitdiffstats
path: root/breakpad
diff options
context:
space:
mode:
Diffstat (limited to 'breakpad')
-rw-r--r--breakpad/pending/src/common/dwarf_cu_to_module.cc12
-rw-r--r--breakpad/pending/src/common/dwarf_cu_to_module.h7
-rw-r--r--breakpad/pending/src/common/dwarf_cu_to_module_unittest.cc138
3 files changed, 24 insertions, 133 deletions
diff --git a/breakpad/pending/src/common/dwarf_cu_to_module.cc b/breakpad/pending/src/common/dwarf_cu_to_module.cc
index 9acdd1f..0d59007 100644
--- a/breakpad/pending/src/common/dwarf_cu_to_module.cc
+++ b/breakpad/pending/src/common/dwarf_cu_to_module.cc
@@ -506,8 +506,7 @@ class DwarfCUToModule::NamedScopeHandler: public GenericDIEHandler {
uint64 offset)
: GenericDIEHandler(cu_context, parent_context, offset) { }
bool EndAttributes();
- DIEHandler *FindChildHandler(uint64 offset, enum DwarfTag tag,
- const AttributeList &attrs);
+ DIEHandler *FindChildHandler(uint64 offset, enum DwarfTag tag);
private:
DIEContext child_context_; // A context for our children.
@@ -521,8 +520,7 @@ bool DwarfCUToModule::NamedScopeHandler::EndAttributes() {
dwarf2reader::DIEHandler *DwarfCUToModule::NamedScopeHandler::FindChildHandler(
uint64 offset,
- enum DwarfTag tag,
- const AttributeList &attrs) {
+ enum DwarfTag tag) {
switch (tag) {
case dwarf2reader::DW_TAG_subprogram:
return new FuncHandler(cu_context_, &child_context_, offset);
@@ -663,8 +661,7 @@ bool DwarfCUToModule::EndAttributes() {
dwarf2reader::DIEHandler *DwarfCUToModule::FindChildHandler(
uint64 offset,
- enum DwarfTag tag,
- const AttributeList &attrs) {
+ enum DwarfTag tag) {
switch (tag) {
case dwarf2reader::DW_TAG_subprogram:
return new FuncHandler(cu_context_, child_context_, offset);
@@ -1017,8 +1014,7 @@ bool DwarfCUToModule::StartCompilationUnit(uint64 offset,
return dwarf_version >= 2;
}
-bool DwarfCUToModule::StartRootDIE(uint64 offset, enum DwarfTag tag,
- const AttributeList& attrs) {
+bool DwarfCUToModule::StartRootDIE(uint64 offset, enum DwarfTag tag) {
// We don't deal with partial compilation units (the only other tag
// likely to be used for root DIE).
return tag == dwarf2reader::DW_TAG_compile_unit;
diff --git a/breakpad/pending/src/common/dwarf_cu_to_module.h b/breakpad/pending/src/common/dwarf_cu_to_module.h
index 3a997ad..cfb26f1 100644
--- a/breakpad/pending/src/common/dwarf_cu_to_module.h
+++ b/breakpad/pending/src/common/dwarf_cu_to_module.h
@@ -49,7 +49,6 @@
namespace google_breakpad {
-using dwarf2reader::AttributeList;
using dwarf2reader::DwarfAttribute;
using dwarf2reader::DwarfForm;
using dwarf2reader::DwarfLanguage;
@@ -199,8 +198,7 @@ class DwarfCUToModule: public dwarf2reader::RootDIEHandler {
enum DwarfForm form,
const string &data);
bool EndAttributes();
- DIEHandler *FindChildHandler(uint64 offset, enum DwarfTag tag,
- const AttributeList &attrs);
+ DIEHandler *FindChildHandler(uint64 offset, enum DwarfTag tag);
// Assign all our source Lines to the Functions that cover their
// addresses, and then add them to module_.
@@ -209,8 +207,7 @@ class DwarfCUToModule: public dwarf2reader::RootDIEHandler {
bool StartCompilationUnit(uint64 offset, uint8 address_size,
uint8 offset_size, uint64 cu_length,
uint8 dwarf_version);
- bool StartRootDIE(uint64 offset, enum DwarfTag tag,
- const AttributeList& attrs);
+ bool StartRootDIE(uint64 offset, enum DwarfTag tag);
private:
diff --git a/breakpad/pending/src/common/dwarf_cu_to_module_unittest.cc b/breakpad/pending/src/common/dwarf_cu_to_module_unittest.cc
index 83a28e0..34fd728 100644
--- a/breakpad/pending/src/common/dwarf_cu_to_module_unittest.cc
+++ b/breakpad/pending/src/common/dwarf_cu_to_module_unittest.cc
@@ -38,7 +38,6 @@
using std::vector;
-using dwarf2reader::AttributeList;
using dwarf2reader::DIEHandler;
using dwarf2reader::DwarfTag;
using dwarf2reader::DwarfAttribute;
@@ -174,11 +173,7 @@ class CUFixtureBase {
// this.root_handler_.EndAttributes, but not this.root_handler_.Finish.
void StartCU();
- // Add some strange attributes/form pairs to the end of ATTRS.
- void PushBackStrangeAttributes(dwarf2reader::AttributeList *attrs);
-
// Have HANDLER process some strange attribute/form/value triples.
- // These will match those promised by PushBackStrangeAttributes.
void ProcessStrangeAttributes(dwarf2reader::DIEHandler *handler);
// Start a child DIE of PARENT with the given tag and name. Leave
@@ -328,20 +323,8 @@ void CUFixtureBase::StartCU() {
.StartCompilationUnit(0x51182ec307610b51ULL, 0x81, 0x44,
0x4241b4f33720dd5cULL, 3));
{
- dwarf2reader::AttributeList attrs;
- attrs.push_back(make_pair(dwarf2reader::DW_AT_name,
- dwarf2reader::DW_FORM_strp));
- if (!lines_.empty())
- attrs.push_back(make_pair(dwarf2reader::DW_AT_stmt_list,
- dwarf2reader::DW_FORM_ref4));
- if (language_ != dwarf2reader::DW_LANG_none)
- attrs.push_back(make_pair(dwarf2reader::DW_AT_language,
- language_signed_
- ? dwarf2reader::DW_FORM_sdata
- : dwarf2reader::DW_FORM_udata));
ASSERT_TRUE(root_handler_.StartRootDIE(0x02e56bfbda9e7337ULL,
- dwarf2reader::DW_TAG_compile_unit,
- attrs));
+ dwarf2reader::DW_TAG_compile_unit));
}
root_handler_.ProcessAttributeString(dwarf2reader::DW_AT_name,
dwarf2reader::DW_FORM_strp,
@@ -363,20 +346,6 @@ void CUFixtureBase::StartCU() {
ASSERT_TRUE(root_handler_.EndAttributes());
}
-void CUFixtureBase::PushBackStrangeAttributes(
- dwarf2reader::AttributeList *attrs) {
- attrs->push_back(make_pair((DwarfAttribute) 0xf560dead,
- (DwarfForm) 0x4106e4db));
- attrs->push_back(make_pair((DwarfAttribute) 0x85380095,
- (DwarfForm) 0x0f16fe87));
- attrs->push_back(make_pair((DwarfAttribute) 0xf7f7480f,
- (DwarfForm) 0x829e038a));
- attrs->push_back(make_pair((DwarfAttribute) 0xa55ffb51,
- (DwarfForm) 0x2f43b041));
- attrs->push_back(make_pair((DwarfAttribute) 0x2fde304a,
- (DwarfForm) 0x895ffa23));
-}
-
void CUFixtureBase::ProcessStrangeAttributes(
dwarf2reader::DIEHandler *handler) {
handler->ProcessAttributeUnsigned((DwarfAttribute) 0xf560dead,
@@ -400,12 +369,8 @@ void CUFixtureBase::ProcessStrangeAttributes(
DIEHandler *CUFixtureBase::StartNamedDIE(DIEHandler *parent,
DwarfTag tag,
const string &name) {
- dwarf2reader::AttributeList attrs;
- attrs.push_back(make_pair(dwarf2reader::DW_AT_name,
- dwarf2reader::DW_FORM_strp));
- PushBackStrangeAttributes(&attrs);
dwarf2reader::DIEHandler *handler
- = parent->FindChildHandler(incrementing_offset_++, tag, attrs);
+ = parent->FindChildHandler(incrementing_offset_++, tag);
if (!handler)
return NULL;
handler->ProcessAttributeString(dwarf2reader::DW_AT_name,
@@ -425,14 +390,8 @@ DIEHandler *CUFixtureBase::StartSpecifiedDIE(DIEHandler *parent,
DwarfTag tag,
uint64 specification,
const char *name) {
- dwarf2reader::AttributeList attrs;
- if (name)
- attrs.push_back(make_pair(dwarf2reader::DW_AT_name,
- dwarf2reader::DW_FORM_strp));
- attrs.push_back(make_pair(dwarf2reader::DW_AT_specification,
- dwarf2reader::DW_FORM_ref4));
dwarf2reader::DIEHandler *handler
- = parent->FindChildHandler(incrementing_offset_++, tag, attrs);
+ = parent->FindChildHandler(incrementing_offset_++, tag);
if (!handler)
return NULL;
if (name)
@@ -454,18 +413,9 @@ DIEHandler *CUFixtureBase::StartSpecifiedDIE(DIEHandler *parent,
void CUFixtureBase::DefineFunction(dwarf2reader::DIEHandler *parent,
const string &name, Module::Address address,
Module::Address size) {
- dwarf2reader::AttributeList func_attrs;
- func_attrs.push_back(make_pair(dwarf2reader::DW_AT_name,
- dwarf2reader::DW_FORM_strp));
- func_attrs.push_back(make_pair(dwarf2reader::DW_AT_low_pc,
- dwarf2reader::DW_FORM_addr));
- func_attrs.push_back(make_pair(dwarf2reader::DW_AT_high_pc,
- dwarf2reader::DW_FORM_addr));
- PushBackStrangeAttributes(&func_attrs);
dwarf2reader::DIEHandler *func
= parent->FindChildHandler(incrementing_offset_++,
- dwarf2reader::DW_TAG_subprogram,
- func_attrs);
+ dwarf2reader::DW_TAG_subprogram);
ASSERT_TRUE(func != NULL);
func->ProcessAttributeString(dwarf2reader::DW_AT_name,
dwarf2reader::DW_FORM_strp,
@@ -485,13 +435,7 @@ void CUFixtureBase::DefineFunction(dwarf2reader::DIEHandler *parent,
void CUFixtureBase::DeclarationDIE(DIEHandler *parent, uint64 offset,
DwarfTag tag,
const string &name) {
- dwarf2reader::AttributeList attrs;
- if (!name.empty())
- attrs.push_back(make_pair(dwarf2reader::DW_AT_name,
- dwarf2reader::DW_FORM_strp));
- attrs.push_back(make_pair(dwarf2reader::DW_AT_declaration,
- dwarf2reader::DW_FORM_flag));
- dwarf2reader::DIEHandler *die = parent->FindChildHandler(offset, tag, attrs);
+ dwarf2reader::DIEHandler *die = parent->FindChildHandler(offset, tag);
ASSERT_TRUE(die != NULL);
if (!name.empty())
die->ProcessAttributeString(dwarf2reader::DW_AT_name,
@@ -511,20 +455,8 @@ void CUFixtureBase::DefinitionDIE(DIEHandler *parent,
const string &name,
Module::Address address,
Module::Address size) {
- dwarf2reader::AttributeList attrs;
- attrs.push_back(make_pair(dwarf2reader::DW_AT_specification,
- dwarf2reader::DW_FORM_ref4));
- if (!name.empty())
- attrs.push_back(make_pair(dwarf2reader::DW_AT_name,
- dwarf2reader::DW_FORM_strp));
- if (size) {
- attrs.push_back(make_pair(dwarf2reader::DW_AT_low_pc,
- dwarf2reader::DW_FORM_addr));
- attrs.push_back(make_pair(dwarf2reader::DW_AT_high_pc,
- dwarf2reader::DW_FORM_addr));
- }
dwarf2reader::DIEHandler *die
- = parent->FindChildHandler(0x6ccfea031a9e6cc9ULL, tag, attrs);
+ = parent->FindChildHandler(0x6ccfea031a9e6cc9ULL, tag);
ASSERT_TRUE(die != NULL);
die->ProcessAttributeReference(dwarf2reader::DW_AT_specification,
dwarf2reader::DW_FORM_ref4,
@@ -552,16 +484,8 @@ void CUFixtureBase::AbstractInstanceDIE(DIEHandler *parent,
uint64 specification,
const string &name,
DwarfForm form) {
- dwarf2reader::AttributeList attrs;
- if (specification != 0ULL)
- attrs.push_back(make_pair(dwarf2reader::DW_AT_specification,
- dwarf2reader::DW_FORM_ref4));
- attrs.push_back(make_pair(dwarf2reader::DW_AT_inline, form));
- if (!name.empty())
- attrs.push_back(make_pair(dwarf2reader::DW_AT_name,
- dwarf2reader::DW_FORM_strp));
dwarf2reader::DIEHandler *die
- = parent->FindChildHandler(offset, dwarf2reader::DW_TAG_subprogram, attrs);
+ = parent->FindChildHandler(offset, dwarf2reader::DW_TAG_subprogram);
ASSERT_TRUE(die != NULL);
if (specification != 0ULL)
die->ProcessAttributeReference(dwarf2reader::DW_AT_specification,
@@ -587,21 +511,9 @@ void CUFixtureBase::DefineInlineInstanceDIE(DIEHandler *parent,
uint64 origin,
Module::Address address,
Module::Address size) {
- dwarf2reader::AttributeList func_attrs;
- if (!name.empty())
- func_attrs.push_back(make_pair(dwarf2reader::DW_AT_name,
- dwarf2reader::DW_FORM_strp));
- func_attrs.push_back(make_pair(dwarf2reader::DW_AT_low_pc,
- dwarf2reader::DW_FORM_addr));
- func_attrs.push_back(make_pair(dwarf2reader::DW_AT_high_pc,
- dwarf2reader::DW_FORM_addr));
- func_attrs.push_back(make_pair(dwarf2reader::DW_AT_abstract_origin,
- dwarf2reader::DW_FORM_ref4));
- PushBackStrangeAttributes(&func_attrs);
dwarf2reader::DIEHandler *func
= parent->FindChildHandler(0x11c70f94c6e87ccdLL,
- dwarf2reader::DW_TAG_subprogram,
- func_attrs);
+ dwarf2reader::DW_TAG_subprogram);
ASSERT_TRUE(func != NULL);
if (!name.empty()) {
func->ProcessAttributeString(dwarf2reader::DW_AT_name,
@@ -704,22 +616,19 @@ TEST_F(SimpleCU, OneFunc) {
TEST_F(SimpleCU, IrrelevantRootChildren) {
StartCU();
- dwarf2reader::AttributeList no_attrs;
EXPECT_FALSE(root_handler_
.FindChildHandler(0x7db32bff4e2dcfb1ULL,
- dwarf2reader::DW_TAG_lexical_block, no_attrs));
+ dwarf2reader::DW_TAG_lexical_block));
}
TEST_F(SimpleCU, IrrelevantNamedScopeChildren) {
StartCU();
- dwarf2reader::AttributeList no_attrs;
DIEHandler *class_A_handler
= StartNamedDIE(&root_handler_, dwarf2reader::DW_TAG_class_type, "class_A");
EXPECT_TRUE(class_A_handler != NULL);
EXPECT_FALSE(class_A_handler
->FindChildHandler(0x02e55999b865e4e9ULL,
- dwarf2reader::DW_TAG_lexical_block,
- no_attrs));
+ dwarf2reader::DW_TAG_lexical_block));
delete class_A_handler;
}
@@ -1568,7 +1477,6 @@ TEST_F(Specifications, InterCU) {
EXPECT_CALL(reporter_, UncoveredFunction(_)).WillOnce(Return());
MockLineToModuleFunctor lr;
EXPECT_CALL(lr, mock_apply(_,_,_,_)).Times(0);
- dwarf2reader::AttributeList no_attrs;
// Kludge: satisfy reporter_'s expectation.
reporter_.SetCUName("compilation-unit-name");
@@ -1577,10 +1485,8 @@ TEST_F(Specifications, InterCU) {
{
DwarfCUToModule root1_handler(&fc, &lr, &reporter_);
ASSERT_TRUE(root1_handler.StartCompilationUnit(0, 1, 2, 3, 3));
- dwarf2reader::AttributeList attrs;
- PushBackStrangeAttributes(&attrs);
- ASSERT_TRUE(root1_handler.StartRootDIE(1, dwarf2reader::DW_TAG_compile_unit,
- attrs));
+ ASSERT_TRUE(root1_handler.StartRootDIE(1,
+ dwarf2reader::DW_TAG_compile_unit));
ProcessStrangeAttributes(&root1_handler);
ASSERT_TRUE(root1_handler.EndAttributes());
DeclarationDIE(&root1_handler, 0xb8fbfdd5f0b26fceULL,
@@ -1592,8 +1498,8 @@ TEST_F(Specifications, InterCU) {
{
DwarfCUToModule root2_handler(&fc, &lr, &reporter_);
ASSERT_TRUE(root2_handler.StartCompilationUnit(0, 1, 2, 3, 3));
- ASSERT_TRUE(root2_handler.StartRootDIE(1, dwarf2reader::DW_TAG_compile_unit,
- no_attrs));
+ ASSERT_TRUE(root2_handler.StartRootDIE(1,
+ dwarf2reader::DW_TAG_compile_unit));
ASSERT_TRUE(root2_handler.EndAttributes());
DIEHandler *class_A_handler
= StartSpecifiedDIE(&root2_handler, dwarf2reader::DW_TAG_class_type,
@@ -1609,8 +1515,8 @@ TEST_F(Specifications, InterCU) {
{
DwarfCUToModule root3_handler(&fc, &lr, &reporter_);
ASSERT_TRUE(root3_handler.StartCompilationUnit(0, 1, 2, 3, 3));
- ASSERT_TRUE(root3_handler.StartRootDIE(1, dwarf2reader::DW_TAG_compile_unit,
- no_attrs));
+ ASSERT_TRUE(root3_handler.StartRootDIE(1,
+ dwarf2reader::DW_TAG_compile_unit));
ASSERT_TRUE(root3_handler.EndAttributes());
DefinitionDIE(&root3_handler, dwarf2reader::DW_TAG_subprogram,
0xb01fef8b380bd1a2ULL, "",
@@ -1724,14 +1630,8 @@ TEST_F(CUErrors, BadStmtList) {
ASSERT_TRUE(root_handler_
.StartCompilationUnit(0xc591d5b037543d7cULL, 0x11, 0xcd,
0x2d7d19546cf6590cULL, 3));
- dwarf2reader::AttributeList attrs;
- attrs.push_back(make_pair(dwarf2reader::DW_AT_name,
- dwarf2reader::DW_FORM_strp));
- attrs.push_back(make_pair(dwarf2reader::DW_AT_stmt_list,
- dwarf2reader::DW_FORM_ref4));
ASSERT_TRUE(root_handler_.StartRootDIE(0xae789dc102cfca54ULL,
- dwarf2reader::DW_TAG_compile_unit,
- attrs));
+ dwarf2reader::DW_TAG_compile_unit));
root_handler_.ProcessAttributeString(dwarf2reader::DW_AT_name,
dwarf2reader::DW_FORM_strp,
"compilation-unit-name");
@@ -1787,10 +1687,8 @@ TEST_F(CUErrors, BadCURootDIETag) {
.StartCompilationUnit(0xadf6e0eb71e2b0d9ULL, 0x4d, 0x90,
0xc9de224ccb99ac3eULL, 3));
- dwarf2reader::AttributeList no_attrs;
ASSERT_FALSE(root_handler_.StartRootDIE(0x02e56bfbda9e7337ULL,
- dwarf2reader::DW_TAG_subprogram,
- no_attrs));
+ dwarf2reader::DW_TAG_subprogram));
}
// Tests for DwarfCUToModule::Reporter. These just produce (or fail to