From 81aadb99a6acf7f1175e8c6f538a609c96b3a961 Mon Sep 17 00:00:00 2001 From: jimblandy Date: Tue, 2 Mar 2010 19:39:18 +0000 Subject: 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 --- src/common/linux/dump_stabs_unittest.cc | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/common/linux/dump_stabs_unittest.cc') 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. -- cgit v1.2.1