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

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

Re: Mode for files visited by GUD


From: Nick Roberts
Subject: Re: Mode for files visited by GUD
Date: Sat, 19 Jul 2008 14:20:06 +1200

 > > A file called gdbsrc.el used to do something like this in XEmacs and I
 > > considered it for a while.  I think it's the wrong approcah because
 > > generally in a debug session you end up wanting to edit your code.
 > 
 > But there is nothing wrong with it. Sure, you end up editing, but that
 > happens at the *end*, first you have to quit debugging to do anything useful
 > with the editing task. 

It's best not to quit debugging and just recompile.  That way you keep the
shell history as well as GDB's breakpoints, although some may have moved.

 >                        Besides, I make 'q' exit the read-only modes; it
 > can't get much easier than that; and while I'm just doing "next", "step" and
 > friends, I can do it with 'n', 's' and so on, and if I need to select a
 > piece of code (e.g., for evaluating), I don't have to switch to another
 > window, and back: I'm there.

Then presumably you need to remember to turn it on again when you debug.  I find
the tool bar useful for repetitive commands except that it doesn't work properly
with GTK.  In this case, <RET> in the GUD buffer works well.

 > > This way, as you say, source-guding-mode is evaluated for all files.
 > > gdb-find-file-hook is also evaluated for all files but it doesn't do
 > > anything if gud-minor-mode is not 'gdba or 'gdbmi.
 > 
 > IMHO, it breaks the principle of least astonishment. At least I was
 > astonished  :-)

gdb-find-file-hook is an internal function not intended for general use.
It's role is too specialised for it's own hook variable.

 > So I could do this, right?:
 > 
 > (defadvice gdb-find-file-hook (after activate-guding activate)
 >   (and gud-minor-mode
 >        (memq gud-minor-mode '(gdba gdbmi))
 >        (source-guding-mode 1)))

Something like that should work but not for existing buffers which hold
source files.

 > > Since you probably want to set source-guding-mode for existing buffers too
 > > it may be best to advise gdb-init-buffer.  This function only gets called
 > > for GDB related buffers.
 > 
 > I haven't found such function with [C-h f]. In which version was it
 > introduced?

Yes, it's only in the CVS repository.

-- 
Nick                                           http://www.inet.net.nz/~nickrob




reply via email to

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