bug-gnu-emacs
[Top][All Lists]
Advanced

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

gdb does not honor default-directory


From: Matt Armstrong
Subject: gdb does not honor default-directory
Date: 14 Oct 2002 14:00:34 -0600

This bug report will be sent to the Free Software Foundation,
not to your local site managers!
Please write in English, because the Emacs maintainers do not have
translators to read other languages for them.

Your bug report will be posted to the bug-gnu-emacs@gnu.org mailing list,
and to the gnu.emacs.bug news group.

In GNU Emacs 21.2.1 (i386-debian-linux-gnu, X toolkit, Xaw3d scroll bars)
 of 2002-03-22 on raven, modified by Debian
configured using `configure  i386-debian-linux-gnu --prefix=/usr 
--sharedstatedir=/var/lib --libexecdir=/usr/lib --localstatedir=/var/lib 
--infodir=/usr/share/info --mandir=/usr/share/man --with-pop=yes --with-x=yes 
--with-x-toolkit=athena --without-gif'
Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: C
  locale-coding-system: nil
  default-enable-multibyte-characters: t

Please describe exactly what actions triggered the bug
and the precise symptoms of the bug:

When running gdb from gud in a directory where default-directory does
not equal what the getcwd() call returns for the same directory, gdb's
idea of $cwd will not be the same as emacs' idea of default-directory.
This can happen when you use symlinks.  The end result is that files
stepped into or otherwise accessed via gdb are referenced by their
true name and not the preferred symlink name, which tends to confuse
tags and some source code control systems.

To keep gdb's idea of the current directory the same as emacs', I
think emacs should be passing "-cd default-directory" to gdb.  This
should happen after the gud-chdir-before-run variable has had its
effect.

I currently get this done with the following advice:

    (defadvice gud-gdb-massage-args (around my-gud-gdb-massage-args)
      (setq ad-return-value
            (append (ad-get-arg 1)
                    (list "-cd" default-directory))))
    (eval-after-load "gdb" '(ad-activate 'gud-gdb-massage-args))

But I suggest the stock gud-gdb-massage-args be changed to something
like this (pardon my elisp):

    (defun gud-gdb-massage-args (file args)
      (append (cons "-fullname" args)) (list "-cd" default-directory))

gdb 5.2 ignores all but the first -cd arg, so appending it lets the
user specify a different dir if they like.

As a result, I get this:

    Current directory is ~/dp/bordeaux1/
    GNU gdb 5.2.1
    Copyright 2002 Free Software Foundation, Inc.
    [...]
    This GDB was configured as "sparc-sun-solaris2.6"...
    (gdb) pwd
    Working directory /users/maarmstr/dp/bordeaux1
     (canonically /u2/maarmstr/dp/bordeaux1).
    (gdb) 

whereas before gdb's idea of current directory was the same as the
return value of the getcwd() call (/u2/maarmstr/dp/bordeaux1).


Recent input:
C-p C-n C-n C-n C-n C-n C-n C-x 2 C-x o C-x b e m a 
c s <return> C-g C-x C-f C-g <help-echo> <help-echo> 
<help-echo> <down-mouse-1> <mouse-1> C-s a d - a c 
t i v a t e C-s C-s C-s C-s <return> <help-echo> M-< 
C-s C-s C-s <return> C-l C-n C-n C-n C-n C-n C-n C-n 
C-p C-p C-p C-p C-n <down-mouse-1> <mouse-1> <double-down-mouse-1> 
<mouse-movement> <mouse-movement> <mouse-movement> 
<mouse-movement> <mouse-movement> <mouse-movement> 
<mouse-movement> <mouse-movement> <mouse-movement> 
<mouse-movement> <mouse-movement> <mouse-movement> 
<mouse-movement> <mouse-movement> <mouse-movement> 
<mouse-movement> <mouse-movement> <mouse-movement> 
<mouse-movement> <mouse-movement> <mouse-movement> 
<mouse-movement> <double-drag-mouse-1> <down-mouse-1> 
<mouse-1> <help-echo> <help-echo> <help-echo> <help-echo> 
<help-echo> <menu-bar> <help-menu> <report-emacs-b
ug>

Recent messages:
unzipping elisp-13.gz...done
unzipping elisp-12.gz...done
Mark saved where search started
unzipping elisp-13.gz...done
iswitchb-possible-new-buffer: Quit
Quit
Mark saved where search started
Mark set
Mark saved where search started
Loading emacsbug...done

-- 
matt




reply via email to

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