Use execinfo.h only on glibc

libunwind could also work on musl but that would require more drastic
code changes

Github-ID: https://github.com/ibm-s390-linux/s390-tools/pull/193
Signed-off-by: Sertonix <sertonix@posteo.net>
Reviewed-by: Steffen Eiden <seiden@linux.ibm.com>
Reviewed-by: Ingo Franzki <ifranzki@linux.ibm.com>
Reviewed-by: Jan Höppner <hoeppner@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
Sertonix
2025-10-28 17:55:50 +01:00
committed by Jan Höppner
parent 327d132aac
commit 99d7ec51a7
2 changed files with 13 additions and 1 deletions

View File

@@ -10,7 +10,9 @@
#include <ctype.h>
#include <dirent.h>
#include <errno.h>
#ifdef __GLIBC__
#include <execinfo.h>
#endif
#include <limits.h>
#include <signal.h>
#include <stdarg.h>
@@ -1191,6 +1193,7 @@ void line_free(int argc, char **argv)
#define BACKTRACE_MAX 32
/* Used for debugging. */
#ifdef __GLIBC__
void print_trace(void)
{
void *bt[BACKTRACE_MAX];
@@ -1204,6 +1207,9 @@ void print_trace(void)
fprintf(stderr, "DEBUG: %s\n", bt_sym[i]);
free(bt_sym);
}
#else
void print_trace(void) {}
#endif
/* Return a textual representation of @config. */
const char *config_to_str(config_t config)