是否有适用于 Linux 的 C++ gdb GUI?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/79023/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-03 16:26:16  来源:igfitidea点击:

Is there a C++ gdb GUI for Linux?

c++linuxgdbdebugging

提问by HappyDude

Briefly: Does anyone know of a GUI for gdb that brings it on par or close to the feature set you get in the more recent version of Visual C++?

简而言之:有没有人知道 gdb 的 GUI 使它与您在较新版本的 Visual C++ 中获得的功能集相当或接近?

In detail: As someone who has spent a lot of time programming in Windows, one of the larger stumbling blocks I've found whenever I have to code C++ in Linux is that debugging anything using commandline gdb takes me several times longer than it does in Visual Studio, and it does not seem to be getting better with practice. Some things are just easier or faster to express graphically.

详细说明:作为一个在 Windows 中花费大量时间进行编程的人,每当我必须在 Linux 中编写 C++ 代码时,我发现的最大绊脚石之一是使用命令行 gdb 调试任何东西所花费的时间比它在Visual Studio,它似乎并没有随着实践而变得更好。有些事情只是更容易或更快地以图形方式表达。

Specifically, I'm looking for a GUI that:

具体来说,我正在寻找一个 GUI:

  • Handles all the basics like stepping over & into code, watch variables and breakpoints
  • Understands and can display the contents of complex & nested C++ data types
  • Doesn't get confused by and preferably can intelligently step through templated code and data structures while displaying relevant information such as the parameter types
  • Can handle threaded applications and switch between different threads to step through or view the state of
  • Can handle attaching to an already-started process or reading a core dump, in addition to starting the program up in gdb
  • 处理所有基础知识,例如单步执行代码、观察变量和断点
  • 理解并能显示复杂和嵌套的 C++ 数据类型的内容
  • 在显示参数类型等相关信息的同时,不会被模板化代码和数据结构所迷惑,并且最好能够智能地单步执行模板化代码和数据结构
  • 可以处理线程应用程序并在不同线程之间切换以单步执行或查看应用程序的状态
  • 除了在 gdb 中启动程序之外,还可以处理附加到已经启动的进程或读取核心转储

If such a program does not exist, then I'd like to hear about experiences people have had with programs that meet at least some of the bullet points. Does anyone have any recommendations?

如果这样的程序不存在,那么我想听听人们对至少满足某些要点的程序的体验。有人有什么建议吗?

Edit:
Listing out the possibilities is great, and I'll take what I can get, but it would be even more helpful if you could include in your responses:
(a) Whether or not you've actually used this GUI and if so, what positive/negative feedback you have about it.
(b) If you know, which of the above-mentioned features are/aren't supported

编辑:
列出可能性很好,我会尽我所能,但如果你能在你的回答中包含它会更有帮助:
(a) 你是否真的使用过这个 GUI,如果是的话,您对此有何正面/负面反馈。
(b) 如果您知道,支持/不支持上述哪些功能

Lists are easy to come by, sites like this are great because you can get an idea of people's personal experiences with applications.

列表很容易找到,像这样的网站很棒,因为您可以了解人们对应用程序的个人体验。

采纳答案by Vicent Marti

You won't find anythingoverlaying GDB which can compete with the raw power of the Visual Studio debugger. It's just too powerful, and it's just too well integrated inside the IDE.

您不会发现任何覆盖 GDB 的东西可以与 Visual Studio 调试器的原始功能相抗衡。它太强大了,而且它在 IDE 中集成得很好。

For a Linux alternative, try DDD if free software is your thing.

对于 Linux 替代方案,如果您喜欢免费软件,请尝试 DDD。

回答by Allen

What can be stepped through is going to be limited by the debugging information that g++ produces, to a large extent. Emacs provides an interface to gdb that lets you control it via the toolbars/menus and display data in separate windows, as well as type gdb commands directly. Eclipse's CDT provides similar tools. I've heard of Anjuta and Code::Blocks but never used them.

可以单步执行的操作在很大程度上将受到 g++ 生成的调试信息的限制。Emacs 为 gdb 提供了一个接口,允许您通过工具栏/菜单控制它并在单独的窗口中显示数据,以及直接键入 gdb 命令。Eclipse 的 CDT 提供了类似的工具。我听说过 Anjuta 和 Code::Blocks,但从未使用过它们。

回答by user14636

Check out the Eclipse CDT project. It is a plugin for Eclipse geared towards C/C++ development and includes a fairly feature rich debugging perspective (that behind the scenes uses GDB). It is available on a wide variety of platforms.

查看 Eclipse CDT 项目。它是一个面向 Eclipse 的插件,面向 C/C++ 开发,包括一个功能相当丰富的调试视角(在幕后使用 GDB)。它可在各种平台上使用。

回答by mmattax

DDD is the GNU frontend for gdb: http://www.gnu.org/software/ddd/

DDD 是 gdb 的 GNU 前端:http: //www.gnu.org/software/ddd/

回答by Harold Ekstrom

KDevelop works pretty well.

KDevelop 工作得很好。

回答by Milan Babu?kov

Latest version of Geany supports it (only on Linux, though)

最新版本的 Geany 支持它(不过仅在 Linux 上)

回答by Milan Babu?kov

gdb -tui works okay if you want something GUI-ish, but still character based.

如果你想要一些 GUI 风格的东西,但仍然基于字符,gdb -tui 可以正常工作。

回答by Nick Bastin

I use DDD a lot, and it's pretty powerful once you learn to use it. One thing I would say is don't use it over X over the WAN because it seems to do a lot of unnecessary screen updates.

我经常使用 DDD,一旦你学会使用它,它就非常强大。我要说的一件事是不要在 WAN 上的 X 上使用它,因为它似乎做了很多不必要的屏幕更新。

Also, if you're not mated to GDB and don't mind ponying up a little cash, then I would try TotalView. It has a bit of a steep learning curve (it could definitely be more intuitive), but it's the best C++ debugger I've ever used on any platform and can be extended to introspect your objects in custom ways (thus allowing you to view an STL list as an actual list of objects, and not a bunch of confusing internal data members, etc.)

另外,如果您不与 GDB 合作并且不介意花一点钱,那么我会尝试 TotalView。它有一点陡峭的学习曲线(它肯定可以更直观),但它是我在任何平台上使用过的最好的 C++ 调试器,并且可以扩展为以自定义方式内省您的对象(因此允许您查看STL 列表作为对象的实际列表,而不是一堆令人困惑的内部数据成员等)

回答by Nick Bastin

As someone familiar with Visual Studio, I've looked at several open source IDE's to replace it, and KDevelop comes the closest IMO to being something that a Visual C++ person can just sit down and start using. When you run the project in debugging mode, it uses gdb but kdevelop pretty much handles the whole thing so that you don't have to know it's gdb; you're just single stepping or assigning watches to variables.

作为熟悉 Visual Studio 的人,我查看了几个开源 IDE 来替换它,而 KDevelop 是最接近 IMO 的东西,Visual C++ 人员可以坐下来开始使用。当您在调试模式下运行项目时,它使用 gdb,但 kdevelop 几乎可以处理整个事情,因此您不必知道它是 gdb;您只是单步执行或将手表分配给变量。

It still isn't as good as the Visual Studio Debugger, unfortunately.

不幸的是,它仍然不如 Visual Studio Debugger。

回答by Jon Ball

Eclipse CDT will provide an experience comparable to using Visual Studio. I use Eclipse CDT on a daily basis for writing code and debugging local and remote processes.

Eclipse CDT 将提供与使用 Visual Studio 相当的体验。我每天都使用 Eclipse CDT 来编写代码以及调试本地和远程进程。

If your not familiar with using an Eclipse based IDE, the GUI will take a little getting used to. However, once you get to understand the GUI ideas that are unique to Eclipse (e.g. a perspective), using the tool becomes a nice experience.

如果您不熟悉使用基于 Eclipse 的 IDE,GUI 需要一点时间来适应。然而,一旦您了解了 Eclipse 独有的 GUI 思想(例如透视图),使用该工具就会成为一种不错的体验。

The CDT tooling provides a decent C/C++ indexer that allows you to quickly find references to methods in your code base. It also provides a nice macro expansion tool and limited refactoring support.

CDT 工具提供了一个不错的 C/C++ 索引器,允许您快速找到对代码库中方法的引用。它还提供了一个很好的宏扩展工具和有限的重构支持。

With regards to support for debugging, CDT is able to do everything in your list with the exception of reading a core dump (it may support this, but I have never tried to use this feature). Also, my experience with debugging code using templates is limited, so I'm not sure what kind of experience CDT will provide in this regard.

关于对调试的支持,CDT 能够执行您列表中的所有操作,但读取核心转储除外(它可能支持此功能,但我从未尝试过使用此功能)。另外,我使用模板调试代码的经验有限,所以我不确定 CDT 会在这方面提供什么样的经验。

For more information about debugging using Eclipse CDT, you may want to check out these guides:

有关使用 Eclipse CDT 进行调试的更多信息,您可能需要查看以下指南: