From 740ce35025a5a37d78b0ee2a363c35534eaa1a2a Mon Sep 17 00:00:00 2001 From: Thiago Jung Bauermann Date: Fri, 2 Jun 2023 22:39:54 +0200 Subject: gdb/configure.ac: Add option --with-additional-debug-dirs If you want to install GDB in a custom prefix, have it look for debug info in that prefix but also in the distro's default location (typically, /usr/lib/debug) and run the GDB testsuite before doing "make install", you have a bit of a problem: Configuring GDB with '--prefix=$PREFIX' sets the GDB 'debug-file-directory' parameter to $PREFIX/lib/debug. Unfortunately this precludes GDB from looking for distro-installed debug info in /usr/lib/debug. For regular GDB use you could set debug-file-directory to $PREFIX:/usr/lib/debug in $PREFIX/etc/gdbinit so that GDB will look in both places, but if you want to run the testsuite then that doesn't help because in that case GDB runs with the '-nx' option. There's the configure option '--with-separate-debug-dir' to set the default value for 'debug-file-directory', but it accepts only one directory and not a list. I considered modifying it to accept a list, but it's not obvious how to do that because its value is also used by BFD, as well as processed for "relocatability". I thought it was simpler to add a new option to specify a list of additional directories that will be appended to the debug-file-directory setting. Reviewed-By: Eli Zaretskii Approved-By: Tom Tromey --- gdb/main.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'gdb/main.c') diff --git a/gdb/main.c b/gdb/main.c index 8a1c269..2da39f8 100644 --- a/gdb/main.c +++ b/gdb/main.c @@ -718,6 +718,11 @@ captured_main_1 (struct captured_main_args *context) debug_file_directory = relocate_gdb_directory (DEBUGDIR, DEBUGDIR_RELOCATABLE); +#ifdef ADDITIONAL_DEBUG_DIRS + debug_file_directory = (debug_file_directory + DIRNAME_SEPARATOR + + ADDITIONAL_DEBUG_DIRS); +#endif + gdb_datadir = relocate_gdb_directory (GDB_DATADIR, GDB_DATADIR_RELOCATABLE); -- cgit v1.1