GNU bug report logs -
#58826
29.0.50; gud-gdb can't find core file if executable is in a different directory
Previous Next
Full log
Message #29 received at 58826 <at> debbugs.gnu.org (full text, mbox):
> From: Richard Stallman <rms <at> gnu.org>
> Cc: stefankangas <at> gmail.com, 58826 <at> debbugs.gnu.org,
> dima <at> secretsauce.net
> Date: Fri, 18 Nov 2022 00:05:47 -0500
>
> There are supposed to be GDB options it can specify on startup to get
> the right behavior from GDB. Is there some such option that is
> missing from GDB?
No. GDB behaves correctly and as expected. The issue is with GUD,
specifically how GUD sets the default-directory of the buffer through
which the user interacts with GDB.
Here's the doc string which describes this subtlety:
(defun gud-gdb (command-line)
"Run gdb passing it COMMAND-LINE as arguments.
If COMMAND-LINE names a program FILE to debug, gdb will run in
a buffer named *gud-FILE*, and the directory containing FILE
becomes the initial working directory and source-file directory
for your debugger. If you don't want `default-directory' to
change to the directory of FILE, specify FILE without leading
directories, in which case FILE should reside either in the
directory of the buffer from which this command is invoked, or
it can be found by searching PATH.
The above means that the default-directory of the *gud-FILE* buffer
will be different depending on whether at gud-gdb's prompt you type
the GDB command with the program to debug in its absolute file-name
form:
gdb ... /foo/bar/baz ...
or you type
gdb ... baz ...
and let GDB find 'baz' by searching PATH.
This bug report was last modified 2 years and 173 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.