aboutsummaryrefslogtreecommitdiff
path: root/binutils/objdump.c
diff options
context:
space:
mode:
authorEric Christopher <echristo@gmail.com>2020-02-19 13:55:25 -0800
committerEric Christopher <echristo@gmail.com>2020-02-19 13:57:26 -0800
commit741cb83912fffbc65784168204ce1a597e0fbd26 (patch)
tree6d88968210bd477e6c848c7e6b02aba82caa97d8 /binutils/objdump.c
parentc9c41e6d73af4593b02471ca4d40ea00e453465a (diff)
downloadgdb-741cb83912fffbc65784168204ce1a597e0fbd26.zip
gdb-741cb83912fffbc65784168204ce1a597e0fbd26.tar.gz
gdb-741cb83912fffbc65784168204ce1a597e0fbd26.tar.bz2
2020-02-19 Jordan Rupprecht <rupprecht@google.com>
* objdump.c (show_line): call bfd_demangle when using do_demangle.
Diffstat (limited to 'binutils/objdump.c')
-rw-r--r--binutils/objdump.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/binutils/objdump.c b/binutils/objdump.c
index 8182dcc..6eef38f 100644
--- a/binutils/objdump.c
+++ b/binutils/objdump.c
@@ -1734,8 +1734,22 @@ show_line (bfd *abfd, asection *section, bfd_vma addr_offset)
&& (prev_functionname == NULL
|| strcmp (functionname, prev_functionname) != 0))
{
- printf ("%s():\n", sanitize_string (functionname));
+ char *demangle_alloc = NULL;
+ if (do_demangle && functionname[0] != '\0')
+ {
+ /* Demangle the name. */
+ demangle_alloc = bfd_demangle (abfd, functionname,
+ demangle_flags);
+ }
+
+ /* Demangling adds trailing parens, so don't print those. */
+ if (demangle_alloc != NULL)
+ printf ("%s:\n", sanitize_string (demangle_alloc));
+ else
+ printf ("%s():\n", sanitize_string (functionname));
+
prev_line = -1;
+ free (demangle_alloc);
}
if (linenumber > 0
&& (linenumber != prev_line