你在 Vim 中调试 C++ 代码吗?如何? [英] Do you debug C++ code in Vim? How?

查看:29
本文介绍了你在 Vim 中调试 C++ 代码吗?如何?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问题在于你们所有使用 Vim 开发 C++ 应用程序的人.

The question is to all you people, who use Vim to develop C++ applications.

我生命中有一段时期,可以描述为'我讨厌 Vim !!!'..'Vim 很好!'

There was a period in my life, which can be described as 'I hate Vim!!!'..'Vim is nice!'

但是,我主要是在 Microsoft 开发 IDE 上成长起来的,所以在调试代码、观察窗口、调用堆栈和主代码 - 无需输入任何 GDB 命令即可全部可见.

However, having grown up mostly on Microsoft development IDEs, I've got used to those F5-F11 shortcuts when debugging code, watch window, call stack and the main code - all visible without need to type any GDB commands.

那么,问题来了:

您是否也使用 Vim 进行调试?或者您是否为此目的切换到某些IDE?哪个?

对于那些使用 Vim 调试代码的人:是否有插件可以在编辑器中设置断点,突出显示我们当前正在调试的行,在 step、step into、step 中自动导航?

For those who use Vim to debug code: are there plugins to set breakpoints in editor, highlight the line we're currently debugging, auto-navigation during step, step into, step out?

请不要告诉我你使用 GDB 作为命令行,只看到一行被调试等

Please, don't tell me you use GDB as command line, see only one line which is debugged, etc.

推荐答案

与其他答案相比,至少有三个选项可以满足您的要求:clewnpyclewnvimgdb.

In contrast with the other answers, there are at least three options that do just what you require: clewn, pyclewn and vimgdb.

这三个项目都是相关的.vimgdb 是一个针对 Vim 的补丁,需要重新编译 Vim.clewn 是一个独立的程序,它通过 Netbeans 套接字接口与 Vim 通信.这需要使用 +netbeans 选项构建 Vim(在最近的 Linux 发行版中就是这种情况,所以应该不会有问题).

All three projects are related. vimgdb is a patch against Vim and requires Vim to be recompiled. clewn is a standalone program that communicates with Vim through the Netbeans socket interface. This requires Vim to be built with the +netbeans option (this is the case in recent Linux distributions so it shouldn't be a problem).

引自小丑的网站:

Clewn 在 vi​​m 编辑器中实现了对 gdb 的完整支持:断点、观察变量、gdb 命令完成、汇编窗口等.

Clewn implements full gdb support in the vim editor: breakpoints, watch variables, gdb command completion, assembly windows, etc.

我认为你绝对应该试一试.

I think you should definitely give it a go.

pyclewn 网站首页显示了三个项目的对比.

The homepage of the pyclewn website shows a comparison between the three projects.

几个月前,我尝试了 pyclewn.设置起来有点困难,但看起来不错,但很有前途.我只是做了一些测试,您可以设置书签等,这是您期望从图形调试器中获得的常见功能.出于偶然原因,我最终没有使用它,但我很想再试一次.

A few months ago I tried pyclewn. It was a bit difficult to set up, but it looks well though out and promising. I just did some tests and you could set bookmarks, etc., the usual stuff you would expect from a graphical debugger. I ended up not using it for contingent reasons but I am keen to give it another try.

这篇关于你在 Vim 中调试 C++ 代码吗?如何?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆