Request for a buffer to display local vars

484 views
Skip to first unread message

Quentin de Laroussilhe

unread,
Sep 15, 2012, 8:33:23 PM9/15/12
to cgdb-...@googlegroups.com
Hello,

When I use cgdb I think this to s laborious to have to constantly use 'info loc' to inspect local variables. I think this could be a great idea to display this variables in a buffer.

Serge Voilokov

unread,
May 1, 2013, 9:43:06 AM5/1/13
to cgdb-...@googlegroups.com

Hi,

For displaying locals, stack and registers while stepping in cgdb I am using following method.

I wrote python extension for gdb which dumps all info to the separate file.
cgdb and "tail -f outfile.txt"  are running both in tmux or dvtm splitted screens (see screenshot).
Python hook on each stop event in gdb (step, next, until, etc) updates second part of the screen.

How to use it:

- gdb should have python support
- make 2 split panes in dvtm or tmux (or run tail in the separate terminal)

then run in first pane:
wget https://raw.github.com/serge-v/cgdb/master/lib/python/colored_display.py
cgdb
source colored_display.py
colored-display output file

in second pane or in second terminal run:
tail -f ~/gdbout.txt

These lines can be added to .gdbinit to enable it at gdb startup:
source colored_display.py
colored-display output file

Regards,
Serge
cgdb2.png

Douglas Roffel

unread,
Aug 18, 2015, 4:33:42 PM8/18/15
to cgdb
For those who are looking for the colored_display.py file, the location is now at: https://raw.githubusercontent.com/serge-v/dotfiles/master/bin/colored_display.py

William.Leo

unread,
Feb 18, 2017, 4:50:40 AM2/18/17
to cgdb, q.delar...@gmail.com

I finished this feature base on 0.6.8, not only locals but also args, stack, thread and breakpoint. They are displayed on right side of source and gdb windows. The default layout as following screen shot

1. The left windows are source and gdb as before, right windows are var(watch, mem) and stack(thread, break) tab controls. There is a vertical line between of them, and it can be move by hot key. The right tow tab controls also can increase or decrease height by '+' / '-', just like left windows.

2. All tab pages can be activated by hotkey, when focus is not on gdb window. And switch focus back to source by 'Esc', or gdb by 'i'.

3. Var tab page display result of "info locals" and "info args" for current frame. If execute 'next', and some variable's value change, the value will be highlight as red

4. Stack tab page display current call stack, result of "backtrace", current frame will be highlight as BOLD attribute. 

5. Thread tab page display all thread info, also highlight current thread.

6. Break tab page display breakpoint, enable break highlighted as red, disable is yellow, this is same as source window.

7. All tab pages will keep sync with gdb operation. 


All of these features finished just about 1 month ago, not enough test. I hope someone can help me finish test. Then maybe add into next version cgdb.  
  




在 2012年9月16日星期日 UTC+8上午8:33:23,Quentin de Laroussilhe写道:

Robert Rossi

unread,
Feb 18, 2017, 7:42:24 AM2/18/17
to cgdb-...@googlegroups.com, q.delar...@gmail.com
Hi William,

This looks incredible neat.

I can take a look at reviewing this, but I think that it might make sense to consider
rebasing this work on master. A lot has changed since 0.6.8.

Thanks,
Bob Rossi

--
You received this message because you are subscribed to the Google Groups "cgdb" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cgdb-users+unsubscribe@googlegroups.com.
To post to this group, send email to cgdb-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/cgdb-users/29ebed9e-f635-4dc6-8c87-b6a50981ca34%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

William.Leo

unread,
Feb 19, 2017, 1:04:46 AM2/19/17
to cgdb, q.delar...@gmail.com
Hi, Bob,

Thanks for your remind. I note really a lot changes after 0.6.8. I'll try to rebase my work on git master, since it can't be merged directly now. 

I use commands_user_ran_command() to issue internal command which is same as "COMMAND_BREAKPOINTS", New functions to parse gdb return like commands_process_source(), and send result by commands_send_gui_xxx() as response. Finally update interface in process_commands().

Do you have any plan to release next version? Any noteworthy change diff from git master?



在 2017年2月18日星期六 UTC+8下午8:42:24,Bob Rossi写道:
Hi William,

This looks incredible neat.

I can take a look at reviewing this, but I think that it might make sense to consider
rebasing this work on master. A lot has changed since 0.6.8.

Thanks,
Bob Rossi
On Sat, Feb 18, 2017 at 4:50 AM, William.Leo <willi...@gmail.com> wrote:

I finished this feature base on 0.6.8, not only locals but also args, stack, thread and breakpoint. They are displayed on right side of source and gdb windows. The default layout as following screen shot

1. The left windows are source and gdb as before, right windows are var(watch, mem) and stack(thread, break) tab controls. There is a vertical line between of them, and it can be move by hot key. The right tow tab controls also can increase or decrease height by '+' / '-', just like left windows.

2. All tab pages can be activated by hotkey, when focus is not on gdb window. And switch focus back to source by 'Esc', or gdb by 'i'.

3. Var tab page display result of "info locals" and "info args" for current frame. If execute 'next', and some variable's value change, the value will be highlight as red

4. Stack tab page display current call stack, result of "backtrace", current frame will be highlight as BOLD attribute. 

5. Thread tab page display all thread info, also highlight current thread.

6. Break tab page display breakpoint, enable break highlighted as red, disable is yellow, this is same as source window.

7. All tab pages will keep sync with gdb operation. 


All of these features finished just about 1 month ago, not enough test. I hope someone can help me finish test. Then maybe add into next version cgdb.  
  




在 2012年9月16日星期日 UTC+8上午8:33:23,Quentin de Laroussilhe写道:
Hello,

When I use cgdb I think this to s laborious to have to constantly use 'info loc' to inspect local variables. I think this could be a great idea to display this variables in a buffer.

--
You received this message because you are subscribed to the Google Groups "cgdb" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cgdb-users+...@googlegroups.com.

To post to this group, send email to cgdb-...@googlegroups.com.

Robert Rossi

unread,
Feb 19, 2017, 9:43:04 PM2/19/17
to cgdb-...@googlegroups.com, q.delar...@gmail.com, Michael Sartain
Actually, I think the plan is to get master a little less buggy and do a release.

We are sort of beta testing. I know of at least one bug I've got to fix before release.

Your work would be great to consider for the following release.
Give us plenty of time to get it right.

To be honest, I haven't looked at the patches yet. Also, I think Michael and I
were considering a windowing interface before adding additional functionality.
However, I think the discussion should still be had.

Thanks,
Bob Rossi

To unsubscribe from this group and stop receiving emails from it, send an email to cgdb-users+unsubscribe@googlegroups.com.

To post to this group, send email to cgdb-...@googlegroups.com.

Robert Rossi

unread,
Feb 19, 2017, 9:45:55 PM2/19/17
to cgdb-...@googlegroups.com, Quentin de Laroussilhe, Michael Sartain
I'm actually changing the commands file as we speak.

So if you rebase, it might cause further pain ahead.

I'll let you know when I'm done, should be soon.

Thanks,
Bob Rossi

William.Leo

unread,
Feb 20, 2017, 3:51:14 AM2/20/17
to cgdb, q.delar...@gmail.com, mike...@fastmail.com
OK, I'm fixing bugs, and will mail you the patch ASAP.

在 2017年2月20日星期一 UTC+8上午10:45:55,Bob Rossi写道:

William.Leo

unread,
Feb 20, 2017, 1:17:56 PM2/20/17
to cgdb, q.delar...@gmail.com, mike...@fastmail.com
hi, Bob

The attachment is patch file. It's just a prototype for displaying debug info automatically. I think bad smell code and duplication functions must be amended.

Directly show information on cgdb interface facilitate debug work a lot, hope see this feature in later release.


在 2017年2月20日星期一 UTC+8上午10:45:55,Bob Rossi写道:
I'm actually changing the commands file as we speak.

new-0.6.8.patch

M Kelly

unread,
Dec 31, 2018, 10:18:35 AM12/31/18
to cgdb
Hi,

Any more update on this ?  Is this in 0.70 ?

thx for cgdb,
-m

William.Leo

unread,
Nov 27, 2020, 12:54:09 AM11/27/20
to cgdb
Yes, have ported part of display to 0.7.1, check new conversation.
Reply all
Reply to author
Forward
0 new messages