diff options
author | Ian Lance Taylor <iant@google.com> | 2007-11-15 01:12:55 +0000 |
---|---|---|
committer | Ian Lance Taylor <iant@google.com> | 2007-11-15 01:12:55 +0000 |
commit | a2b1aa12f7d82dfd451e110bff8df16cdf6e2c49 (patch) | |
tree | e32b20a9b4065d58ffd0a8e1479f428fadb68ab5 /gold/object.cc | |
parent | 2a1932dcc777a3aa4552a14aa917caf33f97427b (diff) | |
download | gdb-a2b1aa12f7d82dfd451e110bff8df16cdf6e2c49.zip gdb-a2b1aa12f7d82dfd451e110bff8df16cdf6e2c49.tar.gz gdb-a2b1aa12f7d82dfd451e110bff8df16cdf6e2c49.tar.bz2 |
From Craig Silverstein: Add support for --demangle.
Diffstat (limited to 'gold/object.cc')
-rw-r--r-- | gold/object.cc | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/gold/object.cc b/gold/object.cc index 7a4b1fb..ecefa8b 100644 --- a/gold/object.cc +++ b/gold/object.cc @@ -25,6 +25,7 @@ #include <cerrno> #include <cstring> #include <cstdarg> +#include "demangle.h" #include "libiberty.h" #include "target-select.h" @@ -1032,7 +1033,20 @@ Sized_relobj<size, big_endian>::get_symbol_location_info( if (sym.get_st_name() > names_size) info->enclosing_symbol_name = "(invalid)"; else - info->enclosing_symbol_name = symbol_names + sym.get_st_name(); + { + info->enclosing_symbol_name = symbol_names + sym.get_st_name(); + if (parameters->demangle()) + { + char* demangled_name = cplus_demangle( + info->enclosing_symbol_name.c_str(), + DMGL_ANSI | DMGL_PARAMS); + if (demangled_name != NULL) + { + info->enclosing_symbol_name.assign(demangled_name); + free(demangled_name); + } + } + } return true; } } @@ -1155,11 +1169,6 @@ Relocate_info<size, big_endian>::location(size_t, off_t offset) const if (this->object->get_symbol_location_info(this->data_shndx, offset, &info)) { ret += " in function "; - // We could demangle this name before printing, but we don't - // bother because gcc runs linker output through a demangle - // filter itself. The only advantage to demangling here is if - // someone might call ld directly, rather than via gcc. If we - // did want to demangle, cplus_demangle() is in libiberty. ret += info.enclosing_symbol_name; ret += ":"; filename = info.source_file; |