unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: rms@gnu.org
Cc: stefankangas@gmail.com, 58826@debbugs.gnu.org, dima@secretsauce.net
Subject: bug#58826: 29.0.50; gud-gdb can't find core file if executable is in a different directory
Date: Fri, 18 Nov 2022 10:23:04 +0200	[thread overview]
Message-ID: <8335agd63b.fsf@gnu.org> (raw)
In-Reply-To: <E1ovtZT-00054s-Vo@fencepost.gnu.org> (message from Richard Stallman on Fri, 18 Nov 2022 00:05:47 -0500)

> From: Richard Stallman <rms@gnu.org>
> Cc: stefankangas@gmail.com, 58826@debbugs.gnu.org,
> 	dima@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.





  reply	other threads:[~2022-11-18  8:23 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-27 23:52 bug#58826: 29.0.50; gud-gdb can't find core file if executable is in a different directory Dima Kogan
2022-10-28  6:23 ` Eli Zaretskii
2022-10-28  6:29   ` Dima Kogan
2022-10-28  7:20     ` Eli Zaretskii
2022-11-13  4:32       ` Stefan Kangas
2022-11-15  4:17         ` Richard Stallman
2022-11-15 13:46           ` Eli Zaretskii
2022-11-18  5:05             ` Richard Stallman
2022-11-18  8:23               ` Eli Zaretskii [this message]
2022-11-20  1:15                 ` Richard Stallman
2022-11-20  7:45                   ` Eli Zaretskii
2022-11-23 23:16                     ` Richard Stallman
2022-11-23 23:17                       ` Dima Kogan
2022-11-26  0:50                         ` Richard Stallman
2022-11-24  6:55                       ` Eli Zaretskii
2022-12-29  3:14                         ` Richard Stallman
2022-12-29  6:19                           ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8335agd63b.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=58826@debbugs.gnu.org \
    --cc=dima@secretsauce.net \
    --cc=rms@gnu.org \
    --cc=stefankangas@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).