Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

emacs gdb layout

214 views
Skip to first unread message

Ritchie

unread,
Jan 19, 2009, 4:57:50 AM1/19/09
to
After start gdb inside emacs with option "--annotation=3 --fullname",
I ran gdb-many-windows to get the gdb layout which contains the local
variable buffer, stack frame buffer and breakpoint buffers. However
these buffers do not show anything as I run debugger. In order to get
local buffer to display local variable values, stack frame buffer to
display stack status and break point display current breakpoint info
as I run the debugger, what am I missing?

Thank you in advance

- R

Nick Roberts

unread,
Jan 19, 2009, 3:17:38 PM1/19/09
to Ritchie, help-gn...@gnu.org
Ritchie writes:
> After start gdb inside emacs with option "--annotation=3 --fullname",

The gdb option is "--annotate=3" so this wouldn't run at all. Gdb should
start woth only one of these options and with M-x gdb it should be
"--annotate=3" for the graphical interface. For text mode, i.e, like
Emacs 21, use M-x gud-gdb which will give you "--fullname".

> I ran gdb-many-windows to get the gdb layout which contains the local
> variable buffer, stack frame buffer and breakpoint buffers. However
> these buffers do not show anything as I run debugger. In order to get
> local buffer to display local variable values, stack frame buffer to
> display stack status and break point display current breakpoint info
> as I run the debugger, what am I missing?

I suggest uou read the debuggers section of the Emacs manual.

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


Ritchie

unread,
Jan 19, 2009, 9:42:23 PM1/19/09
to
> After start gdb inside emacs with option "--annotation=3 --fullname",

Sorry, that was a typo, what I had in my .emacs originally was
(setq gud-gdb-command-name "gdb --annotate=3 --fullname")
which I think is correct.

The version I'm using is Carbon Emacs (emacs 22)

> I suggest uou read the debuggers section of the Emacs manual.

I read the manual, but it didn't work out very well. The manual says
"If gdb-many-windows is non-nil, then M-x gdb displays the following
frame layout "

but when I have the following lines in my .emacs:

(setq gdb-many-windows t)
(setq gdb-use-separate-io-buffer t)

and run M-x gdb, i still just get the simple layout. I have to bring
out the default
frame layout by giving another two M-x gdb-many-windows. The first one
is to
disable it, the second one is to enable it again, and then the frame
layout will
show up. So I just remove the (setq gdb-many-windows t) from .emacs,
and
run it manually everytime after I start gdb.

my problem is that in those buffers, locals, stack, breakpoints, there
is nothing
displayed as I run the program in gdb. In the manual, it just tells
you how to use
the buffer, e.g. click on a variable in local buffer to change the
value, but in mine,
it doesn't display any local variables, even if there is in the code.
Here is the screenshot:

http://cs655-1.ias.csusb.edu:8080/~zcai/layout.png

I'm not sure if it is normal but it would be nice if I could get it to
work like yours.

http://users.snap.net.nz/~nickrob/multi-threaded.png

Did you give any commands for those buffers to display the contents?

And by the way, here is my configuration for gdb in my .emacs :

;; ===================================================================
;; Add color to the current GUD line (obrigado google)
;; ===================================================================

(defvar gud-overlay
(let* ((ov (make-overlay (point-min) (point-min))))
(overlay-put ov 'face 'secondary-selection)
ov)
"Overlay variable for GUD highlighting.")

(defadvice gud-display-line (after my-gud-highlight act)
"Highlight current line."
(let* ((ov gud-overlay)
(bf (gud-find-file true-file)))
(save-excursion
(set-buffer bf)
(move-overlay ov (line-beginning-position) (line-
end-position)
(current-buffer)))))

(defun gud-kill-buffer ()
(if (eq major-mode 'gud-mode)
(delete-overlay gud-overlay)))

(add-hook 'kill-buffer-hook 'gud-kill-buffer)


;; =================================
;; GDB configuration
;; =================================

(require 'gud)
(require 'gdb-ui)
(setq gud-gdb-command-name "gdb --annotate=3 --fullname")
(setq gdb-many-windows t)
(setq gdb-use-separate-io-buffer t)

;;(add-hook 'gdb-mode-hook '(lambda () (require 'gdb-highlight)))

(add-hook 'gud-mode-hook
'(lambda ()
(local-set-key [home] ; move to beginning of line,
after prompt
'comint-bol)
(local-set-key [up] ; cycle backward through
command history
'(lambda () (interactive)
(if (comint-after-pmark-p)
(comint-previous-input 1)
(previous-line 1))))
(local-set-key [down] ; cycle forward through
command history
'(lambda () (interactive)
(if (comint-after-pmark-p)
(comint-next-input 1)
(forward-line 1))))
))


Thank you

- R

Nick Roberts

unread,
Jan 19, 2009, 11:19:37 PM1/19/09
to Ritchie, help-gn...@gnu.org
Ritchie writes:
> > After start gdb inside emacs with option "--annotation=3 --fullname",
>
> Sorry, that was a typo, what I had in my .emacs originally was
> (setq gud-gdb-command-name "gdb --annotate=3 --fullname")
> which I think is correct.

I don't understand how you reach that conclusion. Generally you shouldn't need
to change the value of gud-gdb-command-name unless your executable has a
different name. It should work for you if you leave it at it's original value
"gdb --annotate=3"

> The version I'm using is Carbon Emacs (emacs 22)
>
> > I suggest uou read the debuggers section of the Emacs manual.
>

> I read the manual, but it didn't work out very well...

No, it won't if you use undocumented settings.

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


Richard Riley

unread,
Jan 20, 2009, 4:29:50 AM1/20/09
to
Ritchie <ritch...@gmail.com> writes:

>> After start gdb inside emacs with option "--annotation=3 --fullname",
>
> Sorry, that was a typo, what I had in my .emacs originally was
> (setq gud-gdb-command-name "gdb --annotate=3 --fullname")
> which I think is correct.
>
> The version I'm using is Carbon Emacs (emacs 22)
>
>> I suggest uou read the debuggers section of the Emacs manual.
>
> I read the manual, but it didn't work out very well. The manual says
> "If gdb-many-windows is non-nil, then M-x gdb displays the following
> frame layout "
>
> but when I have the following lines in my .emacs:
>
> (setq gdb-many-windows t)
> (setq gdb-use-separate-io-buffer t)
>
> and run M-x gdb, i still just get the simple layout. I have to bring
> out the default
> frame layout by giving another two M-x gdb-many-windows. The first one
> is to
> disable it, the second one is to enable it again, and then the frame
> layout will
> show up. So I just remove the (setq gdb-many-windows t) from .emacs,
> and
> run it manually everytime after I start gdb.

Try cleaning everything out.

(caveat, I use emacs 23 ut I'm fairly sure it worked in Emacs 22 like
this too).

I, using the code from here :

http://richardriley.net/default/projects/emacs/dotprogramming#sec-1.2

run gdb which then prompts (search for f12)

"gdb --annotate=3 progname"

And I get something like:

http://richardriley.net/default/projects/images/gud.png

good luck!

faraz ahmed

unread,
Jan 20, 2009, 9:56:34 PM1/20/09
to
On Jan 20, 1:29 am, Richard Riley <rileyrg...@gmail.com> wrote:

--annotate=3 & --fullpath are _SORT_ of incompatible.
If you invoke GDB with both the options (i.e fullpath and annot =3)
the annotation level is _SILENTLY_ set to 1, you can check this by
trying "gdb> show annotation". With the annotation set to 1 (albeit
silently) your local,stack etc window cannot be displayed.My advice
would be try giving up the need to specify --fullpath along with
annotation=3, read up on GDB/M1 and experiment :)

Just do away with the need of specifying --fullpath and let
annotation=3 as is.

-Faraz.

faraz ahmed

unread,
Jan 20, 2009, 10:10:17 PM1/20/09
to

that would be gdb> show annotate

faraz ahmed

unread,
Jan 21, 2009, 12:09:06 AM1/21/09
to

OK. try setting gdb> set annotate 3 after breaking into the target
program.

-Faraz

Richard Riley

unread,
Jan 21, 2009, 2:49:34 AM1/21/09
to
faraz ahmed <faraz....@gmail.com> writes:

Where did fullpath come into it? Did I miss a post in the thread or did
you spot something elsewhere?

faraz ahmed

unread,
Jan 21, 2009, 10:02:16 PM1/21/09
to
On Jan 20, 11:49 pm, Richard Riley <rileyrg...@gmail.com> wrote:


--fullname As in the first post .

Ritchie

unread,
Jan 22, 2009, 10:08:33 AM1/22/09
to
Thanks guys. I kind of messed up. After removing "--fullname" option,
everything works like a charm.

regards

- R

0 new messages