emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: gud-chdir-before-run


From: Eli Zaretskii
Subject: Re: gud-chdir-before-run
Date: Wed, 03 Mar 2010 19:27:27 +0200

> From: Andreas Schwab <address@hidden>
> Cc: address@hidden
> Date: Wed, 03 Mar 2010 18:01:46 +0100
> 
> Eli Zaretskii <address@hidden> writes:
> 
> > Why is this option's default value non-nil?  It does the wrong thing
> > when the executable is not in the same directory as the sources, because
> > the .gdbinit file is usually found where the sources live, so changing
> > the directory starts GDB in the wrong place, and .gdbinit is not read.
> 
> Usually the .gdbinit lives where the program is built.

"Where the program is built" is not necessarily "where the built
binary gets put".  E.g., "gcc foo.c -o /some/where/else".  Case in
point is how Emacs is built on Windows (the *.o files and the binary
get put into a per-architecture subdirectory of `src').  Another case
in point is any package after "make install && make clean".

In any case, I'm in the habit of invoking GDB from the directory where
I have the suitable .gdbinit.  If the executable is there as well,
gud-chdir-before-run is a no-op; if it is elsewhere, under the current
default I'm screwed.

> > In my usage, I normally type "M-x gdb" from a buffer that visits some
> > source file which is compiled into the program I'm about to debug, or
> > one of its Makefile's or other scripts.  For this use-case, the current
> > default is always wrong.
> 
> Without gud-chdir-before-run you need to M-x cd to the build directory
> *before* invoking M-x gdb, which would clobber default-directory for the
> current buffer.

A user of GDB is usually aware that she needs to invoke GDB in a
certain directory.  She would need to do that if she invokes GDB from
the shell prompt.  So she would probably switch to the suitable buffer
before invoking "M-x gdb".

It is confusing to have "M-x gdb" behave subtly different from what
you get outside Emacs.

Anyway, if there's objection to change the default, I don't want to
argue.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]