aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Burgess <andrew.burgess@embecosm.com>2021-09-29 10:26:59 +0100
committerAndrew Burgess <andrew.burgess@embecosm.com>2021-09-29 10:26:59 +0100
commit74ea3b51c3b76fc0ccd46cc755e6e85e4570515b (patch)
tree2c10aebbeb09924ba98f2f9f7199969515851515
parent4180173142185f0967dfefb131e4843a17779c86 (diff)
downloadgdb-74ea3b51c3b76fc0ccd46cc755e6e85e4570515b.zip
gdb-74ea3b51c3b76fc0ccd46cc755e6e85e4570515b.tar.gz
gdb-74ea3b51c3b76fc0ccd46cc755e6e85e4570515b.tar.bz2
gdb: fix build when libbacktrace and execinfo backtrace are not available
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.
-rw-r--r--gdb/bt-utils.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/gdb/bt-utils.c b/gdb/bt-utils.c
index 8f826bd..79e6e09 100644
--- a/gdb/bt-utils.c
+++ b/gdb/bt-utils.c
@@ -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");