aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/common/dwarf/dwarf2diehandler.cc7
-rw-r--r--src/common/dwarf/dwarf2diehandler.h12
-rw-r--r--src/common/dwarf/dwarf2diehandler_unittest.cc109
-rw-r--r--src/common/dwarf/dwarf2reader.cc2
-rw-r--r--src/common/dwarf/dwarf2reader.h3
-rw-r--r--src/common/dwarf/dwarf2reader_die_unittest.cc10
-rw-r--r--src/common/dwarf/functioninfo.cc3
-rw-r--r--src/common/dwarf/functioninfo.h3
-rw-r--r--src/common/dwarf_cu_to_module.cc12
-rw-r--r--src/common/dwarf_cu_to_module.h7
-rw-r--r--src/common/dwarf_cu_to_module_unittest.cc140
11 files changed, 66 insertions, 242 deletions
diff --git a/src/common/dwarf/dwarf2diehandler.cc b/src/common/dwarf/dwarf2diehandler.cc
index c741d69f..20c15fa9 100644
--- a/src/common/dwarf/dwarf2diehandler.cc
+++ b/src/common/dwarf/dwarf2diehandler.cc
@@ -57,8 +57,7 @@ bool DIEDispatcher::StartCompilationUnit(uint64 offset, uint8 address_size,
dwarf_version);
}
-bool DIEDispatcher::StartDIE(uint64 offset, enum DwarfTag tag,
- const AttributeList& attrs) {
+bool DIEDispatcher::StartDIE(uint64 offset, enum DwarfTag tag) {
// The stack entry for the parent of this DIE, if there is one.
HandlerStack *parent = die_handlers_.empty() ? NULL : &die_handlers_.top();
@@ -82,7 +81,7 @@ bool DIEDispatcher::StartDIE(uint64 offset, enum DwarfTag tag,
if (parent) {
if (parent->handler_)
// Ask the parent to find a handler.
- handler = parent->handler_->FindChildHandler(offset, tag, attrs);
+ handler = parent->handler_->FindChildHandler(offset, tag);
else
// No parent handler means we're not interested in any of our
// children.
@@ -92,7 +91,7 @@ bool DIEDispatcher::StartDIE(uint64 offset, enum DwarfTag tag,
// decides whether to visit it, but the root DIE has no parent
// handler, so we have a special method on the root DIE handler
// itself to decide.
- if (root_handler_->StartRootDIE(offset, tag, attrs))
+ if (root_handler_->StartRootDIE(offset, tag))
handler = root_handler_;
else
handler = NULL;
diff --git a/src/common/dwarf/dwarf2diehandler.h b/src/common/dwarf/dwarf2diehandler.h
index 12b8d3a3..81f40f07 100644
--- a/src/common/dwarf/dwarf2diehandler.h
+++ b/src/common/dwarf/dwarf2diehandler.h
@@ -239,12 +239,10 @@ class DIEHandler {
// that child DIE (and all its descendants).
//
// OFFSET is the offset of the child; TAG indicates what kind of DIE
- // it is; and ATTRS is the list of attributes the DIE will have, and
- // their forms (their values are not provided).
+ // it is.
//
// The default definition skips all children.
- virtual DIEHandler *FindChildHandler(uint64 offset, enum DwarfTag tag,
- const AttributeList &attrs) {
+ virtual DIEHandler *FindChildHandler(uint64 offset, enum DwarfTag tag) {
return NULL;
}
@@ -280,8 +278,7 @@ class RootDIEHandler: public DIEHandler {
// unit.
//
// The default definition elects to visit the root DIE.
- virtual bool StartRootDIE(uint64 offset, enum DwarfTag tag,
- const AttributeList& attrs) { return true; }
+ virtual bool StartRootDIE(uint64 offset, enum DwarfTag tag) { return true; }
};
class DIEDispatcher: public Dwarf2Handler {
@@ -296,8 +293,7 @@ class DIEDispatcher: public Dwarf2Handler {
bool StartCompilationUnit(uint64 offset, uint8 address_size,
uint8 offset_size, uint64 cu_length,
uint8 dwarf_version);
- bool StartDIE(uint64 offset, enum DwarfTag tag,
- const AttributeList &attrs);
+ bool StartDIE(uint64 offset, enum DwarfTag tag);
void ProcessAttributeUnsigned(uint64 offset,
enum DwarfAttribute attr,
enum DwarfForm form,
diff --git a/src/common/dwarf/dwarf2diehandler_unittest.cc b/src/common/dwarf/dwarf2diehandler_unittest.cc
index 6a731196..c0a532aa 100644
--- a/src/common/dwarf/dwarf2diehandler_unittest.cc
+++ b/src/common/dwarf/dwarf2diehandler_unittest.cc
@@ -51,7 +51,6 @@ using ::testing::Return;
using ::testing::Sequence;
using ::testing::StrEq;
-using dwarf2reader::AttributeList;
using dwarf2reader::DIEDispatcher;
using dwarf2reader::DIEHandler;
using dwarf2reader::DwarfAttribute;
@@ -74,8 +73,7 @@ class MockDIEHandler: public DIEHandler {
MOCK_METHOD3(ProcessAttributeSignature,
void(DwarfAttribute, DwarfForm, uint64));
MOCK_METHOD0(EndAttributes, bool());
- MOCK_METHOD3(FindChildHandler, DIEHandler *(uint64, DwarfTag,
- const AttributeList &));
+ MOCK_METHOD2(FindChildHandler, DIEHandler *(uint64, DwarfTag));
MOCK_METHOD0(Finish, void());
};
@@ -94,11 +92,10 @@ class MockRootDIEHandler: public RootDIEHandler {
MOCK_METHOD3(ProcessAttributeSignature,
void(DwarfAttribute, DwarfForm, uint64));
MOCK_METHOD0(EndAttributes, bool());
- MOCK_METHOD3(FindChildHandler, DIEHandler *(uint64, DwarfTag,
- const AttributeList &));
+ MOCK_METHOD2(FindChildHandler, DIEHandler *(uint64, DwarfTag));
MOCK_METHOD0(Finish, void());
MOCK_METHOD5(StartCompilationUnit, bool(uint64, uint8, uint8, uint64, uint8));
- MOCK_METHOD3(StartRootDIE, bool(uint64, DwarfTag, const AttributeList &));
+ MOCK_METHOD2(StartRootDIE, bool(uint64, DwarfTag));
};
// If the handler elects to skip the compilation unit, the dispatcher
@@ -129,18 +126,13 @@ TEST(Dwarf2DIEHandler, SkipRootDIE) {
MockRootDIEHandler mock_root_handler;
DIEDispatcher die_dispatcher(&mock_root_handler);
- AttributeList mock_attribute_list;
- mock_attribute_list.push_back(make_pair(dwarf2reader::DW_AT_name,
- dwarf2reader::DW_FORM_string));
-
EXPECT_CALL(mock_root_handler,
StartCompilationUnit(0xde8994029fc8b999LL, 0xf4, 0x02,
0xb00febffa76e2b2bLL, 0x5c))
.InSequence(s)
.WillOnce(Return(true));
EXPECT_CALL(mock_root_handler,
- StartRootDIE(0x7d08242b4b510cf2LL, (DwarfTag) 0xb4f98da6,
- ContainerEq(mock_attribute_list)))
+ StartRootDIE(0x7d08242b4b510cf2LL, (DwarfTag) 0xb4f98da6))
.InSequence(s)
.WillOnce(Return(false));
@@ -148,8 +140,7 @@ TEST(Dwarf2DIEHandler, SkipRootDIE) {
0xf4, 0x02,
0xb00febffa76e2b2bLL, 0x5c));
EXPECT_FALSE(die_dispatcher.StartDIE(0x7d08242b4b510cf2LL,
- (DwarfTag) 0xb4f98da6,
- mock_attribute_list));
+ (DwarfTag) 0xb4f98da6));
die_dispatcher.EndDIE(0x7d08242b4b510cf2LL);
}
@@ -160,8 +151,6 @@ TEST(Dwarf2DIEHandler, SkipRootDIEChildren) {
MockRootDIEHandler mock_root_handler;
DIEDispatcher die_dispatcher(&mock_root_handler);
- AttributeList mock_attribute_list;
-
{
InSequence s;
@@ -170,8 +159,7 @@ TEST(Dwarf2DIEHandler, SkipRootDIEChildren) {
0x09f8bf0767f91675LL, 0xdb))
.WillOnce(Return(true));
EXPECT_CALL(mock_root_handler,
- StartRootDIE(0x7d08242b4b510cf2LL, (DwarfTag) 0xb4f98da6,
- ContainerEq(mock_attribute_list)))
+ StartRootDIE(0x7d08242b4b510cf2LL, (DwarfTag) 0xb4f98da6))
.WillOnce(Return(true));
// Please don't tell me about my children.
EXPECT_CALL(mock_root_handler, EndAttributes())
@@ -184,11 +172,9 @@ TEST(Dwarf2DIEHandler, SkipRootDIEChildren) {
0x26, 0xa0,
0x09f8bf0767f91675LL, 0xdb));
EXPECT_TRUE(die_dispatcher.StartDIE(0x7d08242b4b510cf2LL,
- (DwarfTag) 0xb4f98da6,
- mock_attribute_list));
+ (DwarfTag) 0xb4f98da6));
EXPECT_FALSE(die_dispatcher.StartDIE(0x435150ceedccda18LL,
- (DwarfTag) 0xc3a17bba,
- mock_attribute_list));
+ (DwarfTag) 0xc3a17bba));
die_dispatcher.EndDIE(0x435150ceedccda18LL);
die_dispatcher.EndDIE(0x7d08242b4b510cf2LL);
}
@@ -199,9 +185,6 @@ TEST(Dwarf2DIEHandler, PassAttributeValues) {
MockRootDIEHandler mock_root_handler;
DIEDispatcher die_dispatcher(&mock_root_handler);
- AttributeList mock_attribute_list;
- mock_attribute_list.push_back(make_pair(dwarf2reader::DW_AT_name,
- dwarf2reader::DW_FORM_string));
const char buffer[10] = { 0x24, 0x24, 0x35, 0x9a, 0xca,
0xcf, 0xa8, 0x84, 0xa7, 0x18 };
string str = "\xc8\x26\x2e\x0d\xa4\x9c\x37\xd6\xfb\x1d";
@@ -218,8 +201,7 @@ TEST(Dwarf2DIEHandler, PassAttributeValues) {
// We'll like the root DIE.
EXPECT_CALL(mock_root_handler,
- StartRootDIE(0xe2222da01e29f2a9LL, (DwarfTag) 0x9829445c,
- ContainerEq(mock_attribute_list)))
+ StartRootDIE(0xe2222da01e29f2a9LL, (DwarfTag) 0x9829445c))
.WillOnce(Return(true));
// Expect some attribute values.
@@ -255,7 +237,7 @@ TEST(Dwarf2DIEHandler, PassAttributeValues) {
.WillOnce(Return());
EXPECT_CALL(mock_root_handler, EndAttributes())
.WillOnce(Return(true));
- EXPECT_CALL(mock_root_handler, FindChildHandler(_, _, _))
+ EXPECT_CALL(mock_root_handler, FindChildHandler(_, _))
.Times(0);
EXPECT_CALL(mock_root_handler, Finish())
.WillOnce(Return());
@@ -270,8 +252,7 @@ TEST(Dwarf2DIEHandler, PassAttributeValues) {
0x66));
// Report the root DIE.
EXPECT_TRUE(die_dispatcher.StartDIE(0xe2222da01e29f2a9LL,
- (DwarfTag) 0x9829445c,
- mock_attribute_list));
+ (DwarfTag) 0x9829445c));
// Report some attribute values.
die_dispatcher.ProcessAttributeUnsigned(0xe2222da01e29f2a9LL,
@@ -309,25 +290,6 @@ TEST(Dwarf2DIEHandler, FindAndSkipChildren) {
MockDIEHandler *mock_child3_handler = new(MockDIEHandler);
DIEDispatcher die_dispatcher(&mock_root_handler);
- AttributeList root_attribute_list;
- root_attribute_list.push_back(make_pair((DwarfAttribute) 0xb01185df,
- (DwarfForm) 0xbc97cee8));
- AttributeList child1_attribute_list;
- child1_attribute_list.push_back(make_pair((DwarfAttribute) 0x41014e43,
- (DwarfForm) 0x63155f4c));
- AttributeList grandchild1_attribute_list;
- grandchild1_attribute_list.push_back(make_pair((DwarfAttribute) 0xf72f823c,
- (DwarfForm) 0x0ff6a201));
- AttributeList greatgrandchild1_attribute_list;
- greatgrandchild1_attribute_list
- .push_back(make_pair((DwarfAttribute) 0xbe66e5f0, (DwarfForm) 0xb4b24ff7));
- AttributeList child2_attribute_list;
- child1_attribute_list.push_back(make_pair((DwarfAttribute) 0xf22df14c,
- (DwarfForm) 0x20676e7d));
- AttributeList child3_attribute_list;
- child3_attribute_list.push_back(make_pair((DwarfAttribute) 0xe8bf1201,
- (DwarfForm) 0x53a5b7a8));
-
{
InSequence s;
@@ -340,8 +302,7 @@ TEST(Dwarf2DIEHandler, FindAndSkipChildren) {
// Root DIE.
{
EXPECT_CALL(mock_root_handler,
- StartRootDIE(0x15f0e06bdfe3c372LL, (DwarfTag) 0xf5d60c59,
- ContainerEq(root_attribute_list)))
+ StartRootDIE(0x15f0e06bdfe3c372LL, (DwarfTag) 0xf5d60c59))
.WillOnce(Return(true));
EXPECT_CALL(mock_root_handler,
ProcessAttributeSigned((DwarfAttribute) 0xf779a642,
@@ -354,8 +315,7 @@ TEST(Dwarf2DIEHandler, FindAndSkipChildren) {
// First child DIE.
EXPECT_CALL(mock_root_handler,
FindChildHandler(0x149f644f8116fe8cLL,
- (DwarfTag) 0xac2cbd8c,
- ContainerEq(child1_attribute_list)))
+ (DwarfTag) 0xac2cbd8c))
.WillOnce(Return(mock_child1_handler));
{
EXPECT_CALL(*mock_child1_handler,
@@ -374,15 +334,13 @@ TEST(Dwarf2DIEHandler, FindAndSkipChildren) {
// for this child.
EXPECT_CALL(mock_root_handler,
FindChildHandler(0x97412be24875de9dLL,
- (DwarfTag) 0x505a068b,
- ContainerEq(child2_attribute_list)))
+ (DwarfTag) 0x505a068b))
.WillOnce(Return((DIEHandler *) NULL));
// Third child DIE.
EXPECT_CALL(mock_root_handler,
FindChildHandler(0x753c964c8ab538aeLL,
- (DwarfTag) 0x8c22970e,
- ContainerEq(child3_attribute_list)))
+ (DwarfTag) 0x8c22970e))
.WillOnce(Return(mock_child3_handler));
{
EXPECT_CALL(*mock_child3_handler,
@@ -411,8 +369,7 @@ TEST(Dwarf2DIEHandler, FindAndSkipChildren) {
// Report the root DIE.
{
EXPECT_TRUE(die_dispatcher.StartDIE(0x15f0e06bdfe3c372LL,
- (DwarfTag) 0xf5d60c59,
- root_attribute_list));
+ (DwarfTag) 0xf5d60c59));
die_dispatcher.ProcessAttributeSigned(0x15f0e06bdfe3c372LL,
(DwarfAttribute) 0xf779a642,
(DwarfForm) 0x2cb63027,
@@ -421,8 +378,7 @@ TEST(Dwarf2DIEHandler, FindAndSkipChildren) {
// First child DIE.
{
EXPECT_TRUE(die_dispatcher.StartDIE(0x149f644f8116fe8cLL,
- (DwarfTag) 0xac2cbd8c,
- child1_attribute_list));
+ (DwarfTag) 0xac2cbd8c));
die_dispatcher.ProcessAttributeSigned(0x149f644f8116fe8cLL,
(DwarfAttribute) 0xa6fd6f65,
(DwarfForm) 0xe4f64c41,
@@ -431,15 +387,13 @@ TEST(Dwarf2DIEHandler, FindAndSkipChildren) {
// First grandchild DIE. Will be skipped.
{
EXPECT_FALSE(die_dispatcher.StartDIE(0xd68de1ee0bd29419LL,
- (DwarfTag) 0x22f05a15,
- grandchild1_attribute_list));
+ (DwarfTag) 0x22f05a15));
// First great-grandchild DIE. Will be skipped without being
// mentioned to any handler.
{
EXPECT_FALSE(die_dispatcher
.StartDIE(0xb3076285d25cac25LL,
- (DwarfTag) 0xcff4061b,
- greatgrandchild1_attribute_list));
+ (DwarfTag) 0xcff4061b));
die_dispatcher.EndDIE(0xb3076285d25cac25LL);
}
die_dispatcher.EndDIE(0xd68de1ee0bd29419LL);
@@ -450,16 +404,14 @@ TEST(Dwarf2DIEHandler, FindAndSkipChildren) {
// Second child DIE. Root handler will decline to find a handler for it.
{
EXPECT_FALSE(die_dispatcher.StartDIE(0x97412be24875de9dLL,
- (DwarfTag) 0x505a068b,
- child2_attribute_list));
+ (DwarfTag) 0x505a068b));
die_dispatcher.EndDIE(0x97412be24875de9dLL);
}
// Third child DIE.
{
EXPECT_TRUE(die_dispatcher.StartDIE(0x753c964c8ab538aeLL,
- (DwarfTag) 0x8c22970e,
- child3_attribute_list));
+ (DwarfTag) 0x8c22970e));
die_dispatcher.ProcessAttributeSigned(0x753c964c8ab538aeLL,
(DwarfAttribute) 0x4e2b7cfb,
(DwarfForm) 0x610b7ae1,
@@ -478,7 +430,6 @@ TEST(Dwarf2DIEHandler, FreeHandlersOnStack) {
MockRootDIEHandler mock_root_handler;
MockDIEHandler *mock_child_handler = new(MockDIEHandler);
MockDIEHandler *mock_grandchild_handler = new(MockDIEHandler);
- AttributeList empty_attribute_list;
{
InSequence s;
@@ -492,8 +443,7 @@ TEST(Dwarf2DIEHandler, FreeHandlersOnStack) {
// Root DIE.
{
EXPECT_CALL(mock_root_handler,
- StartRootDIE(0xbf13b761691ddc91LL, (DwarfTag) 0x98980361,
- ContainerEq(empty_attribute_list)))
+ StartRootDIE(0xbf13b761691ddc91LL, (DwarfTag) 0x98980361))
.WillOnce(Return(true));
EXPECT_CALL(mock_root_handler, EndAttributes())
.WillOnce(Return(true));
@@ -501,8 +451,7 @@ TEST(Dwarf2DIEHandler, FreeHandlersOnStack) {
// Child DIE.
EXPECT_CALL(mock_root_handler,
FindChildHandler(0x058f09240c5fc8c9LL,
- (DwarfTag) 0x898bf0d0,
- ContainerEq(empty_attribute_list)))
+ (DwarfTag) 0x898bf0d0))
.WillOnce(Return(mock_child_handler));
{
EXPECT_CALL(*mock_child_handler, EndAttributes())
@@ -511,8 +460,7 @@ TEST(Dwarf2DIEHandler, FreeHandlersOnStack) {
// Grandchild DIE.
EXPECT_CALL(*mock_child_handler,
FindChildHandler(0x32dc00c9945dc0c8LL,
- (DwarfTag) 0x2802d007,
- ContainerEq(empty_attribute_list)))
+ (DwarfTag) 0x2802d007))
.WillOnce(Return(mock_grandchild_handler));
{
EXPECT_CALL(*mock_grandchild_handler,
@@ -548,20 +496,17 @@ TEST(Dwarf2DIEHandler, FreeHandlersOnStack) {
// Report the root DIE.
{
EXPECT_TRUE(die_dispatcher.StartDIE(0xbf13b761691ddc91LL,
- (DwarfTag) 0x98980361,
- empty_attribute_list));
+ (DwarfTag) 0x98980361));
// Child DIE.
{
EXPECT_TRUE(die_dispatcher.StartDIE(0x058f09240c5fc8c9LL,
- (DwarfTag) 0x898bf0d0,
- empty_attribute_list));
+ (DwarfTag) 0x898bf0d0));
// Grandchild DIE.
{
EXPECT_TRUE(die_dispatcher.StartDIE(0x32dc00c9945dc0c8LL,
- (DwarfTag) 0x2802d007,
- empty_attribute_list));
+ (DwarfTag) 0x2802d007));
die_dispatcher.ProcessAttributeSigned(0x32dc00c9945dc0c8LL,
(DwarfAttribute) 0x4e2b7cfb,
(DwarfForm) 0x610b7ae1,
diff --git a/src/common/dwarf/dwarf2reader.cc b/src/common/dwarf/dwarf2reader.cc
index 7c1a29dd..f1a07f0b 100644
--- a/src/common/dwarf/dwarf2reader.cc
+++ b/src/common/dwarf/dwarf2reader.cc
@@ -500,7 +500,7 @@ void CompilationUnit::ProcessDIEs() {
const Abbrev& abbrev = abbrevs_->at(static_cast<size_t>(abbrev_num));
const enum DwarfTag tag = abbrev.tag;
- if (!handler_->StartDIE(absolute_offset, tag, abbrev.attributes)) {
+ if (!handler_->StartDIE(absolute_offset, tag)) {
dieptr = SkipDIE(dieptr, abbrev);
} else {
dieptr = ProcessDIE(absolute_offset, dieptr, abbrev);
diff --git a/src/common/dwarf/dwarf2reader.h b/src/common/dwarf/dwarf2reader.h
index ecf4eb2a..8824bf90 100644
--- a/src/common/dwarf/dwarf2reader.h
+++ b/src/common/dwarf/dwarf2reader.h
@@ -342,8 +342,7 @@ class Dwarf2Handler {
// Start to process a DIE at OFFSET from the beginning of the .debug_info
// section. Return false if you would like to skip this DIE.
- virtual bool StartDIE(uint64 offset, enum DwarfTag tag,
- const AttributeList& attrs) { return false; }
+ virtual bool StartDIE(uint64 offset, enum DwarfTag tag) { return false; }
// Called when we have an attribute with unsigned data to give to our
// handler. The attribute is for the DIE at OFFSET from the beginning of the
diff --git a/src/common/dwarf/dwarf2reader_die_unittest.cc b/src/common/dwarf/dwarf2reader_die_unittest.cc
index 96e95b7d..f8462a19 100644
--- a/src/common/dwarf/dwarf2reader_die_unittest.cc
+++ b/src/common/dwarf/dwarf2reader_die_unittest.cc
@@ -50,7 +50,6 @@ using google_breakpad::test_assembler::Section;
using google_breakpad::test_assembler::kBigEndian;
using google_breakpad::test_assembler::kLittleEndian;
-using dwarf2reader::AttributeList;
using dwarf2reader::ByteReader;
using dwarf2reader::CompilationUnit;
using dwarf2reader::Dwarf2Handler;
@@ -76,8 +75,7 @@ class MockDwarf2Handler: public Dwarf2Handler {
MOCK_METHOD5(StartCompilationUnit, bool(uint64 offset, uint8 address_size,
uint8 offset_size, uint64 cu_length,
uint8 dwarf_version));
- MOCK_METHOD3(StartDIE, bool(uint64 offset, enum DwarfTag tag,
- const AttributeList& attrs));
+ MOCK_METHOD2(StartDIE, bool(uint64 offset, enum DwarfTag tag));
MOCK_METHOD4(ProcessAttributeUnsigned, void(uint64 offset,
DwarfAttribute attr,
enum DwarfForm form,
@@ -115,7 +113,7 @@ struct DIEFixture {
// Default expectations for the data handler.
EXPECT_CALL(handler, StartCompilationUnit(_, _, _, _, _)).Times(0);
- EXPECT_CALL(handler, StartDIE(_, _, _)).Times(0);
+ EXPECT_CALL(handler, StartDIE(_, _)).Times(0);
EXPECT_CALL(handler, ProcessAttributeUnsigned(_, _, _, _)).Times(0);
EXPECT_CALL(handler, ProcessAttributeSigned(_, _, _, _)).Times(0);
EXPECT_CALL(handler, ProcessAttributeReference(_, _, _, _)).Times(0);
@@ -186,7 +184,7 @@ TEST_P(DwarfHeader, Header) {
GetParam().format_size, _,
GetParam().version))
.WillOnce(Return(true));
- EXPECT_CALL(handler, StartDIE(_, dwarf2reader::DW_TAG_compile_unit, _))
+ EXPECT_CALL(handler, StartDIE(_, dwarf2reader::DW_TAG_compile_unit))
.WillOnce(Return(true));
EXPECT_CALL(handler, ProcessAttributeString(_, dwarf2reader::DW_AT_name,
dwarf2reader::DW_FORM_string,
@@ -262,7 +260,7 @@ struct DwarfFormsFixture: public DIEFixture {
params.version))
.InSequence(s)
.WillOnce(Return(true));
- EXPECT_CALL(handler, StartDIE(_, tag, _))
+ EXPECT_CALL(handler, StartDIE(_, tag))
.InSequence(s)
.WillOnce(Return(true));
}
diff --git a/src/common/dwarf/functioninfo.cc b/src/common/dwarf/functioninfo.cc
index c0456224..69023bff 100644
--- a/src/common/dwarf/functioninfo.cc
+++ b/src/common/dwarf/functioninfo.cc
@@ -121,8 +121,7 @@ bool CUFunctionInfoHandler::StartCompilationUnit(uint64 offset,
// subroutines. For line info, the DW_AT_stmt_list lives in the
// compile unit tag.
-bool CUFunctionInfoHandler::StartDIE(uint64 offset, enum DwarfTag tag,
- const AttributeList& attrs) {
+bool CUFunctionInfoHandler::StartDIE(uint64 offset, enum DwarfTag tag) {
switch (tag) {
case DW_TAG_subprogram:
case DW_TAG_inlined_subroutine: {
diff --git a/src/common/dwarf/functioninfo.h b/src/common/dwarf/functioninfo.h
index f8706369..0b08a5fc 100644
--- a/src/common/dwarf/functioninfo.h
+++ b/src/common/dwarf/functioninfo.h
@@ -135,8 +135,7 @@ class CUFunctionInfoHandler: public Dwarf2Handler {
// Start to process a DIE at OFFSET from the beginning of the
// .debug_info section. We only care about function related DIE's.
- virtual bool StartDIE(uint64 offset, enum DwarfTag tag,
- const AttributeList& attrs);
+ virtual bool StartDIE(uint64 offset, enum DwarfTag tag);
// Called when we have an attribute with unsigned data to give to
// our handler. The attribute is for the DIE at OFFSET from the
diff --git a/src/common/dwarf_cu_to_module.cc b/src/common/dwarf_cu_to_module.cc
index 1f1a1743..04b8843f 100644
--- a/src/common/dwarf_cu_to_module.cc
+++ b/src/common/dwarf_cu_to_module.cc
@@ -511,8 +511,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.
@@ -525,8 +524,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);
@@ -667,8 +665,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);
@@ -978,8 +975,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/src/common/dwarf_cu_to_module.h b/src/common/dwarf_cu_to_module.h
index ac62846e..c7072b0f 100644
--- a/src/common/dwarf_cu_to_module.h
+++ b/src/common/dwarf_cu_to_module.h
@@ -50,7 +50,6 @@
namespace google_breakpad {
-using dwarf2reader::AttributeList;
using dwarf2reader::DwarfAttribute;
using dwarf2reader::DwarfForm;
using dwarf2reader::DwarfLanguage;
@@ -201,8 +200,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_.
@@ -211,8 +209,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/src/common/dwarf_cu_to_module_unittest.cc b/src/common/dwarf_cu_to_module_unittest.cc
index 377630e3..e71d344b 100644
--- a/src/common/dwarf_cu_to_module_unittest.cc
+++ b/src/common/dwarf_cu_to_module_unittest.cc
@@ -42,7 +42,6 @@
using std::make_pair;
using std::vector;
-using dwarf2reader::AttributeList;
using dwarf2reader::DIEHandler;
using dwarf2reader::DwarfTag;
using dwarf2reader::DwarfAttribute;
@@ -177,11 +176,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
@@ -329,20 +324,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,
@@ -364,20 +347,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,
@@ -401,12 +370,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(0x8f4c783c0467c989ULL, tag, attrs);
+ = parent->FindChildHandler(0x8f4c783c0467c989ULL, tag);
if (!handler)
return NULL;
handler->ProcessAttributeString(dwarf2reader::DW_AT_name,
@@ -426,14 +391,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(0x8f4c783c0467c989ULL, tag, attrs);
+ = parent->FindChildHandler(0x8f4c783c0467c989ULL, tag);
if (!handler)
return NULL;
if (name)
@@ -456,18 +415,9 @@ void CUFixtureBase::DefineFunction(dwarf2reader::DIEHandler *parent,
const string &name, Module::Address address,
Module::Address size,
const char* mangled_name) {
- 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(0xe34797c7e68590a8LL,
- dwarf2reader::DW_TAG_subprogram,
- func_attrs);
+ dwarf2reader::DW_TAG_subprogram);
ASSERT_TRUE(func != NULL);
func->ProcessAttributeString(dwarf2reader::DW_AT_name,
dwarf2reader::DW_FORM_strp,
@@ -493,15 +443,7 @@ void CUFixtureBase::DeclarationDIE(DIEHandler *parent, uint64 offset,
DwarfTag tag,
const string &name,
const string &mangled_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,
@@ -526,20 +468,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,
@@ -567,16 +497,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,
@@ -602,21 +524,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,
@@ -731,22 +641,19 @@ TEST_F(SimpleCU, MangledName) {
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;
}
@@ -1478,7 +1385,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");
@@ -1487,10 +1393,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,
@@ -1502,8 +1406,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,
@@ -1519,8 +1423,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, "",
@@ -1635,14 +1539,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");
@@ -1698,10 +1596,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