wukenaihe / google-breakpad

Automatically exported from code.google.com/p/google-breakpad
0 stars 0 forks source link

OS X dump_syms could call __cxa_demangle directly instead of using c++filt #158

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The attached patch changes the OS X dump_syms implementation to use the
libstdc++ API __cxa_demangle directly instead of calling c++filt.  This is
what c++filt calls internally anyway.  This allows for a lot of code
removal.  (probably even more than I did here)

Reference:
http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/namespaceabi.html

Original issue reported on code.google.com by ted.mielczarek on 2 May 2007 at 2:53

Attachments:

GoogleCodeExporter commented 9 years ago
Ok, updated to just use the mangled name if demangling fails.  With this patch, 
I
diffed the output of the existing dump_syms and my new one on firefox-bin, and 
the
only differences are in displaying std::string vs. std::basic_string<...>:

5509c5509
< FUNC f124 97 0
google_breakpad::ExceptionHandler::ExceptionHandler(std::basic_string<char,
std::char_traits<char>, std::allocator<char> > const&, bool (*)(void*), bool 
(*)(char
const*, char const*, void*, bool), void*, bool)
---
> FUNC f124 97 0 google_breakpad::ExceptionHandler::ExceptionHandler(std::string
const&, bool (*)(void*), bool (*)(char const*, char const*, void*, bool), 
void*, bool)
5907c5907
< FUNC 10982 12d 0
google_breakpad::MinidumpGenerator::UniqueNameInDirectory(std::basic_string<char
,
std::char_traits<char>, std::allocator<char> > const&, std::basic_string<char,
std::char_traits<char>, std::allocator<char> >*)
---
> FUNC 10982 12d 0
google_breakpad::MinidumpGenerator::UniqueNameInDirectory(std::string const&,
std::string*)
6305c6305
< FUNC 11dd8 1a7 0 MacStringUtils::IntegerValueAtIndex(std::basic_string<char,
std::char_traits<char>, std::allocator<char> >&, unsigned int)
---
> FUNC 11dd8 1a7 0 MacStringUtils::IntegerValueAtIndex(std::string&, unsigned 
int)

The new lines are the output of my new tool.  I think that looks nicer anyway!

Original comment by ted.mielczarek on 2 May 2007 at 3:42

Attachments:

GoogleCodeExporter commented 9 years ago
Wow, I didn't know that cxa_demangle was available in libstdc++.  I complained 
during
the initial review of the Mac dump_syms that we didn't have access to this 
function
because we didn't really have access to libiberty.

Original comment by mmento...@gmail.com on 2 May 2007 at 3:57

GoogleCodeExporter commented 9 years ago

Original comment by ted.mielczarek on 3 May 2007 at 8:15

GoogleCodeExporter commented 9 years ago
adding one more fix:

    buffer = abi::__cxa_demangle(symbol, buffer, &buffer_size, &result);

buffer needs to be assigned from the return result of __cxa_demangle to deal 
with realloc...

Checking fix in...

Original comment by ladderbr...@gmail.com on 3 May 2007 at 10:59