-
Notifications
You must be signed in to change notification settings - Fork 0
/
demangle.c
32 lines (28 loc) · 966 Bytes
/
demangle.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/* Copyright (c) 2013 The Chromium Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file. */
#include "xray_priv.h"
#ifdef LINUX
#include <cxxabi.h>
#endif
/* Note name demangling requires linking against libstdc++ */
/* If your platform does not support __cxa_demangle, re-compile XRay with: */
/* -DXRAY_NO_DEMANGLE */
#if !defined(XRAY_NO_DEMANGLE)
extern
char* __cxa_demangle(const char* __mangled_name, char* __output_buffer,
size_t* __length, int* __status);
#endif
const char* XRayDemangle(char* demangle, size_t size, const char* symbol) {
#if !defined(XRAY_NO_DEMANGLE)
int stat;
#ifdef LINUX
__cxxabiv1::__cxa_demangle(symbol, demangle, &size, &stat);
#else
__cxa_demangle(symbol, demangle, &size, &stat);
#endif
if (stat == 0)
return demangle;
#endif
return symbol;
}