223

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++?

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.

Specifically, I'm looking for a GUI that:

  • 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

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

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

Ciro Santilli OurBigBook.com
  • 347,512
  • 102
  • 1,199
  • 985
HappyDude
  • 2,566
  • 3
  • 18
  • 14
  • 22
    +1 for "Sites like this are great because you can get an idea of people's personal experiences." Too many people nowadays just do a list dump which IMHO completely misses the point. – kizzx2 Jun 11 '10 at 13:43
  • 1
    On reverse engineering: http://reverseengineering.stackexchange.com/questions/1392/decent-gui-for-gdb – Ciro Santilli OurBigBook.com Jul 10 '15 at 08:31
  • See also similar question: **[What is a good unix alternative to DDD (Data Display Debugger)?](https://stackoverflow.com/q/1206544)** – oHo Jul 07 '17 at 23:45
  • See this list of gdb front-ends here: https://sourceware.org/gdb/wiki/GDB%20Front%20Ends, and give the first one in the list a shot. Looks very promising and modern and is cross-platform since it's browser-based: https://www.gdbgui.com/. – Gabriel Staples Jun 23 '20 at 18:59

28 Answers28

88

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.

If you're 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.

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.

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.

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

Sean Bright
  • 118,630
  • 17
  • 138
  • 146
Jon Ball
  • 3,032
  • 3
  • 23
  • 24
79

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

  • 48
    You can also go into TUI (text user interface) mode while in gdb by using the '-' command. Returning to the command prompt is Ctrl-X Ctrl-A. While in TUI mode, up, down, left, and right move through the source. Use Ctrl-P, Ctrl-N, Ctrl-F, and Ctrl-B to navigate in the command line history. – Ben Combee Oct 25 '08 at 21:10
  • This is exactly what I was looking for. The power of the gdb command line with some useful views that update as I move around. – Kevin Cox Aug 13 '14 at 21:19
  • 8
    A .gdbinit on steriods gives you a really impressive character based GUI, with color: https://github.com/cyrus-and/gdb-dashboard – cs01 Sep 26 '16 at 00:16
  • I quite like [gdb-dashboard](https://github.com/cyrus-and/gdb-dashboard) but have to mention [voltron](https://github.com/snare/voltron) as well. – nonsensickle Feb 09 '17 at 10:39
  • 4
    @Barry thanks. For anyone curious, here is a link: https://github.com/cs01/gdbgui. It has data structure display similar to DDD, a client/server architecture to easily debug remote machines with no X forwarding necessary, and ability to explore complex variables, etc.. – cs01 Oct 25 '17 at 22:03
55

You won't find anything overlaying 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.

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

Aaron McDaid
  • 26,501
  • 9
  • 66
  • 88
Vicent Marti
  • 7,203
  • 6
  • 30
  • 34
  • gdb running under emacs is very good, and does not want for raw power. However it requires emacs skills. For someone who already uses emacs, then this answer is just wrong. For non-emacsers, it's probably about fair, although cgdb does something to mitigate the pain of command-line gdb. – John Lawrence Aspden Oct 25 '11 at 10:49
  • 2
    WinDBG is far superior than what Visual Studio provides. The visual studio debugger sits on top of the same architecture than WinDBG. With that said, GDB has nothing to ask when comparing it to Windbg. A graphical debugger that is better than DDD would be great. Eclipse CDT is a good alternative. I think there was a KDE UI – bigmonachus Feb 23 '12 at 02:12
  • 135
    Oh look. An answer that makes a claim without backing it up at all. I also find it odd that the answer which _does not answer the question_ was accepted. – alternative Mar 19 '12 at 22:29
  • 4
    for anyone coming here looking for a real answer, know that ddd is garbage. The best debugger GUI for Linux I have found is IDA, which is not free software. – bkconrad Feb 07 '13 at 18:04
  • 2
    Answer the question as best possible or don't say anything. Having used both, Visual Studio is more featured filled, but DDD is good enough that I don't miss VS. Sadly, DDD is showing its age. – Alan De Smet Feb 06 '14 at 20:33
  • 7
    This post needs to be updated/improved. Qt Creator is awesome, on par with Visual Studio. – vharron Jul 24 '14 at 03:13
  • What is this DDD you speak of? – starbeamrainbowlabs Nov 10 '17 at 10:23
  • Your answer is pretty old and I'm sure it was wrong even then. The visual studio debugger is pretty bad compared to, say, eclipse + gdb. – Clearer Mar 29 '18 at 12:48
  • 2
    @starbeamrainbowlabs Also known as Data Display Debugger, an old GNU GUI front end for GDB that might come handy sometimes, but looks like total crap and it has some irritating usability issues. https://www.gnu.org/software/ddd/ – SasQ Mar 09 '19 at 19:21
  • @alternative, don't be surprised; this happens _all the time_ on SO. It's by design, and the devs/fanboyz refuse to address the issue. The more useless the answer, the more they want it on the top of the page, and they'll never back down from their irrational position. I'm guessing the snack bar must be really great that high up in the clouds? – SO_fix_the_vote_sorting_bug Aug 17 '21 at 18:48
52

Check out Nemiver C/C++ Debugger. It is easy to install in Ubuntu (Developer Tools/Debugging).

Update: New link.

Sergey Shandar
  • 2,357
  • 18
  • 25
  • *Absolutely* *fabulous*, also supported with apt: 'apt-get install nemiver'. My only quibble is building from repo failed due to a ' No package gconf-2.0 found'. – J Evans Feb 05 '15 at 13:36
  • the interface is quite clear and good to read, but it crashes sometimes while using the interface capabilities v0.9.6. It also accepts debugged application parameters, what I still cant let ddd do. – Aquarius Power Jul 11 '18 at 16:05
  • Also available on Fedora 30 (at least). I just chanced on this question and nemiver. – user3236841 Oct 18 '19 at 18:10
32

Qt Creator seems like good stuff. A colleague showed me one way set it up for debugging:

  • Create a new project, "Import of Makefile-based Project".
  • Point it to your root project folder (it will index sources under it, and it is impressively fast).
  • Go to project settings and add a run configuration, then specify the executable you want to debug, and its arguments.
  • Qt Creator seems to insist on building your project before debugging it. If you don't want that, or don't use make, just go to projects -> build (Left panel), then, on the right panel in "Build Steps", remove all the steps, including the step by default when you created the project.

That may seem like a bit much work for debugging an app I had already compiled, but it is worth it. The debugger shows threads, stacks and local variables in a similar way to Visual Studio and even uses many of the same keyboard shortcuts. It seems to handle templates well, at least std::string and std::map. Attaching to existing processes and core dumps seems to be supported, though I haven't tested it yet.

Keep in mind that I used it for less than and hour now, but I'm impressed so far.

Robin Hsu
  • 174
  • 1
  • 9
Soulman
  • 2,910
  • 24
  • 21
30

I loathe the idea of Windows development, but the VC++ debugger is among the best I've seen. I haven't found a GUI front end that comes close to the VC one.

GDB is awesome once you really get used to it. Use it in anger enough and you'll become very proficient. I can whiz around a program doing all the things you listed without much effort anymore. It did take a month or so of suffering over a SSH link to a remote server before I was proficient. I'd never go back though.

DDD is really powerful but it was quite buggy. I found it froze up quite often when it got messages from GDB that it didn't grok. It's good because it has a gdb interface window so you can see what's going on and also interact with gdb directly. DDD can't be used on a remote X session in my environment (a real problem, since I'm sitting at a thin client when I do Unix dev) for some reason so it's out for me.

KDevelop followed typical KDE style and exposed EVERYTHING to the user. I also never had any luck debugging non KDevelop programs in KDevelop.

The Gnat Programming Studio (GPS) is actually quite a good front-end to GDB. It doesn't just manage Ada projects, so it's worth trying out if you are in need of a debugger.

You could use Eclipse, but it's pretty heavy weight and a lot of seasoned Unix people I've worked with (me included) don't care much for its interface, which won't just STFU and get out of your way. Eclipse also seems to take up a lot of space and run like a dog.

Adam Hawes
  • 5,439
  • 1
  • 23
  • 30
  • 2
    Just wanted to plug my project, gdbgui (https://github.com/cs01/gdbgui). It's a client/server architecture, so works well debugging remote machines without an X session required. It also has a terminal to directly interact w/ GDB, and has visuals to display data structures, similar to DDD. – cs01 Oct 25 '17 at 22:01
  • Comparisons with pros and cons based on experience. Just what this question needs. ty – Heath Raftery Apr 27 '19 at 07:01
29

I use cgdb, simple and usefull

cod
  • 390
  • 3
  • 5
16

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.

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.)

Nick Bastin
  • 30,415
  • 7
  • 59
  • 78
9

I used KDbg (only works under KDE).

codeguru
  • 1,851
  • 2
  • 15
  • 11
8

Similar comfortable to the eclipse gdb frontend is the emacs frontend, tightly tied to the emacs IDE. If you already work with emacs, you will like it:

GDB Emacs Frontend

Community
  • 1
  • 1
Johannes Schaub - litb
  • 496,577
  • 130
  • 894
  • 1,212
8

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.

user14636
  • 398
  • 5
  • 9
8

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

mmattax
  • 27,172
  • 41
  • 116
  • 149
6

Qt Creator-on-Linux is certainly on par with Visual Studio-on-Windows for C++ nowadays. I'd even say better on the debugger side.

Marv
  • 61
  • 1
  • 1
5

I've tried a couple of different guis for gdb and have found DDD to be the better of them. And while I can't comment on other, non-gdb offerings for linux I've used a number of other debuggers on other platforms.

gdb does the majority of the things that you have in your wish list. DDD puts a nicer front on them. For example thread switching is made simpler. Setting breakpoints is as simple as you would expect.

You also get a cli window in case there is something obscure that you want to do.

The one feature of DDD that stands out above any other debugger that I've used is the data "graphing". This allows you to display and arrange structures, objects and memory as draggable boxes. Double clicking a pointer will open up the dereferenced data with visual links back to the parent.

Andrew Edgecombe
  • 39,594
  • 3
  • 35
  • 61
  • Does ddd work on programs with arguments? I could not get it to pass the arguments... – user3236841 Oct 18 '19 at 18:12
  • If I remember correctly, DDD can give you a console window directly to GDB. In the GDB console you can set the command line arguments using the "set args xyz abc" command. – Andrew Edgecombe Oct 29 '19 at 06:05
5

There's one IDE that is missing in this list and which is very efficient (I've used it in many C/C++ projects without any issues): Netbeans.

Florent
  • 1,311
  • 1
  • 14
  • 15
  • 1
    I vastly prefer cgdb now that I've gotten used to it, but Netbeans was such a great stepping stone from VS. – zzxyz Feb 01 '18 at 20:16
3

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.

Allen
  • 5,034
  • 22
  • 30
3

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.

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

2

VisualGDB is another Visual Studio plugin to develop and debug applications on linux and embedded platforms.

Sergey Zhukov
  • 1,342
  • 1
  • 13
  • 24
2

Have you ever taken a look at DS-5 debugger?

There is a paid version which includes a lot of helpful features, but you can also use Community Edition for free (which is also quite useful especially for embedded systems).

I have a positive experience with this tool when debugging Android applications on real device using eclipse.

Viktor Malyi
  • 2,298
  • 2
  • 23
  • 40
  • [Link](https://developer.arm.com/products/software-development-tools/ds-5-development-studio/ds-5-debugger/overview) has expired. New ones [here](https://developer.arm.com/tools-and-software/embedded/legacy-tools/ds-5-development-studio). – parthasarathy Jul 14 '20 at 05:41
2

You don't mention whether you are using Windows or UNIX.

On UNIX systems, KDevelop is good but I use KDbg because it is easy to use and will also work with apps not developed in KDevelop.

Eclipse is good on both platforms.

On Windows, there is a great package called Wascana Desktop Developer which is Eclipse CDT and MinGW all packaged up and preconfigured nicely for the minimum of pain. Its the best thing I've found for developing GNU code on Windows.

I have used all these debuggers and none of them are as good as MS Dev Studio. Eclipse/Wascana is probably the closest but it does have limitations like you cannot step into DLLs and it doesn't do as good a job at examining variables.

Adam Pierce
  • 33,531
  • 22
  • 69
  • 89
2

The Code:Blocks C++ IDE has a graphical wrapper, with a few of the features you want, but nothing like the power of VS.

crobar
  • 2,810
  • 4
  • 28
  • 46
1

Have you tried gdb -w with cygwin gdb. It is supossed to have a windows interface which works fairly well.

The only problem I found is that on my present machine it didn't run that way until after I installed ddd. I suspect that it requires tcltk which was installed when I installed ddd.

BubbaT
  • 1,810
  • 4
  • 21
  • 24
1

KDevelop works pretty well.

Harold Ekstrom
  • 1,538
  • 8
  • 7
0

If you are looking for gdb under Visual Studio, then check WinGDB.

Dominic.wig
  • 314
  • 3
  • 5
0

In the last 15 months I use insight (came with FC6). It is not great, it is written in Tcl/Tk, but it is simple and useful. DDD is of similar quality / utility, but somewhat harder to use (various GUI gotchas and omissions). I also tried to integrate gdb with my IDE, SlickEdit. It worked OK (I played some 4 hours with it), but I did not like the GUI context switches. I like my IDE to remain unchanged while I am debugging; on Windows I use SlickEdit for IDE and Visual Studio Debugger for debugging. So from the 3: Insight, DDD and SlickEdit, Insight is my 1st choice, I use it >95% of the time, command-line gdb and DDD make up the other 5%. If I get the chance, I will eval Eclipse at some point, my work PC does not seem to have enough RAM (1GB only) to run Eclipse reasonably well.

I have also heard a lot of praise for TotalView, including 1st hand during a job interview. I obtained an eval for our company in late 2008, but in the end we did not proceed as gdb was good enough for our needs; and it is free and ubiquitous.

Radim Cernej
  • 875
  • 1
  • 10
  • 21
0

I was searching for a debugger to step through a running programm. Say: Attach. The programm was build with eclipse, but because of maybe some multithreadding obstrucles, no sourcefiles where fond. What ever.

I got very compfortable with NetBeans.

  • [debug] from menu -> Attach Deugger...
  • as process chose the one to debug
  • as project [new project]

Now the window disappars and you see nothing. detach from the process. The Read Square "Stop" helps.

  • import source from the project as e.g. folder. ".../MyProject/src
  • Now it appears in your project, and you can set breakpoints.
  • again ttach debugger
  • chose the process to debug.
  • debugger should stop if programm reaches next breakpoint.

Going to [window] -> [Debugging] -> Will your window make compfortable.

Cutton Eye
  • 3,207
  • 3
  • 20
  • 39
0

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

Milan Babuškov
  • 59,775
  • 49
  • 126
  • 179
0

Use www.zero-bugs.com/ Zero debugger, it requires C++0x support from gcc

siddhusingh
  • 1,832
  • 4
  • 25
  • 30