From 0dd6c95b3fcf0bef0a473901e47eb4c23fb30f5b Mon Sep 17 00:00:00 2001 From: "thestig@chromium.org" Date: Tue, 13 Jul 2010 18:14:27 +0000 Subject: Remove duplicate FUNC entries from dump_syms output. Review URL: http://breakpad.appspot.com/128001 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@623 4c0a9323-5329-0410-9bdc-e9ce6186880e --- src/common/stabs_to_module_unittest.cc | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) (limited to 'src/common/stabs_to_module_unittest.cc') diff --git a/src/common/stabs_to_module_unittest.cc b/src/common/stabs_to_module_unittest.cc index 4248b3c0..2c432a3e 100644 --- a/src/common/stabs_to_module_unittest.cc +++ b/src/common/stabs_to_module_unittest.cc @@ -74,6 +74,38 @@ TEST(StabsToModule, SimpleCU) { EXPECT_EQ(174823314, line->number); } +TEST(StabsToModule, DuplicateFunctionNames) { + Module m("name", "os", "arch", "id"); + StabsToModule h(&m); + + // Compilation unit with one function, mangled name. + EXPECT_TRUE(h.StartCompilationUnit("compilation-unit", 0xf2cfda36ecf7f46cLL, + "build-directory")); + EXPECT_TRUE(h.StartFunction("funcfoo", + 0xf2cfda36ecf7f46dLL)); + EXPECT_TRUE(h.EndFunction(0)); + EXPECT_TRUE(h.StartFunction("funcfoo", + 0xf2cfda36ecf7f46dLL)); + EXPECT_TRUE(h.EndFunction(0)); + EXPECT_TRUE(h.EndCompilationUnit(0)); + + h.Finalize(); + + // Now check to see what has been added to the Module. + Module::File *file = m.FindExistingFile("compilation-unit"); + ASSERT_TRUE(file != NULL); + + vector functions; + m.GetFunctions(&functions, functions.end()); + ASSERT_EQ(1U, functions.size()); + + Module::Function *function = functions[0]; + EXPECT_EQ(0xf2cfda36ecf7f46dLL, function->address); + EXPECT_LT(0U, function->size); // should have used dummy size + EXPECT_EQ(0U, function->parameter_size); + ASSERT_EQ(0U, function->lines.size()); +} + TEST(InferSizes, LineSize) { Module m("name", "os", "arch", "id"); StabsToModule h(&m); @@ -88,7 +120,7 @@ TEST(InferSizes, LineSize) { EXPECT_TRUE(h.EndFunction(0)); // unknown function end address EXPECT_TRUE(h.EndCompilationUnit(0)); // unknown CU end address EXPECT_TRUE(h.StartCompilationUnit("compilation-unit-2", 0xb4523963eff94e92LL, - "build-directory-2")); // next boundary + "build-directory-2")); // next boundary EXPECT_TRUE(h.EndCompilationUnit(0)); h.Finalize(); -- cgit v1.2.1