From ad9fe6f3765007477364479ad6ebbe1099108293 Mon Sep 17 00:00:00 2001 From: Matt Valentine-House Date: Mon, 10 Jun 2024 16:41:12 +0100 Subject: [PATCH] Allow gdb to search source path for required files When doing out-of-source builds I often end up wanting to use gdb from inside a build directory. Currently if I do that the `.gdbinit` in the ruby source directory is not read. Attempting to manually load the `.gdbinit` from the Ruby source directory errors because of hard coded file-paths that assume we're running gdb from inside the source tree. Adding the `-s` flag to the `source` command when loading relative files signals to gdb to search in the source search path for the required file, rather than just the current directory. This allows me to use a custom `.gdbinit` from my build directory that sets the correct source directory and then loads the Ruby `.gdbinit`. ``` dir ../src source ../src/.gdbinit ``` --- .gdbinit | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gdbinit b/.gdbinit index 7dd3336e28..1b5b6cb562 100644 --- a/.gdbinit +++ b/.gdbinit @@ -1344,4 +1344,4 @@ define print_flags printf "RUBY_FL_USER18 : %s\n", ((struct RBasic*)($arg0))->flags & RUBY_FL_USER18 ? "1" : "0" end -source misc/gdb.py +source -s misc/gdb.py