libstrawberry-common: check for library/includes for backtrace() (#364)

This is a non-standard header, so it should be checked properly.
This fixes compilation with musl libc and possibly other C library
implementations.
This commit is contained in:
Daniel Kolesa
2020-02-06 20:04:23 +01:00
committed by GitHub
parent 4bd4d3ae03
commit 814bb3006c
4 changed files with 39 additions and 4 deletions

View File

@@ -14,6 +14,8 @@
limitations under the License.
*/
#include "backtrace_inc.h"
#include <QtGlobal>
#include <QByteArray>
#include <QList>
@@ -32,9 +34,6 @@
#include <stdlib.h>
#include <string>
#include <iostream>
#ifdef Q_OS_UNIX
#include <execinfo.h>
#endif
#include "logging.h"
@@ -255,7 +254,7 @@ QString DemangleSymbol(const QString &symbol) {
}
void DumpStackTrace() {
#ifdef Q_OS_UNIX
#ifdef HAVE_BACKTRACE
void* callstack[128];
int callstack_size = backtrace(reinterpret_cast<void**>(&callstack), sizeof(callstack));
char** symbols = backtrace_symbols(reinterpret_cast<void**>(&callstack), callstack_size);