* How can I specify emacs to use a specified gdb with command parameters
@ 2009-03-20 1:27 Lucius Fox
2009-03-20 9:30 ` Peter Dyballa
[not found] ` <b79371120903192216g3c20e811h308af5706f0fce13@mail.gmail.com>
0 siblings, 2 replies; 5+ messages in thread
From: Lucius Fox @ 2009-03-20 1:27 UTC (permalink / raw)
To: help-gnu-emacs
HI,
I want to setup gdb interface in emacs so that I can do source level
debugging within emacs. My question is how can I specified gdb with
command parameters? Instead of using the one emacs found in the $PATH.
Thank you.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: How can I specify emacs to use a specified gdb with command parameters
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>
1 sibling, 0 replies; 5+ messages in thread
From: Peter Dyballa @ 2009-03-20 9:30 UTC (permalink / raw)
To: Lucius Fox; +Cc: help-gnu-emacs
Am 20.03.2009 um 02:27 schrieb Lucius Fox:
> My question is how can I specified gdb with command parameters?
Do you mean you want to know what can be put into a .gdbinit file? Or
are you looking for the
M-x manual-entry RET gdb RET
command?
--
Greetings
Pete
Make it simple, as simple as possible but no simpler.
– Albert Einstein
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: How can I specify emacs to use a specified gdb with command parameters
[not found] ` <528a76e70903192323g23505882te25c60a62b973ae@mail.gmail.com>
@ 2009-03-20 13:38 ` David L
2009-03-21 6:05 ` Lucius Fox
0 siblings, 1 reply; 5+ messages in thread
From: David L @ 2009-03-20 13:38 UTC (permalink / raw)
To: Lucius Fox; +Cc: help-gnu-emacs
On Thu, Mar 19, 2009 at 11:23 PM, Lucius Fox wrote:
> Thanks.
>
> Another question I have is
> * how does emacs knows where to pulll the source code during debugging?
I think it learns it from gdb. gdb learns if from the debugging symbols in
the executable. I think there is some interaction with some emacs settings
because I've had situations where I've been unable to insert a breakpoint
in a file by clicking in the left margin, but emacs has been able to bring
me to the right line when gdb stops at a breakpoint inserted the old
fashion way.
> * after i open a file, how can I setup a break point at a particular line?
If gdb is active and emacs and gdb agree that the file you've opened
is a source file (usually, but not always true in my experience), you can
just left click in the left margin.
I'm responding on-list to this because other people might be able
to give better answers.
Good luck,
Dave
>
> On Thu, Mar 19, 2009 at 10:58 PM, David L wrote:
>> On Thu, Mar 19, 2009 at 10:47 PM, Lucius Fox wrote:
>>> David,
>>>
>>> Thank you for your response.
>>> 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?
>>
>> I do something like this in my .emacs:
>>
>> (defun my-gdb ()
>> (interactive)
>> (setq gdb-many-windows nil)
>> (setq gdb-use-separate-io-buffer nil)
>> (tool-bar-mode t)
>> (set-fringe-mode 'default)
>> (gdb "/tmp/mygdb --annotate=3"))
>>
>> Then I assign a key to run my-gdb
>>
>> (global-set-key [C-f7] 'my-gdb)
>>
>>
>> Cheers...
>>
>> Dave
>>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: How can I specify emacs to use a specified gdb with command parameters
2009-03-20 13:38 ` David L
@ 2009-03-21 6:05 ` Lucius Fox
2009-03-21 7:16 ` Nick Roberts
0 siblings, 1 reply; 5+ messages in thread
From: Lucius Fox @ 2009-03-21 6:05 UTC (permalink / raw)
To: David L; +Cc: help-gnu-emacs
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.
Thank you for any help.
On Fri, Mar 20, 2009 at 6:38 AM, David L <idht4n@gmail.com> wrote:
> On Thu, Mar 19, 2009 at 11:23 PM, Lucius Fox wrote:
>> Thanks.
>>
>> Another question I have is
>> * how does emacs knows where to pulll the source code during debugging?
>
> I think it learns it from gdb. gdb learns if from the debugging symbols in
> the executable. I think there is some interaction with some emacs settings
> because I've had situations where I've been unable to insert a breakpoint
> in a file by clicking in the left margin, but emacs has been able to bring
> me to the right line when gdb stops at a breakpoint inserted the old
> fashion way.
>
>> * after i open a file, how can I setup a break point at a particular line?
> If gdb is active and emacs and gdb agree that the file you've opened
> is a source file (usually, but not always true in my experience), you can
> just left click in the left margin.
>
> I'm responding on-list to this because other people might be able
> to give better answers.
>
> Good luck,
>
> Dave
>
>
>>
>> On Thu, Mar 19, 2009 at 10:58 PM, David L wrote:
>>> On Thu, Mar 19, 2009 at 10:47 PM, Lucius Fox wrote:
>>>> David,
>>>>
>>>> Thank you for your response.
>>>> 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?
>>>
>>> I do something like this in my .emacs:
>>>
>>> (defun my-gdb ()
>>> (interactive)
>>> (setq gdb-many-windows nil)
>>> (setq gdb-use-separate-io-buffer nil)
>>> (tool-bar-mode t)
>>> (set-fringe-mode 'default)
>>> (gdb "/tmp/mygdb --annotate=3"))
>>>
>>> Then I assign a key to run my-gdb
>>>
>>> (global-set-key [C-f7] 'my-gdb)
>>>
>>>
>>> Cheers...
>>>
>>> Dave
>>>
>>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: How can I specify emacs to use a specified gdb with command parameters
2009-03-21 6:05 ` Lucius Fox
@ 2009-03-21 7:16 ` Nick Roberts
0 siblings, 0 replies; 5+ messages in thread
From: Nick Roberts @ 2009-03-21 7:16 UTC (permalink / raw)
To: Lucius Fox; +Cc: help-gnu-emacs
> >>>> 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
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2009-03-21 7:16 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).