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

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

Re: How can I specify emacs to use a specified gdb with command paramet


From: Nick Roberts
Subject: Re: How can I specify emacs to use a specified gdb with command parameters
Date: Sat, 21 Mar 2009 20:16:31 +1300

 > >>>> Is there a way to specify what my gdb command (like in your example,
 > >>>> put '/tmp/mygdb --annotate=3 /tmp/myexec')  in .emacs file? So that it
 > >>>> does not prompt me everytime I use M-x gdb?

You can customize the variable 'gud-gdb-command-name'.  However /tmp generally
wouldn't be a good place to put your executable.  As its name implies, it's
for temporary files and, on many systems, all files in it get deleted every
time the system reboots.


 > >>> I do something like this in my .emacs:
 > >>>
 > >>> (defun my-gdb ()
 > >>>  (interactive)
 > >>>  (setq gdb-many-windows nil)

nil is default anyway.

 > >>>  (setq gdb-use-separate-io-buffer nil)

nil is default anyway.

 > >>>  (tool-bar-mode t)

(add-hook 'gdb-mode-hook
'(lambda ()
   (tool-bar-mode 1))

 > >>>  (set-fringe-mode 'default)
 > >>>  (gdb "/tmp/mygdb --annotate=3"))

This starts gdb without an executable.  You could add it to the string
argument but one day you might want to debug another program.

Using:

  (setq gud-gdb-command-name "/pathto/yourgdb --annotate=3") 

in your .emacs (or using customize to set it) means you will be prompted for
(or Emacs will suggest) an executable name.


> Right now, I need to do this at a shell in order to remote debug a c++ 
> program.

> $ cd /Volumne/workingdirectory
> $ source ./build/envsetup.sh
> $ gdb attach $pid

> How can I repeat the same steps in emacs gdb?
> After I type M-x gdb, i enter 'gdb attach $pid' , it just said 'gdb'
> command not found .

> My gdb location is setup by the script build/envsetup.sh.

Who knows what your script does.  Gdb in Emacs (GUD buffer) works almost the
same as gdb from the command line.  If you do 'gdb attach $pid' from the
command line you get:

  Undefined command: "gdb".  Try "help"

just as you do in the GUD buffer.

Try typing just "attach $pid".  Here $pid must be a GDB convenience variable
and not a shell variable.

Why not read the Emacs and GDB info manuals which are readily available?


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




reply via email to

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