This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[suggestion] gdb interfacing with any-editor via GNU screen


[I first sent this to gdb-bug at gnu dot org, then noticed this mailing
list, hope, it's the right place to send this, this time]

Being a vi user, I've long tried to interface it with GDB. I had
written once a kind of wrapper that opened two pseudo-ttys,
catched the \032\032 sequences sent by "gdb -f" and turned them
into ":e +line filename" sent to vi.

I recently noticed I could use GNU screen to do this.
screen provides a special control sequence which allows to run
arbitrary screen commands based on output from a command.

>From "info -f screen -n 'Control Sequences'":
I| ESC ] 83 ; cmd ^G       (A)     Execute screen command. This only works if
I|                                 multi-user support is compiled into screen.
I|                                 The pseudo-user ":window:" is used to check
I|                                 the access control list. Use "addacl :window:
I|                                 -rwx #?" to create a user with no rights and
I|                                 allow only the needed commands.

My idea was then, that gdb could send something like "\e]83;<a
screen command to have vi open the right file at the right
line>\a" instead of sending
"\032\032filename:line:char:mid:addr\n";.

That's my suggestion: add a new -F/--annotation-format option to
GDB with one required argument only used when the
annotation_level is 1 (-f option). The default would be:
"\032\032%f:%l:%c:%m:%a\n".

Attached, you'll find a quick patch on GDB 5.3, with my
suggestion implemented. (%f, %l, %c, %m, %a are replaced by
filename, line#, char#, middle/beg, address in the annotation
format).

vim-gdb-screen is a GNU bash script that
sets up a screen environment with a splitted screen (vim above,
gdb below) to use this feature. This must be run from within
screen, with two optionnal arguments: the executable to debug
and its source directory.

screenshot.png is a screenshot of an example usage.

Tell me what you think of it and don't hesitate to ask more
details.

Best regards,
Stéphane

Attachment: screenshot.png
Description: Screen shot VIM+GDB debugging screen-3.9.15

Attachment: gdb-5.3+annotation-format.diff
Description: unified format diff applied on GDB 5.3

Attachment: vim-gdb-screen
Description: Example script to use the new feature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]