util/u_debug_symbol: remove debug_symbol_name_glibc and execinfo dependency

Signed-off-by: Simon Zeni <simon@bl4ckb0ne.ca>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12108>
This commit is contained in:
Simon Zeni 2021-08-16 11:23:01 -04:00 committed by Marge Bot
parent 90be0d7963
commit 973e9e25bd

View file

@ -218,31 +218,6 @@ debug_symbol_name_dbghelp(const void *addr, char* buf, unsigned size)
#endif /* PIPE_OS_WINDOWS */
#if defined(HAVE_EXECINFO_H)
#include <execinfo.h>
/* This can only provide dynamic symbols, or binary offsets into a file.
*
* To fix this, post-process the output with tools/addr2line.sh
*/
static inline boolean
debug_symbol_name_glibc(const void *addr, char* buf, unsigned size)
{
char** syms = backtrace_symbols((void**)&addr, 1);
if (!syms) {
return FALSE;
}
strncpy(buf, syms[0], size - 1);
buf[size - 1] = 0;
free(syms);
return TRUE;
}
#endif /* defined(HAVE_EXECINFO_H) */
void
debug_symbol_name(const void *addr, char* buf, unsigned size)
{
@ -252,12 +227,6 @@ debug_symbol_name(const void *addr, char* buf, unsigned size)
}
#endif
#if defined(HAVE_EXECINFO_H)
if (debug_symbol_name_glibc(addr, buf, size)) {
return;
}
#endif /* defined(HAVE_EXECINFO_H) */
snprintf(buf, size, "%p", addr);
buf[size - 1] = 0;
}