GNU bug report logs - #58826
29.0.50; gud-gdb can't find core file if executable is in a different directory

Previous Next

Package: emacs;

Reported by: Dima Kogan <dima <at> secretsauce.net>

Date: Thu, 27 Oct 2022 23:53:01 UTC

Severity: normal

Found in version 29.0.50

Full log


View this message in rfc822 format

From: Eli Zaretskii <eliz <at> gnu.org>
To: Dima Kogan <dima <at> secretsauce.net>
Cc: 58826 <at> debbugs.gnu.org
Subject: bug#58826: 29.0.50; gud-gdb can't find core file if executable is in a different directory
Date: Fri, 28 Oct 2022 09:23:40 +0300
> From: Dima Kogan <dima <at> secretsauce.net>
> Date: Thu, 27 Oct 2022 16:52:32 -0700
> 
> Hi. I'm using a bleeding-edge build of emacs, although I think this is a
> very old bug.
> 
> I just ran a Python program in $DIRECTORY:
> 
>   python3 program.py
> 
> python3 is in /usr/bin. There was a bug, the program crashed, dumped
> core, and I want to debug it. I do this from the buffer containing
> program.py (default-directory is $DIRECTORY, which contains program.py
> and is NOT /usr/bin)
> 
>   M-x gud-gdb
>   gdb --fullname /usr/bin/python3 core.sfmviz.py.1807941
> 
> It says this:
> 
>   /usr/bin/core.sfmviz.py.1807941: No such file or directory.
> 
> It works fine from the shell, outside of emacs. The issue is that
> gud-gdb is changing default-directory to /usr/bin (where the binary
> executable lives). But I never asked for that, and this is unexpected:
> I'd expect it to do the same thing as that gdb command would do in the
> shell.

This is the documented behavior of "M-x gud-gdb":

  (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.

AFAIU, if you run the debugger like this:

  gdb --fullname python3 core.sfmviz.py.1807941

then GUD will not change the default-directory to /usr/bin, which I
believe is what you want.  GDB will then locate the Python executable
either in the current default-directory or 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.