36

I am developing c on linux using vim and debugging using ddd. However I find that ddd performs very poorly at scrolling on this machine so its sometimes very frustrating to use.

I like the way that ddd maps fairly closely to the gdb command set as this means I am free to use gdb commands when I choose, but using gdb itself is not an option as it does not do a great job of displaying the source.

Can anybody suggest a decent alternative to ddd? I am not looking for an IDE, merely a reasonably well implemented gui facade to gdb that is free software.

sth
  • 222,467
  • 53
  • 283
  • 367
frankster
  • 1,529
  • 2
  • 16
  • 20
  • I tried Nemiver but if you click stop, it pops up a dialog box that says "Target received a signal: SIGINT, Interrupt" which you are obliged to click. This pretty much rules out that interface for me. – frankster Jul 30 '09 at 14:14
  • 1
    And the tooltips take about 1/3 of a second too long to pop up when you mouse over a variable you wish to view. – frankster Jul 30 '09 at 14:39
  • I've settled on gdb text ui mode (accessible via ctrl-a, ctrl-x) but I don't find this fully satisfactory. – frankster Jul 18 '16 at 11:11
  • 1
    Here's a good list of options https://sourceware.org/gdb/wiki/GDB%20Front%20Ends – cambunctious Jan 10 '17 at 16:06

9 Answers9

8

KDbg (http://www.kdbg.org/)

Adrian Panasiuk
  • 7,249
  • 5
  • 33
  • 54
  • First impressions: The opensuse11 package is buggy and the icon it installs doesn't launch the app, but I can launch it myself from /opt/kde3/bin/kdbg. Attaching to a process forces you to type the process number instead of searching the process list for a process with the same name as the binary you just loaded – frankster Jul 30 '09 at 14:50
  • The variable display in KDbg is nice. – frankster Jul 30 '09 at 15:01
  • though on the other hand, it seems like a bit of a pain to view the values of expressions such as "Array[Index].Struct.Member" – frankster Jul 30 '09 at 15:25
  • its a bit annoying having to break execution in order to disable a breakpoint – frankster Jul 30 '09 at 15:45
  • and if you want to detach from a process it seems you have to force it by loading a different file – frankster Jul 30 '09 at 16:58
  • double clicking on a breakpoint in the breakpoint list doesn't take you to the corresponding line of code – frankster Aug 03 '09 at 17:04
8

Well I tend to use either cgdb, kgdb or ddd. (and since you can't use ddd...)

cgdb is almost like the normal gdb but it shows the code in a split window above.

Johan
  • 20,067
  • 28
  • 92
  • 110
7

I use Eclipse CDT in my daily basis as well as Visual Studio and it is very good tool, as good as Visual Studio. It uses all the Eclipse infrastructure to create a very good gdb graphical interface. Is like debugging Java but with C++.

If you don't want to generate eclipse projects just for debugging because you still want to use vim as an editor you might want to know that Cmake has eclipse project generator. Some links that might help you regarding this issue: 1, 2, 3

javier-sanz
  • 2,504
  • 23
  • 23
  • 3
    Actually, you can define a gdb session in Eclipse w/o a project. Just define the program in the "Debug Configurations..." dialog, possibly using the "C/C++ Application" configuration selection. After filling the "C/C++ Application:" entry, and possibly the "Arguments" tab, click on the "Apply" and "Debug" buttons to get to the debug perspective. – ysap Sep 16 '13 at 20:22
  • 1
    No need to give up vim when using Eclipse. I use the [Vrapper](http://vrapper.sourceforge.net/home/) Eclipse plugin which gives a reasonable amount of vi goodness. – Brent Faust Dec 18 '13 at 09:06
5

Have you looked at the Emacs GDB integration? It's quite good, once you work out how to use it. Here's a screenshot: http://p.blog.csdn.net/images/p_blog_csdn_net/ariesjzj/pic3.jpg.

Alternatively, there's Eclipse. It's very pretty, and seems pretty comprehensive but I haven't used it much.

Failing that, I just use GDB in TUI mode (type 'layout next' lots of times until the display looks 'prettier').

I actually really miss Visual Studio now that I'm stuck developing for Linux and embedded systems.

DaveS
  • 491
  • 3
  • 11
  • aha I didn't know about this TUI mode of gdb. Its not great but it certainly addresses to some extent my gripe about gdb not displaying the source very well. – frankster Aug 07 '09 at 10:56
  • I just type layout - it gives an error but ends up with the layout most useful to me :D – frankster Sep 23 '09 at 13:19
  • +1 because it works in the console. So I can record my sessions with ttyrec, and share them with byobu/screen. – matiu Jun 24 '13 at 02:02
4

gdbgui

gdbgui is a browser-based frontend to gdb, the gnu debugger. You can add breakpoints, view stack traces, and more in C, C++, Go, and Rust!

It's perfect for beginners and experts. Simply run gdbgui from the terminal to start the gdbgui server, and a new tab will open in your browser.

https://github.com/cs01/gdbgui/raw/master/screenshots/gdbgui_animation.gif

sailfish009
  • 2,561
  • 1
  • 24
  • 31
3

You might like: insight - Redhat's debugger based on gdb

These tools also have gui's:

Sun Studio Debugger

I haven't used the Sun Studio Debugger in a while, but it used to have it's own version of gvim and emacs where you could actually set breakpoints by clicking next to the source code.

Intel Debugger

And I think Eclipse has debugger integration.

And I think that most of these tools are still free, but not necessarily open source.

Juan
  • 3,667
  • 3
  • 28
  • 32
  • as an additional note, the old version of Sun Studio on Linux used the gcc compiler with gdb. I don't know if it is still compatible as they now ported their compilers to Linux. – Juan Jul 30 '09 at 13:58
  • Insight's attach to process window is buggy - the filter box does nothing. However at least it puts up a process list which is a slight improvement on kdbg. – frankster Aug 04 '09 at 07:47
  • The drop down box with a list of functions to browse to in the source is a nice touch. – frankster Aug 04 '09 at 07:53
  • twice brought down my x server when I attached to a process, continued the process then attempted to pause the process. I can rule Insight out. – frankster Aug 04 '09 at 07:59
  • From what I can see, the Intel Debugger is available with the Intel Compiler but you can only get a zero-cost license for non-commercial use. – frankster Aug 04 '09 at 08:32
  • Sun Studio debugger (dbxtool) is based on java so its startup is rather slow. – frankster Aug 04 '09 at 10:14
  • Stun Studio debugger successfully pops up a tooltip with the value when you mouseover variables of the form Array[Index].Struct.Member, which none of the other GUIs have been able to. (of course GDB can always do this with a print command but for some reason none of the GUIs have implemented support for this). – frankster Aug 05 '09 at 12:13
  • Overall, I like a lot of things about dbxtool but the java-lagginess is such a shame. – frankster Aug 05 '09 at 15:37
  • having problems with dbxtool on a 64-bit environment - dbx itself will load a 64-bit executable, but when I load the executable via dbxtool, it gives an unsupported architecture error, presumably because its trying to load it into the 32-bit version of dbx – frankster Aug 13 '09 at 10:46
  • Insight is dead. I even tried to build but I didn't succed. – tuket Feb 09 '15 at 19:25
2

you could try xxgdb but it's very old, i don't even know if it's still mantained

fnurglewitz
  • 2,097
  • 14
  • 21
2

Unfortunately I haven't tried anything but GDB and DDD, but there's a list of GDB front-ends on Wikipedia, including KDbg and xxgdb as recommended by others, but several more. Perhaps one of those will work for you while still giving you the ability to use GDB commands when you want to. In particular, it lists Clewn (I keep meaning to try that out), which uses GVim as a front-end as well as cgdb, which runs in the terminal (using ncurses), has vi-style keys and shows syntax-highlighted source.

Cascabel
  • 479,068
  • 72
  • 370
  • 318
2

Don't give up on DDD completely. I agree that the interface needs a major overhaul, but there were some rumblings back in 2007 for a GTK overhaul.

Also, keep an eye on this as well.

supercheetah
  • 3,200
  • 4
  • 25
  • 38
  • This is kind of not useful today (even thou I give you +1 for the fact that there is hope for ddd ;) – Johan Aug 01 '09 at 08:54
  • Looks like they may have been hope in 2009, but in 2016, a DDD overhaul looks rather hopeless.. – Atif Aug 10 '16 at 13:55
  • ddd was built using ancient technology. Let it rest in peace. The effort of reviving it is probably greater than building a new one. And in its current form it can still be useful on very small systems. – EvertW Sep 11 '19 at 14:04