Home | History | Annotate | Download | only in xray
      1 /* Copyright (c) 2013 The Chromium Authors. All rights reserved.
      2  * Use of this source code is governed by a BSD-style license that can be
      3  * found in the LICENSE file. */
      4 
      5 #include "xray/xray_priv.h"
      6 
      7 /* Note name demangling requires linking against libstdc++                 */
      8 /* If your platform does not support __cxa_demangle, re-compile XRay with: */
      9 /*   -DXRAY_NO_DEMANGLE                                                    */
     10 
     11 #if !defined(XRAY_NO_DEMANGLE)
     12 extern
     13 char* __cxa_demangle(const char* __mangled_name, char* __output_buffer,
     14                      size_t* __length, int* __status);
     15 #endif
     16 
     17 const char* XRayDemangle(char* demangle, size_t size, const char* symbol) {
     18 #if !defined(XRAY_NO_DEMANGLE)
     19   int stat;
     20   __cxa_demangle(symbol, demangle, &size, &stat);
     21   if (stat == 0)
     22     return demangle;
     23 #endif
     24   return symbol;
     25 }
     26