You are not logged in.

#1 2008-01-29 14:45:08

Jacek Poplawski
Member
From: Poland
Registered: 2006-01-10
Posts: 736
Website

vim + gdb

Anyone is using vim with gdb?
I tried few scripts from vim.sf.net, but they don't work.
I was able to use vdb with simple example program but it doesn't work with my huge project.
I wonder why this feature is not implemented just in vim and why each script is old or broken?

Offline

#2 2008-01-29 17:44:49

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: vim + gdb

vim is not a debugger. It is also not an IDE. It is made to write text. I do not need gdb when writing emails, nor do I need gdb when editing a config file. For this very reason this is not "implemented just in vim". Vim is a text editor.

Furthermore, I have tried all the gdb+vim scripts in the past. While they are good, I later learned to actually use gdb properly and will _never_ go back to the crippled scripts that integrate the two. Try learning gdb on it's own. It's worth it.

Offline

#3 2008-01-29 17:46:09

cactus
Taco Eater
From: t͈̫̹ͨa͖͕͎̱͈ͨ͆ć̥̖̝o̫̫̼s͈̭̱̞͍̃!̰
Registered: 2004-05-25
Posts: 4,622
Website

Re: vim + gdb

dude. i use a debugger on my email all the time.
/me sets a breakpoint and runs while viewing his stack


"Be conservative in what you send; be liberal in what you accept." -- Postel's Law
"tacos" -- Cactus' Law
"t̥͍͎̪̪͗a̴̻̩͈͚ͨc̠o̩̙͈ͫͅs͙͎̙͊ ͔͇̫̜t͎̳̀a̜̞̗ͩc̗͍͚o̲̯̿s̖̣̤̙͌ ̖̜̈ț̰̫͓ạ̪͖̳c̲͎͕̰̯̃̈o͉ͅs̪ͪ ̜̻̖̜͕" -- -̖͚̫̙̓-̺̠͇ͤ̃ ̜̪̜ͯZ͔̗̭̞ͪA̝͈̙͖̩L͉̠̺͓G̙̞̦͖O̳̗͍

Offline

#4 2008-01-30 09:43:20

Jacek Poplawski
Member
From: Poland
Registered: 2006-01-10
Posts: 736
Website

Re: vim + gdb

phrakture I use gdb since 1998, the problem is that I am constantly switching between vim and gdb when I am debugging something, "list" is not enough for me.

How do you tell gdb where to put breakpoint, for instance, when you want to stop after loop? Don't you need a line number from vim? So while I am in gdb, I need to switch to vim terminal and find the line number, then I go back and put a breakpoint, also code in gdb is not highlighted.

I remember I was reading one day in the documentation of vim, that it's not going to be full IDE, just simple editor, but I like the Project plugin, it makes editing of my source tree much more user friendly.

The thing I was never able to make work is code completion feature. But I can live without it. Cscope is more important.

Offline

#5 2008-01-30 12:08:52

WhiteMagic
Member
Registered: 2007-03-01
Posts: 85

Re: vim + gdb

I can't help you with the vim plugin / gdb switching problem per se as I don't use a debugger that often and if, then it's mostly ddd or insight (just because I never had to intensively use a debugger I suppose).
But you could perhaps give cgdb http://cgdb.sourceforge.net/ a try, as it supposedly is very vim-like but I never used it so I can't say anything good or bad about it.

Offline

#6 2008-01-30 15:21:02

Jacek Poplawski
Member
From: Poland
Registered: 2006-01-10
Posts: 736
Website

Re: vim + gdb

I want vim+gdb, not gdb frontend.

Offline

#7 2008-01-30 17:25:39

tch
Member
From: Slovakia
Registered: 2007-10-07
Posts: 31

Re: vim + gdb

use split windows perhaps - screen, vim and xmonad can all do the trick.

Last edited by tch (2008-01-30 17:25:58)

Offline

#8 2008-01-30 20:00:08

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: vim + gdb

Jacek Poplawski wrote:

How do you tell gdb where to put breakpoint, for instance, when you want to stop after loop? Don't you need a line number from vim? So while I am in gdb, I need to switch to vim terminal and find the line number, then I go back and put a breakpoint, also code in gdb is not highlighted.

Aha! I knew where this question was leading. Take a look here:
http://img.phraktured.net/screenshots/irc_and_gdb.png

The middle there with the code? That's 100% gdb. It's called the TUI.

http://sourceware.org/gdb/current/onlin … db_23.html

Offline

#9 2008-01-31 01:33:10

Jacek Poplawski
Member
From: Poland
Registered: 2006-01-10
Posts: 736
Website

Re: vim + gdb

OK, you are right, I didn't know it, will try to learn this feature. Big thanks!

Offline

#10 2008-01-31 15:59:39

codemac
Member
From: Cliche Tech Place
Registered: 2005-05-13
Posts: 794
Website

Re: vim + gdb

Check out cgdb as well, a curses front end for gdb/tgdb.  http://cgdb.sourceforge.net/

ss_debugging.png

Added with the vsplit patch for screen, it's money money, yeah yeah.  I think a little more integration sometimes would be nice sometimes, but that thought only occurs to me about once every 3 months.

Offline

#11 2012-06-17 22:21:55

skibyte
Member
Registered: 2012-03-02
Posts: 4

Re: vim + gdb

The thread is old but seems is not answered yet, I have developed a vim plugin that might work for you http://www.vim.org/scripts/script.php?script_id=4103

With this plugin you can:
add breakpoints
delete breakpoints
print variable values
etc

There is still some pending features like remote debugging and attach to a process but I am constantly adding code in github and I am working hard to  create the plugin that becomes in the perfect gdb-vim solution.
Moreover I am willing to hear any suggestion you have.

Offline

#12 2012-06-17 22:25:29

/dev/zero
Member
From: Melbourne, Australia
Registered: 2011-10-20
Posts: 1,247

Re: vim + gdb

Very timely, I'll check it out, thanks!

Offline

#13 2012-06-18 00:29:43

/dev/zero
Member
From: Melbourne, Australia
Registered: 2011-10-20
Posts: 1,247

Re: vim + gdb

Okay, the plugin depended on a gdblib, which was not only not in the standard repositories, but not in the AUR either. I put it there now, under python2-gdblib-git.

I think rather than just erroring when it realises you haven't set g:gdb_from_vim_{run,args}, your plugin should prompt for them. At first I thought there was a bug. Okay, I should have rtfmed, but I prefer to rtfm after I've seen a little basic functionality.

Is it possible to set a flag that will tell gdb what tty to use? You see, I would be interested in using your plugin in ncurses applications, which require setting, say, tty=/dev/pts/1, so that gdb and curses don't fight for terminal real estate.

Last edited by /dev/zero (2012-06-18 00:36:22)

Offline

#14 2012-06-18 01:21:36

skibyte
Member
Registered: 2012-03-02
Posts: 4

Re: vim + gdb

Those are good recomendations I already opened two enhancements in gdbfromvim
and  in gdblib (I developed both)
https://github.com/skibyte/gdb-from-vim/issues
https://github.com/skibyte/gdblib/issues

They should be ready on the following days.

Thanks a lot for try the plugin and give me your feedback.

Offline

#15 2012-06-18 01:47:27

/dev/zero
Member
From: Melbourne, Australia
Registered: 2011-10-20
Posts: 1,247

Re: vim + gdb

skibyte wrote:

Those are good recomendations I already opened two enhancements in gdbfromvim
and  in gdblib (I developed both)
https://github.com/skibyte/gdb-from-vim/issues
https://github.com/skibyte/gdblib/issues

They should be ready on the following days.

Thanks a lot for try the plugin and give me your feedback.

Cool, thanks!

I came across this old thread a few days ago when trying to figure out how to integrate vim and gdb. I couldn't believe they have such poor integration. The TUI mode in gdb just doesn't cut it. It's not clear to me how to configure key mappings and macros for gdb, TUI doesn't highlight syntax, and neither is it clear how to seamlessly edit the source while debugging. I wasn't able to start fixing it myself because I'm still just learning both vimscript and gdb. Maybe after I learn both a bit better, I'll realise integration isn't necessary - for now, however, it would be nice.

So, it was quite a nice coincidence to see the same thread necrobumped with a chance at a new solution :-). Thanks for your efforts.

Offline

#16 2012-06-20 01:48:08

skibyte
Member
Registered: 2012-03-02
Posts: 4

Re: vim + gdb

* I added a new version of gdbfromvim in http://www.vim.org/scripts/script.php?script_id=4103 and https://github.com/skibyte/gdb-from-vim
* I also updated gdblib https://github.com/skibyte/gdblib .

The changes I added are :

* GdbFromVimContinue which is the equivalent to gdb continue command.
* GdbFromVimTty where somebody can specify a tty for IO redirection.
* If g:gdb_from_vim_app is not defined vim it will prompt for the value when a GdbFromVim command is invoked.

Since I think it is not the best idea provide status of version releases or bugs in this forum, I would appreciate if anybody reading this opens a bug or a feature you desire in the respective github site mentioned above.

Thanks.

Offline

#17 2012-06-20 02:35:39

/dev/zero
Member
From: Melbourne, Australia
Registered: 2011-10-20
Posts: 1,247

Re: vim + gdb

Looks like it works well, thanks :-).

Offline

Board footer

Powered by FluxBB