diff options
author | ted.mielczarek <ted.mielczarek@4c0a9323-5329-0410-9bdc-e9ce6186880e> | 2011-03-04 16:08:39 +0000 |
---|---|---|
committer | ted.mielczarek <ted.mielczarek@4c0a9323-5329-0410-9bdc-e9ce6186880e> | 2011-03-04 16:08:39 +0000 |
commit | bf25801d837b8fc496bf9c3a34eac525d8a3d8ae (patch) | |
tree | eefc9e418e10864c47cf9055ddf97a79f8a38979 /src/common/stabs_to_module_unittest.cc | |
parent | Updating to ints from unsigned ints so -1 will be an acceptable value. (diff) | |
download | breakpad-bf25801d837b8fc496bf9c3a34eac525d8a3d8ae.tar.xz |
Put PUBLIC lines in Mac symbol files.
Exported symbols on Mach-O binaries are defined in a STABS section. This patch makes stabs_reader handle them, adds support for Extern symbols in the Module class (which are output as PUBLIC lines in symbol files), and the proper processing in stabs_to_module to hook it all up.
A=mark R=jimb at http://breakpad.appspot.com/163001 and http://breakpad.appspot.com/267001
git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@778 4c0a9323-5329-0410-9bdc-e9ce6186880e
Diffstat (limited to 'src/common/stabs_to_module_unittest.cc')
-rw-r--r-- | src/common/stabs_to_module_unittest.cc | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/common/stabs_to_module_unittest.cc b/src/common/stabs_to_module_unittest.cc index 2c432a3e..d445d1d6 100644 --- a/src/common/stabs_to_module_unittest.cc +++ b/src/common/stabs_to_module_unittest.cc @@ -74,6 +74,35 @@ TEST(StabsToModule, SimpleCU) { EXPECT_EQ(174823314, line->number); } +#ifdef __GNUC__ +// Function name mangling can vary by compiler, so only run mangled-name +// tests on GCC for simplicity's sake. +TEST(StabsToModule, Externs) { + Module m("name", "os", "arch", "id"); + StabsToModule h(&m); + + // Feed in a few Extern symbols. + EXPECT_TRUE(h.Extern("_foo", 0xffff)); + EXPECT_TRUE(h.Extern("__Z21dyldGlobalLockAcquirev", 0xaaaa)); + EXPECT_TRUE(h.Extern("_MorphTableGetNextMorphChain", 0x1111)); + h.Finalize(); + + // Now check to see what has been added to the Module. + vector<Module::Extern *> externs; + m.GetExterns(&externs, externs.end()); + ASSERT_EQ((size_t) 3, externs.size()); + Module::Extern *extern1 = externs[0]; + EXPECT_STREQ("MorphTableGetNextMorphChain", extern1->name.c_str()); + EXPECT_EQ((Module::Address)0x1111, extern1->address); + Module::Extern *extern2 = externs[1]; + EXPECT_STREQ("dyldGlobalLockAcquire()", extern2->name.c_str()); + EXPECT_EQ((Module::Address)0xaaaa, extern2->address); + Module::Extern *extern3 = externs[2]; + EXPECT_STREQ("foo", extern3->name.c_str()); + EXPECT_EQ((Module::Address)0xffff, extern3->address); +} +#endif // __GNUC__ + TEST(StabsToModule, DuplicateFunctionNames) { Module m("name", "os", "arch", "id"); StabsToModule h(&m); @@ -154,6 +183,9 @@ TEST(InferSizes, LineSize) { EXPECT_EQ(87660088, line2->number); } +#ifdef __GNUC__ +// Function name mangling can vary by compiler, so only run mangled-name +// tests on GCC for simplicity's sake. TEST(FunctionNames, Mangled) { Module m("name", "os", "arch", "id"); StabsToModule h(&m); @@ -188,6 +220,7 @@ TEST(FunctionNames, Mangled) { EXPECT_EQ(0U, function->parameter_size); ASSERT_EQ(0U, function->lines.size()); } +#endif // __GNUC__ // The GNU toolchain can omit functions that are not used; however, // when it does so, it doesn't clean up the debugging information that |