Bug 855081: Make jprof compile for me by switching from cplus_demangle (which doesn't link) to abi::__cxa_demangle. r=jesup
authorL. David Baron <dbaron@dbaron.org>
Mon, 13 May 2013 15:37:00 -0700
changeset 131830 261e3e928ce98b0e6c4e42941d1c5b2c09647277
parent 131829 cae4d57e0e8b274ea920137b3bb718424105a1a7
child 131831 4edb718559c53c1c0cd68f05198b50a3e805d228
push id27990
push userdbaron@mozilla.com
push dateMon, 13 May 2013 22:37:19 +0000
treeherdermozilla-inbound@261e3e928ce9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjesup
bugs855081
milestone24.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 855081: Make jprof compile for me by switching from cplus_demangle (which doesn't link) to abi::__cxa_demangle. r=jesup
tools/jprof/bfd.cpp
--- a/tools/jprof/bfd.cpp
+++ b/tools/jprof/bfd.cpp
@@ -7,20 +7,17 @@
 
 #ifdef USE_BFD
 #include <stdio.h>
 #include <string.h>
 #include <fcntl.h>
 #include <unistd.h>
 #include <libgen.h>
 #include <bfd.h>
-
-extern "C" {
-  char *cplus_demangle (const char *mangled, int options);
-}
+#include <cxxabi.h>
 
 static bfd *try_debug_file(const char *filename, unsigned long crc32)
 {
   int fd = open(filename, O_RDONLY);
   if (fd < 0)
     return NULL;
 
   unsigned char buf[4*1024];
@@ -199,19 +196,22 @@ void leaky::ReadSymbols(const char *aFil
     symbol_info syminfo;
     bfd_get_symbol_info (symbolFile, sym, &syminfo);
 
 //    if ((syminfo.type == 'T') || (syminfo.type == 't')) {
       const char* nm = bfd_asymbol_name(sym);
       if (nm && nm[0]) {
         char* dnm = NULL;
         if (strncmp("__thunk", nm, 7)) {
-          dnm = cplus_demangle(nm, 1);
+          dnm = abi::__cxa_demangle(nm, 0, 0, 0);
         }
         (*sp)->Init(dnm ? dnm : nm, syminfo.value + aBaseAddress);
+        if (dnm) {
+          free(dnm);
+        }
         NEXT_SYMBOL;
       }
 //    }
   }
 
   bfd_close(symbolFile);
 
   int interesting = sp - externalSymbols;