mirror of
https://github.com/clementine-player/Clementine
synced 2025-01-30 02:55:19 +01:00
Add support for demangling symbols on Linux.
This commit is contained in:
parent
822d766a04
commit
5280ddf3d7
@ -183,9 +183,7 @@ QDebug CreateLogger(Level level, const QString& class_name, int line) {
|
|||||||
return ret.space();
|
return ret.space();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString DemangleSymbol(const QString& symbol) {
|
QString CXXDemangle(const QString& mangled_function) {
|
||||||
QStringList split = symbol.split(' ', QString::SkipEmptyParts);
|
|
||||||
QString mangled_function = split[3];
|
|
||||||
int status;
|
int status;
|
||||||
char* demangled_function = abi::__cxa_demangle(
|
char* demangled_function = abi::__cxa_demangle(
|
||||||
mangled_function.toAscii().constData(),
|
mangled_function.toAscii().constData(),
|
||||||
@ -200,6 +198,31 @@ QString DemangleSymbol(const QString& symbol) {
|
|||||||
return mangled_function; // Probably not a C++ function.
|
return mangled_function; // Probably not a C++ function.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString DarwinDemangle(const QString& symbol) {
|
||||||
|
QStringList split = symbol.split(' ', QString::SkipEmptyParts);
|
||||||
|
QString mangled_function = split[3];
|
||||||
|
return CXXDemangle(mangled_function);
|
||||||
|
}
|
||||||
|
|
||||||
|
QString LinuxDemangle(const QString& symbol) {
|
||||||
|
QRegExp regex("\\(([^+]+)");
|
||||||
|
if (!symbol.contains(regex)) {
|
||||||
|
return symbol;
|
||||||
|
}
|
||||||
|
QString mangled_function = regex.cap(1);
|
||||||
|
return CXXDemangle(mangled_function);
|
||||||
|
}
|
||||||
|
|
||||||
|
QString DemangleSymbol(const QString& symbol) {
|
||||||
|
#ifdef Q_OS_DARWIN
|
||||||
|
return DarwinDemangle(symbol);
|
||||||
|
#elif defined(Q_OS_LINUX)
|
||||||
|
return LinuxDemangle(symbol);
|
||||||
|
#else
|
||||||
|
return symbol;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
void DumpStackTrace() {
|
void DumpStackTrace() {
|
||||||
#ifdef Q_OS_UNIX
|
#ifdef Q_OS_UNIX
|
||||||
void* callstack[128];
|
void* callstack[128];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user