In this commit:
commit
abbbd4a3e0ca51132e7fb31a43f896d29894dae0
Date: Wed Aug 11 13:24:33 2021 +0100
gdb: use libbacktrace to create a better backtrace for fatal signals
The build of GDB was broken iff, the execinfo backtrace API is not
available, and, libbacktrace is either disabled, or not usable. In
this case you'll see build errors like this:
CXX bt-utils.o
/home/username/src/binutils-gdb/gdb/bt-utils.c: In function 'void gdb_internal_backtrace()':
/home/username/src/binutils-gdb/gdb/bt-utils.c:165:5: error: 'gdb_internal_backtrace_1' was not declared in this scope
gdb_internal_backtrace_1 ();
^~~~~~~~~~~~~~~~~~~~~~~~
This commit fixes the issue by guarding the call to
gdb_internal_backtrace_1 with '#ifdef GDB_PRINT_INTERNAL_BACKTRACE',
which is only defined when one of the backtrace libraries are
available.
sig_write (_("----- Backtrace -----\n"));
+#ifdef GDB_PRINT_INTERNAL_BACKTRACE
if (gdb_stderr->fd () > -1)
gdb_internal_backtrace_1 ();
else
+#endif
sig_write (_("Backtrace unavailable\n"));
sig_write ("---------------------\n");