aboutsummaryrefslogtreecommitdiff
path: root/src/common/dwarf_cu_to_module_unittest.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/dwarf_cu_to_module_unittest.cc')
-rw-r--r--src/common/dwarf_cu_to_module_unittest.cc569
1 files changed, 285 insertions, 284 deletions
diff --git a/src/common/dwarf_cu_to_module_unittest.cc b/src/common/dwarf_cu_to_module_unittest.cc
index ed1d7c9b..f3fa4903 100644
--- a/src/common/dwarf_cu_to_module_unittest.cc
+++ b/src/common/dwarf_cu_to_module_unittest.cc
@@ -1,5 +1,4 @@
-// Copyright (c) 2010 Google Inc.
-// All rights reserved.
+// Copyright 2010 Google LLC
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
@@ -11,7 +10,7 @@
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
-// * Neither the name of Google Inc. nor the names of its
+// * Neither the name of Google LLC nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
@@ -44,17 +43,17 @@
using std::make_pair;
using std::vector;
-using dwarf2reader::DIEHandler;
-using dwarf2reader::DwarfTag;
-using dwarf2reader::DwarfAttribute;
-using dwarf2reader::DwarfForm;
-using dwarf2reader::DwarfInline;
-using dwarf2reader::RootDIEHandler;
+using google_breakpad::DIEHandler;
+using google_breakpad::DwarfTag;
+using google_breakpad::DwarfAttribute;
+using google_breakpad::DwarfForm;
+using google_breakpad::DwarfInline;
using google_breakpad::DwarfCUToModule;
using google_breakpad::Module;
using ::testing::_;
using ::testing::AtMost;
+using ::testing::DoAll;
using ::testing::Invoke;
using ::testing::Return;
using ::testing::Test;
@@ -67,23 +66,28 @@ using ::testing::ValuesIn;
class MockLineToModuleHandler: public DwarfCUToModule::LineToModuleHandler {
public:
MOCK_METHOD1(StartCompilationUnit, void(const string& compilation_dir));
- MOCK_METHOD4(ReadProgram, void(const uint8_t *program, uint64_t length,
- Module *module, vector<Module::Line> *lines));
+ MOCK_METHOD9(ReadProgram, void(const uint8_t* program, uint64_t length,
+ const uint8_t* string_section,
+ uint64_t string_section_length,
+ const uint8_t* line_string_section,
+ uint64_t line_string_section_length,
+ Module* module, vector<Module::Line>* lines,
+ std::map<uint32_t, Module::File*>* files));
};
class MockWarningReporter: public DwarfCUToModule::WarningReporter {
public:
- MockWarningReporter(const string &filename, uint64_t cu_offset)
+ MockWarningReporter(const string& filename, uint64_t cu_offset)
: DwarfCUToModule::WarningReporter(filename, cu_offset) { }
- MOCK_METHOD1(SetCUName, void(const string &name));
+ MOCK_METHOD1(SetCUName, void(const string& name));
MOCK_METHOD2(UnknownSpecification, void(uint64_t offset, uint64_t target));
MOCK_METHOD2(UnknownAbstractOrigin, void(uint64_t offset, uint64_t target));
- MOCK_METHOD1(MissingSection, void(const string &section_name));
+ MOCK_METHOD1(MissingSection, void(const string& section_name));
MOCK_METHOD1(BadLineInfoOffset, void(uint64_t offset));
- MOCK_METHOD1(UncoveredFunction, void(const Module::Function &function));
- MOCK_METHOD1(UncoveredLine, void(const Module::Line &line));
+ MOCK_METHOD1(UncoveredFunction, void(const Module::Function& function));
+ MOCK_METHOD1(UncoveredLine, void(const Module::Line& line));
MOCK_METHOD1(UnnamedFunction, void(uint64_t offset));
- MOCK_METHOD1(DemangleError, void(const string &input));
+ MOCK_METHOD1(DemangleError, void(const string& input));
MOCK_METHOD2(UnhandledInterCUReference, void(uint64_t offset, uint64_t target));
};
@@ -112,19 +116,24 @@ class CUFixtureBase {
class AppendLinesFunctor {
public:
explicit AppendLinesFunctor(
- const vector<Module::Line> *lines) : lines_(lines) { }
- void operator()(const uint8_t *program, uint64_t length,
- Module *module, vector<Module::Line> *lines) {
+ const vector<Module::Line>* lines) : lines_(lines) { }
+ void operator()(const uint8_t* program, uint64_t length,
+ const uint8_t* string_section,
+ uint64_t string_section_length,
+ const uint8_t* line_string_section,
+ uint64_t line_string_section_length,
+ Module *module, vector<Module::Line>* lines,
+ std::map<uint32_t, Module::File*>* files) {
lines->insert(lines->end(), lines_->begin(), lines_->end());
}
private:
- const vector<Module::Line> *lines_;
+ const vector<Module::Line>* lines_;
};
CUFixtureBase()
: module_("module-name", "module-os", "module-arch", "module-id"),
file_context_("dwarf-filename", &module_, true),
- language_(dwarf2reader::DW_LANG_none),
+ language_(google_breakpad::DW_LANG_none),
language_signed_(false),
appender_(&lines_),
reporter_("dwarf-filename", 0xcf8f9bb6443d29b5LL),
@@ -147,7 +156,7 @@ class CUFixtureBase {
// By default, expect the line program reader not to be invoked. We
// may override this in StartCU.
EXPECT_CALL(line_reader_, StartCompilationUnit(_)).Times(0);
- EXPECT_CALL(line_reader_, ReadProgram(_,_,_,_)).Times(0);
+ EXPECT_CALL(line_reader_, ReadProgram(_,_,_,_,_,_,_,_,_)).Times(0);
// The handler will consult this section map to decide what to
// pass to our line reader.
@@ -161,12 +170,12 @@ class CUFixtureBase {
// when it invokes its LineToModuleHandler. Call this before calling
// StartCU.
void PushLine(Module::Address address, Module::Address size,
- const string &filename, int line_number);
+ const string& filename, int line_number);
// Use LANGUAGE for the compilation unit. More precisely, arrange
// for StartCU to pass the compilation unit's root DIE a
// DW_AT_language attribute whose value is LANGUAGE.
- void SetLanguage(dwarf2reader::DwarfLanguage language) {
+ void SetLanguage(google_breakpad::DwarfLanguage language) {
language_ = language;
}
@@ -182,61 +191,61 @@ class CUFixtureBase {
void StartCU();
// 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
// the handler ready to hear about children: call EndAttributes, but
// not Finish.
- DIEHandler *StartNamedDIE(DIEHandler *parent, DwarfTag tag,
- const string &name);
+ DIEHandler* StartNamedDIE(DIEHandler* parent, DwarfTag tag,
+ const string& name);
// Start a child DIE of PARENT with the given tag and a
// DW_AT_specification attribute whose value is SPECIFICATION. Leave
// the handler ready to hear about children: call EndAttributes, but
// not Finish. If NAME is non-zero, use it as the DW_AT_name
// attribute.
- DIEHandler *StartSpecifiedDIE(DIEHandler *parent, DwarfTag tag,
- uint64_t specification, const char *name = NULL);
+ DIEHandler* StartSpecifiedDIE(DIEHandler* parent, DwarfTag tag,
+ uint64_t specification, const char* name = NULL);
// Define a function as a child of PARENT with the given name, address, and
// size. If high_pc_form is DW_FORM_addr then the DW_AT_high_pc attribute
// will be written as an address; otherwise it will be written as the
// function's size. Call EndAttributes and Finish; one cannot define
// children of the defined function's DIE.
- void DefineFunction(DIEHandler *parent, const string &name,
+ void DefineFunction(DIEHandler* parent, const string& name,
Module::Address address, Module::Address size,
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
// offset, tag and name. If NAME is the empty string, don't provide
// a DW_AT_name attribute. Call EndAttributes and Finish.
- void DeclarationDIE(DIEHandler *parent, uint64_t offset,
- DwarfTag tag, const string &name,
- const string &mangled_name);
+ void DeclarationDIE(DIEHandler* parent, uint64_t offset,
+ DwarfTag tag, const string& name,
+ const string& mangled_name);
// Create a definition DIE as a child of PARENT with the given tag
// that refers to the declaration DIE at offset SPECIFICATION as its
// specification. If NAME is non-empty, pass it as the DW_AT_name
// attribute. If SIZE is non-zero, record ADDRESS and SIZE as
// low_pc/high_pc attributes.
- void DefinitionDIE(DIEHandler *parent, DwarfTag tag,
- uint64_t specification, const string &name,
+ void DefinitionDIE(DIEHandler* parent, DwarfTag tag,
+ uint64_t specification, const string& name,
Module::Address address = 0, Module::Address size = 0);
// Create an inline DW_TAG_subprogram DIE as a child of PARENT. If
// SPECIFICATION is non-zero, then the DIE refers to the declaration DIE at
// offset SPECIFICATION as its specification. If Name is non-empty, pass it
// as the DW_AT_name attribute.
- void AbstractInstanceDIE(DIEHandler *parent, uint64_t offset,
+ void AbstractInstanceDIE(DIEHandler* parent, uint64_t offset,
DwarfInline type, uint64_t specification,
- const string &name,
- DwarfForm form = dwarf2reader::DW_FORM_data1);
+ const string& name,
+ DwarfForm form = google_breakpad::DW_FORM_data1);
// 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
// string, don't provide a DW_AT_name attribute.
- void DefineInlineInstanceDIE(DIEHandler *parent, const string &name,
+ void DefineInlineInstanceDIE(DIEHandler* parent, const string& name,
uint64_t origin, Module::Address address,
Module::Address size);
@@ -251,7 +260,7 @@ class CUFixtureBase {
// Test that the I'th function (ordered by address) in the module
// this.module_ has the given name, address, and size, and that its
// parameter size is zero.
- void TestFunction(int i, const string &name,
+ void TestFunction(int i, const string& name,
Module::Address address, Module::Address size);
// Test that the number of source lines owned by the I'th function
@@ -262,7 +271,7 @@ class CUFixtureBase {
// (again, by address) has the given address, size, filename, and
// line number.
void TestLine(int i, int j, Module::Address address, Module::Address size,
- const string &filename, int number);
+ const string& filename, int number);
// Actual objects under test.
Module module_;
@@ -270,7 +279,7 @@ class CUFixtureBase {
// 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.
- dwarf2reader::DwarfLanguage language_;
+ google_breakpad::DwarfLanguage language_;
// If this is true, report DW_AT_language as a signed value; if false,
// report it as an unsigned value.
@@ -300,7 +309,7 @@ class CUFixtureBase {
// If functions_filled_ is true, this is a table of functions we've
// extracted from module_, sorted by address.
- vector<Module::Function *> functions_;
+ vector<Module::Function*> functions_;
// True if we have filled the above vector with this.module_'s function list.
bool functions_filled_;
};
@@ -310,7 +319,7 @@ const size_t CUFixtureBase::dummy_line_size_ =
sizeof(CUFixtureBase::dummy_line_program_);
void CUFixtureBase::PushLine(Module::Address address, Module::Address size,
- const string &filename, int line_number) {
+ const string& filename, int line_number) {
Module::Line l;
l.address = address;
l.size = size;
@@ -332,43 +341,43 @@ void CUFixtureBase::StartCU() {
if (!lines_.empty())
EXPECT_CALL(line_reader_,
ReadProgram(&dummy_line_program_[0], dummy_line_size_,
- &module_, _))
+ _,_,_,_,
+ &module_, _,_))
.Times(AtMost(1))
.WillOnce(DoAll(Invoke(appender_), Return()));
-
ASSERT_TRUE(root_handler_
.StartCompilationUnit(0x51182ec307610b51ULL, 0x81, 0x44,
0x4241b4f33720dd5cULL, 3));
{
ASSERT_TRUE(root_handler_.StartRootDIE(0x02e56bfbda9e7337ULL,
- dwarf2reader::DW_TAG_compile_unit));
+ google_breakpad::DW_TAG_compile_unit));
}
- root_handler_.ProcessAttributeString(dwarf2reader::DW_AT_name,
- dwarf2reader::DW_FORM_strp,
+ root_handler_.ProcessAttributeString(google_breakpad::DW_AT_name,
+ google_breakpad::DW_FORM_strp,
"compilation-unit-name");
if (!compilation_dir_.empty())
- root_handler_.ProcessAttributeString(dwarf2reader::DW_AT_comp_dir,
- dwarf2reader::DW_FORM_strp,
+ root_handler_.ProcessAttributeString(google_breakpad::DW_AT_comp_dir,
+ google_breakpad::DW_FORM_strp,
compilation_dir_);
if (!lines_.empty())
- root_handler_.ProcessAttributeUnsigned(dwarf2reader::DW_AT_stmt_list,
- dwarf2reader::DW_FORM_ref4,
+ root_handler_.ProcessAttributeUnsigned(google_breakpad::DW_AT_stmt_list,
+ google_breakpad::DW_FORM_ref4,
0);
- if (language_ != dwarf2reader::DW_LANG_none) {
+ if (language_ != google_breakpad::DW_LANG_none) {
if (language_signed_)
- root_handler_.ProcessAttributeSigned(dwarf2reader::DW_AT_language,
- dwarf2reader::DW_FORM_sdata,
+ root_handler_.ProcessAttributeSigned(google_breakpad::DW_AT_language,
+ google_breakpad::DW_FORM_sdata,
language_);
else
- root_handler_.ProcessAttributeUnsigned(dwarf2reader::DW_AT_language,
- dwarf2reader::DW_FORM_udata,
+ root_handler_.ProcessAttributeUnsigned(google_breakpad::DW_AT_language,
+ google_breakpad::DW_FORM_udata,
language_);
}
ASSERT_TRUE(root_handler_.EndAttributes());
}
void CUFixtureBase::ProcessStrangeAttributes(
- dwarf2reader::DIEHandler *handler) {
+ google_breakpad::DIEHandler* handler) {
handler->ProcessAttributeUnsigned((DwarfAttribute) 0xf560dead,
(DwarfForm) 0x4106e4db,
0xa592571997facda1ULL);
@@ -387,15 +396,15 @@ void CUFixtureBase::ProcessStrangeAttributes(
"strange string");
}
-DIEHandler *CUFixtureBase::StartNamedDIE(DIEHandler *parent,
+DIEHandler* CUFixtureBase::StartNamedDIE(DIEHandler* parent,
DwarfTag tag,
- const string &name) {
- dwarf2reader::DIEHandler *handler
+ const string& name) {
+ google_breakpad::DIEHandler* handler
= parent->FindChildHandler(0x8f4c783c0467c989ULL, tag);
if (!handler)
return NULL;
- handler->ProcessAttributeString(dwarf2reader::DW_AT_name,
- dwarf2reader::DW_FORM_strp,
+ handler->ProcessAttributeString(google_breakpad::DW_AT_name,
+ google_breakpad::DW_FORM_strp,
name);
ProcessStrangeAttributes(handler);
if (!handler->EndAttributes()) {
@@ -407,20 +416,20 @@ DIEHandler *CUFixtureBase::StartNamedDIE(DIEHandler *parent,
return handler;
}
-DIEHandler *CUFixtureBase::StartSpecifiedDIE(DIEHandler *parent,
+DIEHandler* CUFixtureBase::StartSpecifiedDIE(DIEHandler* parent,
DwarfTag tag,
uint64_t specification,
- const char *name) {
- dwarf2reader::DIEHandler *handler
+ const char* name) {
+ google_breakpad::DIEHandler* handler
= parent->FindChildHandler(0x8f4c783c0467c989ULL, tag);
if (!handler)
return NULL;
if (name)
- handler->ProcessAttributeString(dwarf2reader::DW_AT_name,
- dwarf2reader::DW_FORM_strp,
+ handler->ProcessAttributeString(google_breakpad::DW_AT_name,
+ google_breakpad::DW_FORM_strp,
name);
- handler->ProcessAttributeReference(dwarf2reader::DW_AT_specification,
- dwarf2reader::DW_FORM_ref4,
+ handler->ProcessAttributeReference(google_breakpad::DW_AT_specification,
+ google_breakpad::DW_FORM_ref4,
specification);
if (!handler->EndAttributes()) {
handler->Finish();
@@ -431,33 +440,33 @@ DIEHandler *CUFixtureBase::StartSpecifiedDIE(DIEHandler *parent,
return handler;
}
-void CUFixtureBase::DefineFunction(dwarf2reader::DIEHandler *parent,
- const string &name, Module::Address address,
+void CUFixtureBase::DefineFunction(google_breakpad::DIEHandler* parent,
+ const string& name, Module::Address address,
Module::Address size,
const char* mangled_name,
DwarfForm high_pc_form) {
- dwarf2reader::DIEHandler *func
+ google_breakpad::DIEHandler* func
= parent->FindChildHandler(0xe34797c7e68590a8LL,
- dwarf2reader::DW_TAG_subprogram);
+ google_breakpad::DW_TAG_subprogram);
ASSERT_TRUE(func != NULL);
- func->ProcessAttributeString(dwarf2reader::DW_AT_name,
- dwarf2reader::DW_FORM_strp,
+ func->ProcessAttributeString(google_breakpad::DW_AT_name,
+ google_breakpad::DW_FORM_strp,
name);
- func->ProcessAttributeUnsigned(dwarf2reader::DW_AT_low_pc,
- dwarf2reader::DW_FORM_addr,
+ func->ProcessAttributeUnsigned(google_breakpad::DW_AT_low_pc,
+ google_breakpad::DW_FORM_addr,
address);
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;
}
- func->ProcessAttributeUnsigned(dwarf2reader::DW_AT_high_pc,
+ func->ProcessAttributeUnsigned(google_breakpad::DW_AT_high_pc,
high_pc_form,
high_pc);
if (mangled_name)
- func->ProcessAttributeString(dwarf2reader::DW_AT_MIPS_linkage_name,
- dwarf2reader::DW_FORM_strp,
+ func->ProcessAttributeString(google_breakpad::DW_AT_MIPS_linkage_name,
+ google_breakpad::DW_FORM_strp,
mangled_name);
ProcessStrangeAttributes(func);
@@ -466,51 +475,51 @@ void CUFixtureBase::DefineFunction(dwarf2reader::DIEHandler *parent,
delete func;
}
-void CUFixtureBase::DeclarationDIE(DIEHandler *parent, uint64_t offset,
+void CUFixtureBase::DeclarationDIE(DIEHandler* parent, uint64_t offset,
DwarfTag tag,
- const string &name,
- const string &mangled_name) {
- dwarf2reader::DIEHandler *die = parent->FindChildHandler(offset, tag);
+ const string& name,
+ const string& mangled_name) {
+ google_breakpad::DIEHandler* die = parent->FindChildHandler(offset, tag);
ASSERT_TRUE(die != NULL);
if (!name.empty())
- die->ProcessAttributeString(dwarf2reader::DW_AT_name,
- dwarf2reader::DW_FORM_strp,
+ die->ProcessAttributeString(google_breakpad::DW_AT_name,
+ google_breakpad::DW_FORM_strp,
name);
if (!mangled_name.empty())
- die->ProcessAttributeString(dwarf2reader::DW_AT_MIPS_linkage_name,
- dwarf2reader::DW_FORM_strp,
+ die->ProcessAttributeString(google_breakpad::DW_AT_MIPS_linkage_name,
+ google_breakpad::DW_FORM_strp,
mangled_name);
- die->ProcessAttributeUnsigned(dwarf2reader::DW_AT_declaration,
- dwarf2reader::DW_FORM_flag,
+ die->ProcessAttributeUnsigned(google_breakpad::DW_AT_declaration,
+ google_breakpad::DW_FORM_flag,
1);
EXPECT_TRUE(die->EndAttributes());
die->Finish();
delete die;
}
-void CUFixtureBase::DefinitionDIE(DIEHandler *parent,
+void CUFixtureBase::DefinitionDIE(DIEHandler* parent,
DwarfTag tag,
uint64_t specification,
- const string &name,
+ const string& name,
Module::Address address,
Module::Address size) {
- dwarf2reader::DIEHandler *die
+ google_breakpad::DIEHandler* die
= parent->FindChildHandler(0x6ccfea031a9e6cc9ULL, tag);
ASSERT_TRUE(die != NULL);
- die->ProcessAttributeReference(dwarf2reader::DW_AT_specification,
- dwarf2reader::DW_FORM_ref4,
+ die->ProcessAttributeReference(google_breakpad::DW_AT_specification,
+ google_breakpad::DW_FORM_ref4,
specification);
if (!name.empty())
- die->ProcessAttributeString(dwarf2reader::DW_AT_name,
- dwarf2reader::DW_FORM_strp,
+ die->ProcessAttributeString(google_breakpad::DW_AT_name,
+ google_breakpad::DW_FORM_strp,
name);
if (size) {
- die->ProcessAttributeUnsigned(dwarf2reader::DW_AT_low_pc,
- dwarf2reader::DW_FORM_addr,
+ die->ProcessAttributeUnsigned(google_breakpad::DW_AT_low_pc,
+ google_breakpad::DW_FORM_addr,
address);
- die->ProcessAttributeUnsigned(dwarf2reader::DW_AT_high_pc,
- dwarf2reader::DW_FORM_addr,
+ die->ProcessAttributeUnsigned(google_breakpad::DW_AT_high_pc,
+ google_breakpad::DW_FORM_addr,
address + size);
}
EXPECT_TRUE(die->EndAttributes());
@@ -518,27 +527,27 @@ void CUFixtureBase::DefinitionDIE(DIEHandler *parent,
delete die;
}
-void CUFixtureBase::AbstractInstanceDIE(DIEHandler *parent,
+void CUFixtureBase::AbstractInstanceDIE(DIEHandler* parent,
uint64_t offset,
DwarfInline type,
uint64_t specification,
- const string &name,
+ const string& name,
DwarfForm form) {
- dwarf2reader::DIEHandler *die
- = parent->FindChildHandler(offset, dwarf2reader::DW_TAG_subprogram);
+ google_breakpad::DIEHandler* die
+ = parent->FindChildHandler(offset, google_breakpad::DW_TAG_subprogram);
ASSERT_TRUE(die != NULL);
if (specification != 0ULL)
- die->ProcessAttributeReference(dwarf2reader::DW_AT_specification,
- dwarf2reader::DW_FORM_ref4,
+ die->ProcessAttributeReference(google_breakpad::DW_AT_specification,
+ google_breakpad::DW_FORM_ref4,
specification);
- if (form == dwarf2reader::DW_FORM_sdata) {
- die->ProcessAttributeSigned(dwarf2reader::DW_AT_inline, form, type);
+ if (form == google_breakpad::DW_FORM_sdata) {
+ die->ProcessAttributeSigned(google_breakpad::DW_AT_inline, form, type);
} else {
- die->ProcessAttributeUnsigned(dwarf2reader::DW_AT_inline, form, type);
+ die->ProcessAttributeUnsigned(google_breakpad::DW_AT_inline, form, type);
}
if (!name.empty())
- die->ProcessAttributeString(dwarf2reader::DW_AT_name,
- dwarf2reader::DW_FORM_strp,
+ die->ProcessAttributeString(google_breakpad::DW_AT_name,
+ google_breakpad::DW_FORM_strp,
name);
EXPECT_TRUE(die->EndAttributes());
@@ -546,28 +555,28 @@ void CUFixtureBase::AbstractInstanceDIE(DIEHandler *parent,
delete die;
}
-void CUFixtureBase::DefineInlineInstanceDIE(DIEHandler *parent,
- const string &name,
+void CUFixtureBase::DefineInlineInstanceDIE(DIEHandler* parent,
+ const string& name,
uint64_t origin,
Module::Address address,
Module::Address size) {
- dwarf2reader::DIEHandler *func
+ google_breakpad::DIEHandler* func
= parent->FindChildHandler(0x11c70f94c6e87ccdLL,
- dwarf2reader::DW_TAG_subprogram);
+ google_breakpad::DW_TAG_subprogram);
ASSERT_TRUE(func != NULL);
if (!name.empty()) {
- func->ProcessAttributeString(dwarf2reader::DW_AT_name,
- dwarf2reader::DW_FORM_strp,
+ func->ProcessAttributeString(google_breakpad::DW_AT_name,
+ google_breakpad::DW_FORM_strp,
name);
}
- func->ProcessAttributeUnsigned(dwarf2reader::DW_AT_low_pc,
- dwarf2reader::DW_FORM_addr,
+ func->ProcessAttributeUnsigned(google_breakpad::DW_AT_low_pc,
+ google_breakpad::DW_FORM_addr,
address);
- func->ProcessAttributeUnsigned(dwarf2reader::DW_AT_high_pc,
- dwarf2reader::DW_FORM_addr,
+ func->ProcessAttributeUnsigned(google_breakpad::DW_AT_high_pc,
+ google_breakpad::DW_FORM_addr,
address + size);
- func->ProcessAttributeReference(dwarf2reader::DW_AT_abstract_origin,
- dwarf2reader::DW_FORM_ref4,
+ func->ProcessAttributeReference(google_breakpad::DW_AT_abstract_origin,
+ google_breakpad::DW_FORM_ref4,
origin);
ProcessStrangeAttributes(func);
EXPECT_TRUE(func->EndAttributes());
@@ -589,13 +598,13 @@ void CUFixtureBase::TestFunctionCount(size_t expected) {
ASSERT_EQ(expected, functions_.size());
}
-void CUFixtureBase::TestFunction(int i, const string &name,
+void CUFixtureBase::TestFunction(int i, const string& name,
Module::Address address,
Module::Address size) {
FillFunctions();
ASSERT_LT((size_t) i, functions_.size());
- Module::Function *function = functions_[i];
+ Module::Function* function = functions_[i];
EXPECT_EQ(name, function->name);
EXPECT_EQ(address, function->address);
EXPECT_EQ(size, function->ranges[0].size);
@@ -611,12 +620,12 @@ void CUFixtureBase::TestLineCount(int i, size_t expected) {
void CUFixtureBase::TestLine(int i, int j,
Module::Address address, Module::Address size,
- const string &filename, int number) {
+ const string& filename, int number) {
FillFunctions();
ASSERT_LT((size_t) i, functions_.size());
ASSERT_LT((size_t) j, functions_[i]->lines.size());
- Module::Line *line = &functions_[i]->lines[j];
+ Module::Line* line = &functions_[i]->lines[j];
EXPECT_EQ(address, line->address);
EXPECT_EQ(size, line->size);
EXPECT_EQ(filename, line->file->name.c_str());
@@ -672,7 +681,7 @@ TEST_F(SimpleCU, OneFuncHighPcIsLength) {
StartCU();
DefineFunction6(&root_handler_, "function1",
0x938cf8c07def4d34ULL, 0x55592d727f6cd01fLL, NULL,
- dwarf2reader::DW_FORM_udata);
+ google_breakpad::DW_FORM_udata);
root_handler_.Finish();
TestFunctionCount(1);
@@ -698,17 +707,17 @@ TEST_F(SimpleCU, IrrelevantRootChildren) {
StartCU();
EXPECT_FALSE(root_handler_
.FindChildHandler(0x7db32bff4e2dcfb1ULL,
- dwarf2reader::DW_TAG_lexical_block));
+ google_breakpad::DW_TAG_lexical_block));
}
TEST_F(SimpleCU, IrrelevantNamedScopeChildren) {
StartCU();
- DIEHandler *class_A_handler
- = StartNamedDIE(&root_handler_, dwarf2reader::DW_TAG_class_type, "class_A");
+ DIEHandler* class_A_handler
+ = StartNamedDIE(&root_handler_, google_breakpad::DW_TAG_class_type, "class_A");
EXPECT_TRUE(class_A_handler != NULL);
EXPECT_FALSE(class_A_handler
->FindChildHandler(0x02e55999b865e4e9ULL,
- dwarf2reader::DW_TAG_lexical_block));
+ google_breakpad::DW_TAG_lexical_block));
delete class_A_handler;
}
@@ -726,7 +735,7 @@ TEST_F(SimpleCU, InlineFunction) {
StartCU();
AbstractInstanceDIE(&root_handler_, 0x1e8dac5d507ed7abULL,
- dwarf2reader::DW_INL_inlined, 0, "inline-name");
+ google_breakpad::DW_INL_inlined, 0, "inline-name");
DefineInlineInstanceDIE(&root_handler_, "", 0x1e8dac5d507ed7abULL,
0x1758a0f941b71efbULL, 0x1cf154f1f545e146ULL);
root_handler_.Finish();
@@ -741,8 +750,8 @@ TEST_F(SimpleCU, InlineFunctionSignedAttribute) {
StartCU();
AbstractInstanceDIE(&root_handler_, 0x1e8dac5d507ed7abULL,
- dwarf2reader::DW_INL_inlined, 0, "inline-name",
- dwarf2reader::DW_FORM_sdata);
+ google_breakpad::DW_INL_inlined, 0, "inline-name",
+ google_breakpad::DW_FORM_sdata);
DefineInlineInstanceDIE(&root_handler_, "", 0x1e8dac5d507ed7abULL,
0x1758a0f941b71efbULL, 0x1cf154f1f545e146ULL);
root_handler_.Finish();
@@ -760,7 +769,7 @@ TEST_F(SimpleCU, AbstractOriginNotInlined) {
StartCU();
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,
0x2805c4531be6ca0eULL, 0x686b52155a8d4d2cULL);
root_handler_.Finish();
@@ -771,14 +780,11 @@ TEST_F(SimpleCU, AbstractOriginNotInlined) {
}
TEST_F(SimpleCU, UnknownAbstractOrigin) {
- EXPECT_CALL(reporter_, UnknownAbstractOrigin(_, 1ULL)).WillOnce(Return());
- EXPECT_CALL(reporter_, UnnamedFunction(0x11c70f94c6e87ccdLL))
- .WillOnce(Return());
PushLine(0x1758a0f941b71efbULL, 0x1cf154f1f545e146ULL, "line-file", 75173118);
StartCU();
AbstractInstanceDIE(&root_handler_, 0x1e8dac5d507ed7abULL,
- dwarf2reader::DW_INL_inlined, 0, "inline-name");
+ google_breakpad::DW_INL_inlined, 0, "inline-name");
DefineInlineInstanceDIE(&root_handler_, "", 1ULL,
0x1758a0f941b71efbULL, 0x1cf154f1f545e146ULL);
root_handler_.Finish();
@@ -789,8 +795,6 @@ TEST_F(SimpleCU, UnknownAbstractOrigin) {
}
TEST_F(SimpleCU, UnnamedFunction) {
- EXPECT_CALL(reporter_, UnnamedFunction(0xe34797c7e68590a8LL))
- .WillOnce(Return());
PushLine(0x72b80e41a0ac1d40ULL, 0x537174f231ee181cULL, "line-file", 14044850);
StartCU();
@@ -849,11 +853,11 @@ Situation situations[] = {
class FuncLinePairing: public CUFixtureBase,
public TestWithParam<Situation> { };
-INSTANTIATE_TEST_CASE_P(AllSituations, FuncLinePairing,
- ValuesIn(situations));
+INSTANTIATE_TEST_SUITE_P(AllSituations, FuncLinePairing,
+ ValuesIn(situations));
TEST_P(FuncLinePairing, Pairing) {
- const Situation &s = GetParam();
+ const Situation& s = GetParam();
PushLine(s.lines[0].start,
s.lines[0].end - s.lines[0].start,
"line-file", 67636963);
@@ -1035,21 +1039,21 @@ TEST_F(FuncLinePairing, WarnOnceLine) {
class CXXQualifiedNames: public CUFixtureBase,
public TestWithParam<DwarfTag> { };
-INSTANTIATE_TEST_CASE_P(VersusEnclosures, CXXQualifiedNames,
- Values(dwarf2reader::DW_TAG_class_type,
- dwarf2reader::DW_TAG_structure_type,
- dwarf2reader::DW_TAG_union_type,
- dwarf2reader::DW_TAG_namespace));
+INSTANTIATE_TEST_SUITE_P(VersusEnclosures, CXXQualifiedNames,
+ Values(google_breakpad::DW_TAG_class_type,
+ google_breakpad::DW_TAG_structure_type,
+ google_breakpad::DW_TAG_union_type,
+ google_breakpad::DW_TAG_namespace));
TEST_P(CXXQualifiedNames, TwoFunctions) {
DwarfTag tag = GetParam();
- SetLanguage(dwarf2reader::DW_LANG_C_plus_plus);
+ SetLanguage(google_breakpad::DW_LANG_C_plus_plus);
PushLine(10, 1, "filename1", 69819327);
PushLine(20, 1, "filename2", 95115701);
StartCU();
- DIEHandler *enclosure_handler = StartNamedDIE(&root_handler_, tag,
+ DIEHandler* enclosure_handler = StartNamedDIE(&root_handler_, tag,
"Enclosure");
EXPECT_TRUE(enclosure_handler != NULL);
DefineFunction(enclosure_handler, "func_B", 10, 1, NULL);
@@ -1066,15 +1070,15 @@ TEST_P(CXXQualifiedNames, TwoFunctions) {
TEST_P(CXXQualifiedNames, FuncInEnclosureInNamespace) {
DwarfTag tag = GetParam();
- SetLanguage(dwarf2reader::DW_LANG_C_plus_plus);
+ SetLanguage(google_breakpad::DW_LANG_C_plus_plus);
PushLine(10, 1, "line-file", 69819327);
StartCU();
- DIEHandler *namespace_handler
- = StartNamedDIE(&root_handler_, dwarf2reader::DW_TAG_namespace,
+ DIEHandler* namespace_handler
+ = StartNamedDIE(&root_handler_, google_breakpad::DW_TAG_namespace,
"Namespace");
EXPECT_TRUE(namespace_handler != NULL);
- DIEHandler *enclosure_handler = StartNamedDIE(namespace_handler, tag,
+ DIEHandler* enclosure_handler = StartNamedDIE(namespace_handler, tag,
"Enclosure");
EXPECT_TRUE(enclosure_handler != NULL);
DefineFunction(enclosure_handler, "function", 10, 1, NULL);
@@ -1089,20 +1093,20 @@ TEST_P(CXXQualifiedNames, FuncInEnclosureInNamespace) {
}
TEST_F(CXXQualifiedNames, FunctionInClassInStructInNamespace) {
- SetLanguage(dwarf2reader::DW_LANG_C_plus_plus);
+ SetLanguage(google_breakpad::DW_LANG_C_plus_plus);
PushLine(10, 1, "filename1", 69819327);
StartCU();
- DIEHandler *namespace_handler
- = StartNamedDIE(&root_handler_, dwarf2reader::DW_TAG_namespace,
+ DIEHandler* namespace_handler
+ = StartNamedDIE(&root_handler_, google_breakpad::DW_TAG_namespace,
"namespace_A");
EXPECT_TRUE(namespace_handler != NULL);
- DIEHandler *struct_handler
- = StartNamedDIE(namespace_handler, dwarf2reader::DW_TAG_structure_type,
+ DIEHandler* struct_handler
+ = StartNamedDIE(namespace_handler, google_breakpad::DW_TAG_structure_type,
"struct_B");
EXPECT_TRUE(struct_handler != NULL);
- DIEHandler *class_handler
- = StartNamedDIE(struct_handler, dwarf2reader::DW_TAG_class_type,
+ DIEHandler* class_handler
+ = StartNamedDIE(struct_handler, google_breakpad::DW_TAG_class_type,
"class_C");
DefineFunction(class_handler, "function_D", 10, 1, NULL);
class_handler->Finish();
@@ -1118,37 +1122,37 @@ TEST_F(CXXQualifiedNames, FunctionInClassInStructInNamespace) {
}
struct LanguageAndQualifiedName {
- dwarf2reader::DwarfLanguage language;
- const char *name;
+ google_breakpad::DwarfLanguage language;
+ const char* name;
};
const LanguageAndQualifiedName LanguageAndQualifiedNameCases[] = {
- { dwarf2reader::DW_LANG_none, "class_A::function_B" },
- { dwarf2reader::DW_LANG_C, "class_A::function_B" },
- { dwarf2reader::DW_LANG_C89, "class_A::function_B" },
- { dwarf2reader::DW_LANG_C99, "class_A::function_B" },
- { dwarf2reader::DW_LANG_C_plus_plus, "class_A::function_B" },
- { dwarf2reader::DW_LANG_Java, "class_A.function_B" },
- { dwarf2reader::DW_LANG_Cobol74, "class_A::function_B" },
- { dwarf2reader::DW_LANG_Mips_Assembler, NULL }
+ { google_breakpad::DW_LANG_none, "class_A::function_B" },
+ { google_breakpad::DW_LANG_C, "class_A::function_B" },
+ { google_breakpad::DW_LANG_C89, "class_A::function_B" },
+ { google_breakpad::DW_LANG_C99, "class_A::function_B" },
+ { google_breakpad::DW_LANG_C_plus_plus, "class_A::function_B" },
+ { google_breakpad::DW_LANG_Java, "class_A.function_B" },
+ { google_breakpad::DW_LANG_Cobol74, "class_A::function_B" },
+ { google_breakpad::DW_LANG_Mips_Assembler, NULL }
};
class QualifiedForLanguage
: public CUFixtureBase,
public TestWithParam<LanguageAndQualifiedName> { };
-INSTANTIATE_TEST_CASE_P(LanguageAndQualifiedName, QualifiedForLanguage,
- ValuesIn(LanguageAndQualifiedNameCases));
+INSTANTIATE_TEST_SUITE_P(LanguageAndQualifiedName, QualifiedForLanguage,
+ ValuesIn(LanguageAndQualifiedNameCases));
TEST_P(QualifiedForLanguage, MemberFunction) {
- const LanguageAndQualifiedName &param = GetParam();
+ const LanguageAndQualifiedName& param = GetParam();
PushLine(10, 1, "line-file", 212966758);
SetLanguage(param.language);
StartCU();
- DIEHandler *class_handler
- = StartNamedDIE(&root_handler_, dwarf2reader::DW_TAG_class_type,
+ DIEHandler* class_handler
+ = StartNamedDIE(&root_handler_, google_breakpad::DW_TAG_class_type,
"class_A");
DefineFunction(class_handler, "function_B", 10, 1, NULL);
class_handler->Finish();
@@ -1164,15 +1168,15 @@ TEST_P(QualifiedForLanguage, MemberFunction) {
}
TEST_P(QualifiedForLanguage, MemberFunctionSignedLanguage) {
- const LanguageAndQualifiedName &param = GetParam();
+ const LanguageAndQualifiedName& param = GetParam();
PushLine(10, 1, "line-file", 212966758);
SetLanguage(param.language);
SetLanguageSigned(true);
StartCU();
- DIEHandler *class_handler
- = StartNamedDIE(&root_handler_, dwarf2reader::DW_TAG_class_type,
+ DIEHandler* class_handler
+ = StartNamedDIE(&root_handler_, google_breakpad::DW_TAG_class_type,
"class_A");
DefineFunction(class_handler, "function_B", 10, 1, NULL);
class_handler->Finish();
@@ -1194,8 +1198,8 @@ TEST_F(Specifications, Function) {
StartCU();
DeclarationDIE(&root_handler_, 0xcd3c51b946fb1eeeLL,
- dwarf2reader::DW_TAG_subprogram, "declaration-name", "");
- DefinitionDIE(&root_handler_, dwarf2reader::DW_TAG_subprogram,
+ google_breakpad::DW_TAG_subprogram, "declaration-name", "");
+ DefinitionDIE(&root_handler_, google_breakpad::DW_TAG_subprogram,
0xcd3c51b946fb1eeeLL, "",
0x93cd3dfc1aa10097ULL, 0x0397d47a0b4ca0d4ULL);
root_handler_.Finish();
@@ -1211,9 +1215,9 @@ TEST_F(Specifications, MangledName) {
StartCU();
DeclarationDIE(&root_handler_, 0xcd3c51b946fb1eeeLL,
- dwarf2reader::DW_TAG_subprogram, "declaration-name",
+ google_breakpad::DW_TAG_subprogram, "declaration-name",
"_ZN1C1fEi");
- DefinitionDIE(&root_handler_, dwarf2reader::DW_TAG_subprogram,
+ DefinitionDIE(&root_handler_, google_breakpad::DW_TAG_subprogram,
0xcd3c51b946fb1eeeLL, "",
0x93cd3dfc1aa10097ULL, 0x0397d47a0b4ca0d4ULL);
root_handler_.Finish();
@@ -1225,14 +1229,14 @@ TEST_F(Specifications, MangledName) {
TEST_F(Specifications, MangledNameSwift) {
// Swift mangled names should pass through untouched.
- SetLanguage(dwarf2reader::DW_LANG_Swift);
+ SetLanguage(google_breakpad::DW_LANG_Swift);
PushLine(0x93cd3dfc1aa10097ULL, 0x0397d47a0b4ca0d4ULL, "line-file", 54883661);
StartCU();
const string kName = "_TFC9swifttest5Shape17simpleDescriptionfS0_FT_Si";
DeclarationDIE(&root_handler_, 0xcd3c51b946fb1eeeLL,
- dwarf2reader::DW_TAG_subprogram, "declaration-name",
+ google_breakpad::DW_TAG_subprogram, "declaration-name",
kName);
- DefinitionDIE(&root_handler_, dwarf2reader::DW_TAG_subprogram,
+ DefinitionDIE(&root_handler_, google_breakpad::DW_TAG_subprogram,
0xcd3c51b946fb1eeeLL, "",
0x93cd3dfc1aa10097ULL, 0x0397d47a0b4ca0d4ULL);
root_handler_.Finish();
@@ -1243,27 +1247,27 @@ TEST_F(Specifications, MangledNameSwift) {
}
TEST_F(Specifications, MangledNameRust) {
- SetLanguage(dwarf2reader::DW_LANG_Rust);
+ SetLanguage(google_breakpad::DW_LANG_Rust);
PushLine(0x93cd3dfc1aa10097ULL, 0x0397d47a0b4ca0d4ULL, "line-file", 54883661);
StartCU();
const string kName = "_ZN14rustc_demangle8demangle17h373defa94bffacdeE";
DeclarationDIE(&root_handler_, 0xcd3c51b946fb1eeeLL,
- dwarf2reader::DW_TAG_subprogram, "declaration-name",
+ google_breakpad::DW_TAG_subprogram, "declaration-name",
kName);
- DefinitionDIE(&root_handler_, dwarf2reader::DW_TAG_subprogram,
+ DefinitionDIE(&root_handler_, google_breakpad::DW_TAG_subprogram,
0xcd3c51b946fb1eeeLL, "",
0x93cd3dfc1aa10097ULL, 0x0397d47a0b4ca0d4ULL);
root_handler_.Finish();
TestFunctionCount(1);
TestFunction(0,
-#ifndef HAVE_RUST_DEMANGLE
+#ifndef HAVE_RUSTC_DEMANGLE
// Rust mangled names should pass through untouched if not
- // using rust-demangle.
+ // using rustc-demangle.
kName,
#else
- // If rust-demangle is available this should be properly
+ // If rustc-demangle is available this should be properly
// demangled.
"rustc_demangle::demangle",
#endif
@@ -1274,13 +1278,13 @@ TEST_F(Specifications, MemberFunction) {
PushLine(0x3341a248634e7170ULL, 0x5f6938ee5553b953ULL, "line-file", 18116691);
StartCU();
- DIEHandler *class_handler
- = StartNamedDIE(&root_handler_, dwarf2reader::DW_TAG_class_type, "class_A");
+ DIEHandler* class_handler
+ = StartNamedDIE(&root_handler_, google_breakpad::DW_TAG_class_type, "class_A");
DeclarationDIE(class_handler, 0x7d83028c431406e8ULL,
- dwarf2reader::DW_TAG_subprogram, "declaration-name", "");
+ google_breakpad::DW_TAG_subprogram, "declaration-name", "");
class_handler->Finish();
delete class_handler;
- DefinitionDIE(&root_handler_, dwarf2reader::DW_TAG_subprogram,
+ DefinitionDIE(&root_handler_, google_breakpad::DW_TAG_subprogram,
0x7d83028c431406e8ULL, "",
0x3341a248634e7170ULL, 0x5f6938ee5553b953ULL);
root_handler_.Finish();
@@ -1297,17 +1301,17 @@ TEST_F(Specifications, FunctionDeclarationParent) {
StartCU();
{
- DIEHandler *class_handler
- = StartNamedDIE(&root_handler_, dwarf2reader::DW_TAG_class_type,
+ DIEHandler* class_handler
+ = StartNamedDIE(&root_handler_, google_breakpad::DW_TAG_class_type,
"class_A");
ASSERT_TRUE(class_handler != NULL);
DeclarationDIE(class_handler, 0x0e0e877c8404544aULL,
- dwarf2reader::DW_TAG_subprogram, "declaration-name", "");
+ google_breakpad::DW_TAG_subprogram, "declaration-name", "");
class_handler->Finish();
delete class_handler;
}
- DefinitionDIE(&root_handler_, dwarf2reader::DW_TAG_subprogram,
+ DefinitionDIE(&root_handler_, google_breakpad::DW_TAG_subprogram,
0x0e0e877c8404544aULL, "definition-name",
0x463c9ddf405be227ULL, 0x6a47774af5049680ULL);
@@ -1325,20 +1329,20 @@ TEST_F(Specifications, NamedScopeDeclarationParent) {
StartCU();
{
- DIEHandler *space_handler
- = StartNamedDIE(&root_handler_, dwarf2reader::DW_TAG_namespace,
+ DIEHandler* space_handler
+ = StartNamedDIE(&root_handler_, google_breakpad::DW_TAG_namespace,
"space_A");
ASSERT_TRUE(space_handler != NULL);
DeclarationDIE(space_handler, 0x419bb1d12f9a73a2ULL,
- dwarf2reader::DW_TAG_class_type, "class-declaration-name",
+ google_breakpad::DW_TAG_class_type, "class-declaration-name",
"");
space_handler->Finish();
delete space_handler;
}
{
- DIEHandler *class_handler
- = StartSpecifiedDIE(&root_handler_, dwarf2reader::DW_TAG_class_type,
+ DIEHandler* class_handler
+ = StartSpecifiedDIE(&root_handler_, google_breakpad::DW_TAG_class_type,
0x419bb1d12f9a73a2ULL, "class-definition-name");
ASSERT_TRUE(class_handler != NULL);
DefineFunction(class_handler, "function",
@@ -1360,9 +1364,9 @@ TEST_F(Specifications, InlineFunction) {
StartCU();
DeclarationDIE(&root_handler_, 0xcd3c51b946fb1eeeLL,
- dwarf2reader::DW_TAG_subprogram, "inline-name", "");
+ google_breakpad::DW_TAG_subprogram, "inline-name", "");
AbstractInstanceDIE(&root_handler_, 0x1e8dac5d507ed7abULL,
- dwarf2reader::DW_INL_inlined, 0xcd3c51b946fb1eeeLL, "");
+ google_breakpad::DW_INL_inlined, 0xcd3c51b946fb1eeeLL, "");
DefineInlineInstanceDIE(&root_handler_, "", 0x1e8dac5d507ed7abULL,
0x1758a0f941b71efbULL, 0x1cf154f1f545e146ULL);
root_handler_.Finish();
@@ -1379,11 +1383,11 @@ TEST_F(Specifications, InlineFunctionInNamespace) {
StartCU();
DIEHandler* space_handler
- = StartNamedDIE(&root_handler_, dwarf2reader::DW_TAG_namespace,
+ = StartNamedDIE(&root_handler_, google_breakpad::DW_TAG_namespace,
"Namespace");
ASSERT_TRUE(space_handler != NULL);
AbstractInstanceDIE(space_handler, 0x1e8dac5d507ed7abULL,
- dwarf2reader::DW_INL_inlined, 0LL, "func-name");
+ google_breakpad::DW_INL_inlined, 0LL, "func-name");
DefineInlineInstanceDIE(space_handler, "", 0x1e8dac5d507ed7abULL,
0x1758a0f941b71efbULL, 0x1cf154f1f545e146ULL);
space_handler->Finish();
@@ -1400,7 +1404,7 @@ TEST_F(Specifications, InlineFunctionInNamespace) {
// - direct and definition
TEST_F(Specifications, LongChain) {
PushLine(0x5a0dd6bb85db754cULL, 0x3bccb213d08c7fd3ULL, "line-file", 21192926);
- SetLanguage(dwarf2reader::DW_LANG_C_plus_plus);
+ SetLanguage(google_breakpad::DW_LANG_C_plus_plus);
StartCU();
// The structure we're building here is:
@@ -1429,24 +1433,24 @@ TEST_F(Specifications, LongChain) {
// space_A::space_B::struct_C::struct_D::union_E::union_F::
// class_G::class_H::func_I
{
- DIEHandler *space_A_handler
- = StartNamedDIE(&root_handler_, dwarf2reader::DW_TAG_namespace,
+ DIEHandler* space_A_handler
+ = StartNamedDIE(&root_handler_, google_breakpad::DW_TAG_namespace,
"space_A");
DeclarationDIE(space_A_handler, 0x2e111126496596e2ULL,
- dwarf2reader::DW_TAG_namespace, "space_B", "");
+ google_breakpad::DW_TAG_namespace, "space_B", "");
space_A_handler->Finish();
delete space_A_handler;
}
{
- DIEHandler *space_B_handler
- = StartSpecifiedDIE(&root_handler_, dwarf2reader::DW_TAG_namespace,
+ DIEHandler* space_B_handler
+ = StartSpecifiedDIE(&root_handler_, google_breakpad::DW_TAG_namespace,
0x2e111126496596e2ULL);
- DIEHandler *struct_C_handler
- = StartNamedDIE(space_B_handler, dwarf2reader::DW_TAG_structure_type,
+ DIEHandler* struct_C_handler
+ = StartNamedDIE(space_B_handler, google_breakpad::DW_TAG_structure_type,
"struct_C");
DeclarationDIE(struct_C_handler, 0x20cd423bf2a25a4cULL,
- dwarf2reader::DW_TAG_structure_type, "struct_D", "");
+ google_breakpad::DW_TAG_structure_type, "struct_D", "");
struct_C_handler->Finish();
delete struct_C_handler;
space_B_handler->Finish();
@@ -1454,14 +1458,14 @@ TEST_F(Specifications, LongChain) {
}
{
- DIEHandler *struct_D_handler
- = StartSpecifiedDIE(&root_handler_, dwarf2reader::DW_TAG_structure_type,
+ DIEHandler* struct_D_handler
+ = StartSpecifiedDIE(&root_handler_, google_breakpad::DW_TAG_structure_type,
0x20cd423bf2a25a4cULL);
- DIEHandler *union_E_handler
- = StartNamedDIE(struct_D_handler, dwarf2reader::DW_TAG_union_type,
+ DIEHandler* union_E_handler
+ = StartNamedDIE(struct_D_handler, google_breakpad::DW_TAG_union_type,
"union_E");
DeclarationDIE(union_E_handler, 0xe25c84805aa58c32ULL,
- dwarf2reader::DW_TAG_union_type, "union_F", "");
+ google_breakpad::DW_TAG_union_type, "union_F", "");
union_E_handler->Finish();
delete union_E_handler;
struct_D_handler->Finish();
@@ -1469,14 +1473,14 @@ TEST_F(Specifications, LongChain) {
}
{
- DIEHandler *union_F_handler
- = StartSpecifiedDIE(&root_handler_, dwarf2reader::DW_TAG_union_type,
+ DIEHandler* union_F_handler
+ = StartSpecifiedDIE(&root_handler_, google_breakpad::DW_TAG_union_type,
0xe25c84805aa58c32ULL);
- DIEHandler *class_G_handler
- = StartNamedDIE(union_F_handler, dwarf2reader::DW_TAG_class_type,
+ DIEHandler* class_G_handler
+ = StartNamedDIE(union_F_handler, google_breakpad::DW_TAG_class_type,
"class_G");
DeclarationDIE(class_G_handler, 0xb70d960dcc173b6eULL,
- dwarf2reader::DW_TAG_class_type, "class_H", "");
+ google_breakpad::DW_TAG_class_type, "class_H", "");
class_G_handler->Finish();
delete class_G_handler;
union_F_handler->Finish();
@@ -1484,16 +1488,16 @@ TEST_F(Specifications, LongChain) {
}
{
- DIEHandler *class_H_handler
- = StartSpecifiedDIE(&root_handler_, dwarf2reader::DW_TAG_class_type,
+ DIEHandler* class_H_handler
+ = StartSpecifiedDIE(&root_handler_, google_breakpad::DW_TAG_class_type,
0xb70d960dcc173b6eULL);
DeclarationDIE(class_H_handler, 0x27ff829e3bf69f37ULL,
- dwarf2reader::DW_TAG_subprogram, "func_I", "");
+ google_breakpad::DW_TAG_subprogram, "func_I", "");
class_H_handler->Finish();
delete class_H_handler;
}
- DefinitionDIE(&root_handler_, dwarf2reader::DW_TAG_subprogram,
+ DefinitionDIE(&root_handler_, google_breakpad::DW_TAG_subprogram,
0x27ff829e3bf69f37ULL, "",
0x5a0dd6bb85db754cULL, 0x3bccb213d08c7fd3ULL);
root_handler_.Finish();
@@ -1509,7 +1513,7 @@ TEST_F(Specifications, InterCU) {
DwarfCUToModule::FileContext fc("dwarf-filename", &m, true);
EXPECT_CALL(reporter_, UncoveredFunction(_)).WillOnce(Return());
MockLineToModuleHandler lr;
- EXPECT_CALL(lr, ReadProgram(_,_,_,_)).Times(0);
+ EXPECT_CALL(lr, ReadProgram(_,_,_,_,_,_,_,_,_)).Times(0);
// Kludge: satisfy reporter_'s expectation.
reporter_.SetCUName("compilation-unit-name");
@@ -1519,11 +1523,11 @@ TEST_F(Specifications, InterCU) {
DwarfCUToModule root1_handler(&fc, &lr, nullptr, &reporter_);
ASSERT_TRUE(root1_handler.StartCompilationUnit(0, 1, 2, 3, 3));
ASSERT_TRUE(root1_handler.StartRootDIE(1,
- dwarf2reader::DW_TAG_compile_unit));
+ google_breakpad::DW_TAG_compile_unit));
ProcessStrangeAttributes(&root1_handler);
ASSERT_TRUE(root1_handler.EndAttributes());
DeclarationDIE(&root1_handler, 0xb8fbfdd5f0b26fceULL,
- dwarf2reader::DW_TAG_class_type, "class_A", "");
+ google_breakpad::DW_TAG_class_type, "class_A", "");
root1_handler.Finish();
}
@@ -1532,13 +1536,13 @@ TEST_F(Specifications, InterCU) {
DwarfCUToModule root2_handler(&fc, &lr, nullptr, &reporter_);
ASSERT_TRUE(root2_handler.StartCompilationUnit(0, 1, 2, 3, 3));
ASSERT_TRUE(root2_handler.StartRootDIE(1,
- dwarf2reader::DW_TAG_compile_unit));
+ google_breakpad::DW_TAG_compile_unit));
ASSERT_TRUE(root2_handler.EndAttributes());
- DIEHandler *class_A_handler
- = StartSpecifiedDIE(&root2_handler, dwarf2reader::DW_TAG_class_type,
+ DIEHandler* class_A_handler
+ = StartSpecifiedDIE(&root2_handler, google_breakpad::DW_TAG_class_type,
0xb8fbfdd5f0b26fceULL);
DeclarationDIE(class_A_handler, 0xb01fef8b380bd1a2ULL,
- dwarf2reader::DW_TAG_subprogram, "member_func_B", "");
+ google_breakpad::DW_TAG_subprogram, "member_func_B", "");
class_A_handler->Finish();
delete class_A_handler;
root2_handler.Finish();
@@ -1549,18 +1553,18 @@ TEST_F(Specifications, InterCU) {
DwarfCUToModule root3_handler(&fc, &lr, nullptr, &reporter_);
ASSERT_TRUE(root3_handler.StartCompilationUnit(0, 1, 2, 3, 3));
ASSERT_TRUE(root3_handler.StartRootDIE(1,
- dwarf2reader::DW_TAG_compile_unit));
+ google_breakpad::DW_TAG_compile_unit));
ASSERT_TRUE(root3_handler.EndAttributes());
- DefinitionDIE(&root3_handler, dwarf2reader::DW_TAG_subprogram,
+ DefinitionDIE(&root3_handler, google_breakpad::DW_TAG_subprogram,
0xb01fef8b380bd1a2ULL, "",
0x2618f00a1a711e53ULL, 0x4fd94b76d7c2caf5ULL);
root3_handler.Finish();
}
- vector<Module::Function *> functions;
+ vector<Module::Function*> functions;
m.GetFunctions(&functions, functions.end());
EXPECT_EQ(1U, functions.size());
- EXPECT_STREQ("class_A::member_func_B", functions[0]->name.c_str());
+ EXPECT_STREQ("class_A::member_func_B", functions[0]->name.str().c_str());
}
TEST_F(Specifications, UnhandledInterCU) {
@@ -1568,7 +1572,7 @@ TEST_F(Specifications, UnhandledInterCU) {
DwarfCUToModule::FileContext fc("dwarf-filename", &m, false);
EXPECT_CALL(reporter_, UncoveredFunction(_)).WillOnce(Return());
MockLineToModuleHandler lr;
- EXPECT_CALL(lr, ReadProgram(_,_,_,_)).Times(0);
+ EXPECT_CALL(lr, ReadProgram(_,_,_,_,_,_,_,_,_)).Times(0);
// Kludge: satisfy reporter_'s expectation.
reporter_.SetCUName("compilation-unit-name");
@@ -1578,11 +1582,11 @@ TEST_F(Specifications, UnhandledInterCU) {
DwarfCUToModule root1_handler(&fc, &lr, nullptr, &reporter_);
ASSERT_TRUE(root1_handler.StartCompilationUnit(0, 1, 2, 3, 3));
ASSERT_TRUE(root1_handler.StartRootDIE(1,
- dwarf2reader::DW_TAG_compile_unit));
+ google_breakpad::DW_TAG_compile_unit));
ProcessStrangeAttributes(&root1_handler);
ASSERT_TRUE(root1_handler.EndAttributes());
DeclarationDIE(&root1_handler, 0xb8fbfdd5f0b26fceULL,
- dwarf2reader::DW_TAG_class_type, "class_A", "");
+ google_breakpad::DW_TAG_class_type, "class_A", "");
root1_handler.Finish();
}
@@ -1591,14 +1595,14 @@ TEST_F(Specifications, UnhandledInterCU) {
DwarfCUToModule root2_handler(&fc, &lr, nullptr, &reporter_);
ASSERT_TRUE(root2_handler.StartCompilationUnit(0, 1, 2, 3, 3));
ASSERT_TRUE(root2_handler.StartRootDIE(1,
- dwarf2reader::DW_TAG_compile_unit));
+ google_breakpad::DW_TAG_compile_unit));
ASSERT_TRUE(root2_handler.EndAttributes());
EXPECT_CALL(reporter_, UnhandledInterCUReference(_, _)).Times(1);
- DIEHandler *class_A_handler
- = StartSpecifiedDIE(&root2_handler, dwarf2reader::DW_TAG_class_type,
+ DIEHandler* class_A_handler
+ = StartSpecifiedDIE(&root2_handler, google_breakpad::DW_TAG_class_type,
0xb8fbfdd5f0b26fceULL);
DeclarationDIE(class_A_handler, 0xb01fef8b380bd1a2ULL,
- dwarf2reader::DW_TAG_subprogram, "member_func_B", "");
+ google_breakpad::DW_TAG_subprogram, "member_func_B", "");
class_A_handler->Finish();
delete class_A_handler;
root2_handler.Finish();
@@ -1609,11 +1613,10 @@ TEST_F(Specifications, UnhandledInterCU) {
DwarfCUToModule root3_handler(&fc, &lr, nullptr, &reporter_);
ASSERT_TRUE(root3_handler.StartCompilationUnit(0, 1, 2, 3, 3));
ASSERT_TRUE(root3_handler.StartRootDIE(1,
- dwarf2reader::DW_TAG_compile_unit));
+ google_breakpad::DW_TAG_compile_unit));
ASSERT_TRUE(root3_handler.EndAttributes());
EXPECT_CALL(reporter_, UnhandledInterCUReference(_, _)).Times(1);
- EXPECT_CALL(reporter_, UnnamedFunction(_)).Times(1);
- DefinitionDIE(&root3_handler, dwarf2reader::DW_TAG_subprogram,
+ DefinitionDIE(&root3_handler, google_breakpad::DW_TAG_subprogram,
0xb01fef8b380bd1a2ULL, "",
0x2618f00a1a711e53ULL, 0x4fd94b76d7c2caf5ULL);
root3_handler.Finish();
@@ -1622,13 +1625,11 @@ TEST_F(Specifications, UnhandledInterCU) {
TEST_F(Specifications, BadOffset) {
PushLine(0xa0277efd7ce83771ULL, 0x149554a184c730c1ULL, "line-file", 56636272);
- EXPECT_CALL(reporter_, UnknownSpecification(_, 0x2be953efa6f9a996ULL))
- .WillOnce(Return());
StartCU();
DeclarationDIE(&root_handler_, 0xefd7f7752c27b7e4ULL,
- dwarf2reader::DW_TAG_subprogram, "", "");
- DefinitionDIE(&root_handler_, dwarf2reader::DW_TAG_subprogram,
+ google_breakpad::DW_TAG_subprogram, "", "");
+ DefinitionDIE(&root_handler_, google_breakpad::DW_TAG_subprogram,
0x2be953efa6f9a996ULL, "function",
0xa0277efd7ce83771ULL, 0x149554a184c730c1ULL);
root_handler_.Finish();
@@ -1639,8 +1640,8 @@ TEST_F(Specifications, FunctionDefinitionHasOwnName) {
StartCU();
DeclarationDIE(&root_handler_, 0xc34ff4786cae78bdULL,
- dwarf2reader::DW_TAG_subprogram, "declaration-name", "");
- DefinitionDIE(&root_handler_, dwarf2reader::DW_TAG_subprogram,
+ google_breakpad::DW_TAG_subprogram, "declaration-name", "");
+ DefinitionDIE(&root_handler_, google_breakpad::DW_TAG_subprogram,
0xc34ff4786cae78bdULL, "definition-name",
0xced50b3eea81022cULL, 0x08dd4d301cc7a7d2ULL);
root_handler_.Finish();
@@ -1655,19 +1656,19 @@ TEST_F(Specifications, ClassDefinitionHasOwnName) {
StartCU();
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
- = StartSpecifiedDIE(&root_handler_, dwarf2reader::DW_TAG_class_type,
+ google_breakpad::DIEHandler* class_definition
+ = StartSpecifiedDIE(&root_handler_, google_breakpad::DW_TAG_class_type,
0xd0fe467ec2f1a58cULL, "class-definition-name");
ASSERT_TRUE(class_definition);
DeclarationDIE(class_definition, 0x6d028229c15623dbULL,
- dwarf2reader::DW_TAG_subprogram,
+ google_breakpad::DW_TAG_subprogram,
"function-declaration-name", "");
class_definition->Finish();
delete class_definition;
- DefinitionDIE(&root_handler_, dwarf2reader::DW_TAG_subprogram,
+ DefinitionDIE(&root_handler_, google_breakpad::DW_TAG_subprogram,
0x6d028229c15623dbULL, "function-definition-name",
0x1d0f5e0f6ce309bdULL, 0x654e1852ec3599e7ULL);
@@ -1688,20 +1689,20 @@ TEST_F(Specifications, PreferSpecificationParents) {
StartCU();
{
- dwarf2reader::DIEHandler *declaration_class_handler =
- StartNamedDIE(&root_handler_, dwarf2reader::DW_TAG_class_type,
+ google_breakpad::DIEHandler* declaration_class_handler =
+ StartNamedDIE(&root_handler_, google_breakpad::DW_TAG_class_type,
"declaration-class");
DeclarationDIE(declaration_class_handler, 0x9ddb35517455ef7aULL,
- dwarf2reader::DW_TAG_subprogram, "function-declaration",
+ google_breakpad::DW_TAG_subprogram, "function-declaration",
"");
declaration_class_handler->Finish();
delete declaration_class_handler;
}
{
- dwarf2reader::DIEHandler *definition_class_handler
- = StartNamedDIE(&root_handler_, dwarf2reader::DW_TAG_class_type,
+ google_breakpad::DIEHandler* definition_class_handler
+ = StartNamedDIE(&root_handler_, google_breakpad::DW_TAG_class_type,
"definition-class");
- DefinitionDIE(definition_class_handler, dwarf2reader::DW_TAG_subprogram,
+ DefinitionDIE(definition_class_handler, google_breakpad::DW_TAG_subprogram,
0x9ddb35517455ef7aULL, "function-definition",
0xbbd9d54dce3b95b7ULL, 0x39188b7b52b0899fULL);
definition_class_handler->Finish();
@@ -1723,12 +1724,12 @@ TEST_F(CUErrors, BadStmtList) {
.StartCompilationUnit(0xc591d5b037543d7cULL, 0x11, 0xcd,
0x2d7d19546cf6590cULL, 3));
ASSERT_TRUE(root_handler_.StartRootDIE(0xae789dc102cfca54ULL,
- dwarf2reader::DW_TAG_compile_unit));
- root_handler_.ProcessAttributeString(dwarf2reader::DW_AT_name,
- dwarf2reader::DW_FORM_strp,
+ google_breakpad::DW_TAG_compile_unit));
+ root_handler_.ProcessAttributeString(google_breakpad::DW_AT_name,
+ google_breakpad::DW_FORM_strp,
"compilation-unit-name");
- root_handler_.ProcessAttributeUnsigned(dwarf2reader::DW_AT_stmt_list,
- dwarf2reader::DW_FORM_ref4,
+ root_handler_.ProcessAttributeUnsigned(google_breakpad::DW_AT_stmt_list,
+ google_breakpad::DW_FORM_ref4,
dummy_line_size_ + 10);
root_handler_.EndAttributes();
root_handler_.Finish();
@@ -1780,7 +1781,7 @@ TEST_F(CUErrors, BadCURootDIETag) {
0xc9de224ccb99ac3eULL, 3));
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