aboutsummaryrefslogtreecommitdiff
path: root/src/common/dwarf_cu_to_module_unittest.cc
diff options
context:
space:
mode:
authorjimblandy <jimblandy@4c0a9323-5329-0410-9bdc-e9ce6186880e>2011-03-11 22:16:12 +0000
committerjimblandy <jimblandy@4c0a9323-5329-0410-9bdc-e9ce6186880e>2011-03-11 22:16:12 +0000
commitfd18beeb5c817aa3ecdb21caceee8e6ce08c6ab3 (patch)
tree5997c04fe096f9b15bbe388af5c7fdd2c466cdc9 /src/common/dwarf_cu_to_module_unittest.cc
parentPut PUBLIC lines in Mac symbol files. (diff)
downloadbreakpad-fd18beeb5c817aa3ecdb21caceee8e6ce08c6ab3.tar.xz
Google Breakpad Issue 417: Handle DWARF that omits function names.
This patch makes sure dump_syms behaves properly when presented with malformed DWARF data that provides no name for a function. We print a warning message to stderr, and subsitute "<name omitted>" for the empty string, so that the "FUNC" record written to the symbol file for the function is still well-formed. (We may have line number data covering the function, so it would be a shame to omit the function altogether.) Unit tests included. a=jimblandy, r=ted.mielczarek git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@779 4c0a9323-5329-0410-9bdc-e9ce6186880e
Diffstat (limited to 'src/common/dwarf_cu_to_module_unittest.cc')
-rw-r--r--src/common/dwarf_cu_to_module_unittest.cc25
1 files changed, 24 insertions, 1 deletions
diff --git a/src/common/dwarf_cu_to_module_unittest.cc b/src/common/dwarf_cu_to_module_unittest.cc
index f0a478dd..2930ff5a 100644
--- a/src/common/dwarf_cu_to_module_unittest.cc
+++ b/src/common/dwarf_cu_to_module_unittest.cc
@@ -80,6 +80,7 @@ class MockWarningReporter: public DwarfCUToModule::WarningReporter {
MOCK_METHOD1(BadLineInfoOffset, void(uint64 offset));
MOCK_METHOD1(UncoveredFunction, void(const Module::Function &function));
MOCK_METHOD1(UncoveredLine, void(const Module::Line &line));
+ MOCK_METHOD1(UnnamedFunction, void(uint64 offset));
};
// A fixture class including all the objects needed to handle a
@@ -135,6 +136,7 @@ class CUFixtureBase {
EXPECT_CALL(reporter_, BadLineInfoOffset(_)).Times(0);
EXPECT_CALL(reporter_, UncoveredFunction(_)).Times(0);
EXPECT_CALL(reporter_, UncoveredLine(_)).Times(0);
+ EXPECT_CALL(reporter_, UnnamedFunction(_)).Times(0);
// By default, expect the line program reader not to be invoked. We
// may override this in StartCU.
@@ -776,6 +778,8 @@ 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();
@@ -786,10 +790,25 @@ TEST_F(SimpleCU, UnknownAbstractOrigin) {
root_handler_.Finish();
TestFunctionCount(1);
- TestFunction(0, "",
+ TestFunction(0, "<name omitted>",
0x1758a0f941b71efbULL, 0x1cf154f1f545e146ULL);
}
+TEST_F(SimpleCU, UnnamedFunction) {
+ EXPECT_CALL(reporter_, UnnamedFunction(0xe34797c7e68590a8LL))
+ .WillOnce(Return());
+ PushLine(0x72b80e41a0ac1d40ULL, 0x537174f231ee181cULL, "line-file", 14044850);
+
+ StartCU();
+ DefineFunction(&root_handler_, "",
+ 0x72b80e41a0ac1d40ULL, 0x537174f231ee181cULL);
+ root_handler_.Finish();
+
+ TestFunctionCount(1);
+ TestFunction(0, "<name omitted>",
+ 0x72b80e41a0ac1d40ULL, 0x537174f231ee181cULL);
+}
+
// An address range.
struct Range {
Module::Address start, end;
@@ -1697,5 +1716,9 @@ TEST_F(Reporter, UncoveredLineEnabled) {
EXPECT_TRUE(reporter.uncovered_warnings_enabled());
}
+TEST_F(Reporter, UnnamedFunction) {
+ reporter.UnnamedFunction(0x90c0baff9dedb2d9ULL);
+}
+
// Would be nice to also test:
// - overlapping lines, functions