New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
print $var
by clicking identifiers in the source window
#141
Comments
Kind of related then too https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda |
This is a pretty neat idea, I must admit. I'm not sure I personally have the time to work on |
LGTM! I'll delve into the source code for some days to understand how it works first... |
horizontal scrolling is supported but the cursor cannot move freely in the source window. A simple and dirty implementation of cgdb#141 is to add a key binding (say p) to print the identifier at the cursor. However, the old max_width disallows horizontal scrolling when the longest line can be displayed in one screen. Loosen the restriction to make cursor being able to move to any identifier. Eventually the free movement of cursor should be implemented. Signed-off-by: Fangrui Song <i@maskray.me>
If will be very convenient to execute
print $identifier_under_cursor
whenever an identifier (the icing on the cake is to recognizex->y
orx.y
member access operators) is clicked in the source window.Enabling mouse clicks in ncurses can be achieved with the following snippet. There is also a standalone example at https://bbs.archlinux.org/viewtopic.php?id=199959 .
See what escape sequences are generated for mouse tracking:
To obtain the cursor position is tricky, because cgdb employs
io.cpp:io_getchar
which usesread()
on terminals instead of ncurses'getch()
. The terminal escape sequences are kind of tricky to parse, especially there are at least 4 different terminal modes for mouse support: 1000 (legacy), 1005, 1006 (the best), 1015 (urxvt) http://invisible-island.net/xterm/ctlseqs/ctlseqs.html . ncurses has itsncurses/base/lib_mouse.c
(which supports 1000, 1005, 1006 I think) to translate the escape sequence to a terminal position.Another improvement is to have a cgdb command to communicate with an external script. The filename and the line number are given to the external script and it should send some gdb commands back which print relevant expressions. Say the cursor is at
core->a = core->b + core->c;
, i would like the external script to sendp core->a; core->b; p core->c
back. The external script does not need to be full-fledged parser and it certainly cannot be. But with some regex matching, it could be very useful to give context in many cases.The text was updated successfully, but these errors were encountered: