gdb: fix build when libbacktrace and execinfo backtrace are not available

In this commit:

  commit abbbd4a3e0
  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.
This commit is contained in:
Andrew Burgess 2021-09-29 10:26:59 +01:00
parent 4180173142
commit 74ea3b51c3

View file

@ -161,9 +161,11 @@ gdb_internal_backtrace ()
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");