From: nickrob@snap.net.nz (Nick Roberts)
To: Lucius Fox <lucius.fox08@gmail.com>
Cc: help-gnu-emacs@gnu.org
Subject: Re: How can I specify emacs to use a specified gdb with command parameters
Date: Sat, 21 Mar 2009 20:16:31 +1300 [thread overview]
Message-ID: <18884.37967.448138.515953@totara.tehura.co.nz> (raw)
In-Reply-To: <528a76e70903202305je24c60ei53f436a37225bc2@mail.gmail.com>
> >>>> 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
prev parent reply other threads:[~2009-03-21 7:16 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-20 1:27 How can I specify emacs to use a specified gdb with command parameters Lucius Fox
2009-03-20 9:30 ` Peter Dyballa
[not found] ` <b79371120903192216g3c20e811h308af5706f0fce13@mail.gmail.com>
[not found] ` <528a76e70903192247v49693f8fx2bbc12f32cbc9557@mail.gmail.com>
[not found] ` <b79371120903192258w444265cchde82582525592840@mail.gmail.com>
[not found] ` <528a76e70903192323g23505882te25c60a62b973ae@mail.gmail.com>
2009-03-20 13:38 ` David L
2009-03-21 6:05 ` Lucius Fox
2009-03-21 7:16 ` Nick Roberts [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=18884.37967.448138.515953@totara.tehura.co.nz \
--to=nickrob@snap.net.nz \
--cc=help-gnu-emacs@gnu.org \
--cc=lucius.fox08@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.