[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: |
Fri, 19 Jan 2007 14:17:51 -0800 |
> (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).
So that's the source of your problem.
Fair enough, although I'm guessing that many people get in the habit of
accepting the default without inspecting it too closely. Most times, the
default will be correct and everyone is happy... sometimes the default
will be wrong but will be immediately obvious (for example emacs
decided I was trying to debug an excel spreadsheet with gdb because
it was executable... ask Bill Gates why ;) ). But every once in a while,
people will think they're debugging one program and they'll actually
be debugging another. That will be very frustrating for them (although
it's their own fault for not paying closer attention I guess).
I think a better request would be to change the UI such that M-x gdb can do
what your macro does.
To get my old build process working with the new emacs (with the help
of Nick Roberts), I have a section of my makefile that looks like the
following:
@echo "(defun debug-project ()" >> $(EXECDIR)$(EXECROOT).lisp
@echo "(interactive)" >> $(EXECDIR)$(EXECROOT).lisp
@echo "(switch-to-buffer \"*scratch*\")" >> $(EXECDIR)$(EXECROOT).lisp
@echo "(cd \"$(CVSROOTLEVEL)/$(MAKEFILEDIR)\")" >>
$(EXECDIR)$(EXECROOT).lisp
@echo "(gdb \"gdb --annotate=3 $(CVSROOTLEVEL)/$(EXECDIR)$(EXECROOT)\")" >>
$(EXECDIR)$(EXECROOT).lisp
@echo "(switch-to-buffer \"*scratch*\")" >> $(EXECDIR)$(EXECROOT).lisp
@echo "(bury-buffer))" >> $(EXECDIR)$(EXECROOT).lisp
@echo "(global-set-key [f4] 'debug-project)" >>
$(EXECDIR)$(EXECROOT).lisp
This generates a file with emacs lisp code that defines a function
debug-project that
can be invoked using the f4 key. It changes to the *scratch* buffer in
preparation
for running a cd (change directory) command to prevent a buffer I care about
from
having its directory changed. Then it changes to the directory containing
my
makefile (which in my case is the directory I want to be in when I run the
debugger).
Then it runs gdb with the appropriate executable filename. Then it buries
the
*scratch* buffer so it isn't the default next buffer.
I have an "emacs" target in my makefile that generates an etags file (which
is nice
because your makefile knows about all of your source code) and also
generates
a lisp file including the section above. emacs is opened automatically and
loads
the tags table and the lisp file... by doing this, my emacs session knows
about all
of my source code which may be scattered across multiple directories and
knows
the executable filename/location and the directory I want to be in when I
debug.
So my problems with the new executable filename guessing feature are solved.
Thanks! I still am of the opinion that this feature should be able to be
disabled,
but I think this discussion has run its course on this list. It seemed like
a bug at
the time. :}
David
_________________________________________________________________
Turn searches into helpful donations. Make your search count.
http://click4thecause.live.com/search/charity/default.aspx?source=hmemtagline_donation&FORM=WLMTAG