aboutsummaryrefslogtreecommitdiff
path: root/src/common/linux/dump_stabs_unittest.cc
diff options
context:
space:
mode:
authorjimblandy <jimblandy@4c0a9323-5329-0410-9bdc-e9ce6186880e>2010-03-02 19:39:18 +0000
committerjimblandy <jimblandy@4c0a9323-5329-0410-9bdc-e9ce6186880e>2010-03-02 19:39:18 +0000
commit81aadb99a6acf7f1175e8c6f538a609c96b3a961 (patch)
tree8c3074646f1aec6c144ffbfaad2ba8a8550d0bb9 /src/common/linux/dump_stabs_unittest.cc
parentARM support, with some build system changes to support x86-64, arm, and i386 ... (diff)
downloadbreakpad-81aadb99a6acf7f1175e8c6f538a609c96b3a961.tar.xz
Breakpad Linux dumper: Tolerate STABS data from code linked with --gc-sections.
Programs compiled with -ffunction-sections -Wl,--gc-sections may have SO entries for the start of the compilation unit whose addresses are zero, even when the compilation unit contains non-omitted functions at non-zero addresses. The breakpad dumper should not assume that the compilation unit starting address is always non-zero. a=jimblandy, r=nealsid git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@542 4c0a9323-5329-0410-9bdc-e9ce6186880e
Diffstat (limited to 'src/common/linux/dump_stabs_unittest.cc')
-rw-r--r--src/common/linux/dump_stabs_unittest.cc16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/common/linux/dump_stabs_unittest.cc b/src/common/linux/dump_stabs_unittest.cc
index f135d9bd..382c4f5f 100644
--- a/src/common/linux/dump_stabs_unittest.cc
+++ b/src/common/linux/dump_stabs_unittest.cc
@@ -157,6 +157,22 @@ TEST(FunctionNames, Mangled) {
ASSERT_EQ(0U, function->lines.size());
}
+// The GNU toolchain can omit functions that are not used; however,
+// when it does so, it doesn't clean up the debugging information that
+// refers to them. In STABS, this results in compilation units whose
+// SO addresses are zero.
+TEST(Omitted, Function) {
+ Module m("name", "os", "arch", "id");
+ DumpStabsHandler h(&m);
+
+ // The StartCompilationUnit and EndCompilationUnit calls may both have an
+ // address of zero if the compilation unit has had sections removed.
+ EXPECT_TRUE(h.StartCompilationUnit("compilation-unit", 0, "build-directory"));
+ EXPECT_TRUE(h.StartFunction("function", 0x2a133596));
+ EXPECT_TRUE(h.EndFunction(0));
+ EXPECT_TRUE(h.EndCompilationUnit(0));
+}
+
// TODO --- if we actually cared about STABS. Even without these we've
// got full coverage of non-failure source lines in dump_stabs.cc.