[Top][All Lists]

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

Re: gdb adds random filename to command

From: David L
Subject: Re: gdb adds random filename to command
Date: Thu, 18 Jan 2007 12:54:02 -0800

> I use makefiles for a project to open emacs with etags and a preconfigured
 > gud-gdb-command-name.  When using emacs as an IDE, this makes my life
 > easier... especially since in real life, my gud command has a filename
 > a lot more complicated than /tmp/foo:
 > gdb --annotate=3
 > /projects/dl/cvstrunk/shared/sw/gvu/bin/fc6debug1_singlethread/gvu
> I don't like typing that long filename. If the new behavior is not a bug
 > that will be fixed,
 > any suggestions for getting the old behavior?

I don't know the exact details but maybe, in your lisp file, you could put:

(setq default-directory "/projects/dl/cvstrunk/shared/sw/gvu/bin/fc6debug1_singlethread/")

This didn't seem to change the behavior.

Emacs doesn't add a random filename, as you suggest, but the most recently
compiled executable, so it might even find your executable in this case. If
not, you will only have to type gvu.
Ah, I see.  I was confused because a data file that somebody sent me
had executable permissions, so it was selected as the "most recently
compiled executable".  Once I changed the permissions of that file,
it selected an excel spreadsheet as the executable (again, the permissions
were wrong).  It seems that the algorithm is to select the most recently
modified file with execute by user permissions in the directory of the working
buffer (which often changes as you switch between files on a large project
with multiple directories).

I think gud-gdb-command-name was never meant to include the executable, it just worked. The reason for not including it, I guess, is that users generally want to debug more than one filename. I think that, generally, the convenience of
Emacs guessing the right name of the executable is greateer than the
inconvenience of guessing the wrong one.

I see your point... perhaps we can get the best of both worlds by introducing a
new boolean variable that tells whether emacs guesses executable filenames
or not.  Guessing wrong could be very inconvenient in some cases.  Suppose,
for example that you have two versions of an executable: foo and bar and that
they are the same except that bar has different compiler flags such as macro
definitions and optimization flags. Say you compile bar from the command line
and it crashes when you try to run it.  So you go to your emacs session from
which you built foo and press a key bound to running gdb.  Then you don't
notice that it has selected the wrong executable and you get weird results
when you try to debug. (In my case, I would never notice that it selected the wrong file, because I bypass the confirmation step using a macro that presses
return for me and then changes to the directory from which I want to be in
when I run).



Turn searches into helpful donations. Make your search count. http://click4thecause.live.com/search/charity/default.aspx?source=hmemtagline_donation&FORM=WLMTAG

reply via email to

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