From 741cb83912fffbc65784168204ce1a597e0fbd26 Mon Sep 17 00:00:00 2001 From: Eric Christopher Date: Wed, 19 Feb 2020 13:55:25 -0800 Subject: [PATCH] 2020-02-19 Jordan Rupprecht * objdump.c (show_line): call bfd_demangle when using do_demangle. --- binutils/ChangeLog | 4 ++++ binutils/objdump.c | 16 +++++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/binutils/ChangeLog b/binutils/ChangeLog index 6d8c95f9999..bb39cea4c62 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,7 @@ +2020-02-19 Jordan Rupprecht + + * objdump.c (show_line): call bfd_demangle when using do_demangle. + 2020-02-19 Andrew Burgess * configure: Regenerate. diff --git a/binutils/objdump.c b/binutils/objdump.c index 8182dcc3623..6eef38f0e28 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 -- 2.30.2