diff options
Diffstat (limited to 'binutils/addr2line.c')
-rw-r--r-- | binutils/addr2line.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/binutils/addr2line.c b/binutils/addr2line.c index fae7edd..2d9dc90 100644 --- a/binutils/addr2line.c +++ b/binutils/addr2line.c @@ -35,6 +35,7 @@ #include "libiberty.h" #include "demangle.h" #include "bucomm.h" +#include "budemang.h" static boolean with_functions; /* -f, show function names. */ static boolean do_demangle; /* -C, demangle names. */ @@ -191,23 +192,22 @@ translate_addresses (abfd) { if (with_functions) { - if (functionname == NULL || *functionname == '\0') - printf ("??\n"); - else if (! do_demangle) - printf ("%s\n", functionname); - else + const char *name; + char *alloc = NULL; + + name = functionname; + if (name == NULL || *name == '\0') + name = "??"; + else if (do_demangle) { - char *res; - - res = cplus_demangle (functionname, DMGL_ANSI | DMGL_PARAMS); - if (res == NULL) - printf ("%s\n", functionname); - else - { - printf ("%s\n", res); - free (res); - } + alloc = demangle (abfd, name); + name = alloc; } + + printf ("%s\n", name); + + if (alloc != NULL) + free (alloc); } if (base_names && filename != NULL) |