2020-02-19 Jordan Rupprecht <rupprecht@google.com>
authorEric Christopher <echristo@gmail.com>
Wed, 19 Feb 2020 21:55:25 +0000 (13:55 -0800)
committerEric Christopher <echristo@gmail.com>
Wed, 19 Feb 2020 21:57:26 +0000 (13:57 -0800)
* objdump.c (show_line): call bfd_demangle when using do_demangle.

binutils/ChangeLog
binutils/objdump.c

index 6d8c95f99994dae67939bd341eb17e039c51b392..bb39cea4c62d3fdf533280d358bdf6119f32c835 100644 (file)
@@ -1,3 +1,7 @@
+2020-02-19  Jordan Rupprecht  <rupprecht@google.com>
+
+       * objdump.c (show_line): call bfd_demangle when using do_demangle.
+
 2020-02-19  Andrew Burgess  <andrew.burgess@embecosm.com>
 
        * configure: Regenerate.
index 8182dcc36232775ba1d46a84921fb997e2b5e41b..6eef38f0e28c067051e6fda01d021ff4e59cee0e 100644 (file)
@@ -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
This page took 0.027954 seconds and 4 git commands to generate.