32 comments

[ 3.2 ms ] story [ 83.7 ms ] thread
I wish that there was a performant and useful front end to GDB for Linux. There isn't, so I'm stuck using GDB manually. Maybe CLion is good?
CLion is definitely good.
VS Code has been sufficient for me, at least for hobby stuff. I used it solely as a debugger before I switched over to using it as an editor as well.
I wrote https://github.com/daym/idea-native2-debugger as a stop-gap. It uses gdb and works in IntelliJ IDEA Community edition. Setting it up the first time is kinda weird since you need to add a new run/debug configuration "Native2Debugger". I could not figure out how to hook this directly into the existing run configuration that you use to run your program to begin with. Otherwise, I like how it turned out.

If you want a standalone frontend instead, https://github.com/epasveer/seer is extremely good.

And emacs has gdb integration. By now I tried it, and... I guess it's better than nothing.

I'll preface this with 'it might not be what you're looking for, but I've found useful in this space', but gdb has multiple interfaces built in to the normal binary. It's not just the raw gdb command prompt, but it has a pretty nice curses mode that'll display registers, asm, source with breakpoints, etc. that you expect from a debugger interface. It's very much a hidden gem of gdb.

https://sourceware.org/gdb/current/onlinedocs/gdb.html/TUI.h...

Qt Creator is not terrible. I've yet to come across a GDB front-end I would qualify as "good".

It is a full IDE for writing Qt apps, but it also works for non-Qt applications in C or C++ (cmake recommended), and it has some of the best GDB integration. It is also free (GPLv3).

Sounds like you want a full UI, but GEF is quite good for making GDB pleasant to use.
Thank you so much. I didn't know about layouts at all! The source code and disassembly layout is amazing and it's exactly what I want to see when I launch a debugger. I wonder why it's not the default. GDB has a huge number of features but it's quite hard to use. That'd go a long way towards making it easier.

Is there's a data structure explorer panel? I went to rather insane lengths to develop pretty printing scripts for my data structures. It's got support for 3 scripting languages: Python, Guile Scheme and its very own GDB command file language. The first two require libc. My project was freestanding so I had to parse bits and bytes with GDB's arcane syntax. A proper structure visualizer would be so helpful...

> I wonder why it's not the default.

You can toss something like this in ~/.config/gdb/gdbinit:

  tui new-layout default regs 1 {-horizontal src 1 asm 1} 2 status 0 cmd 1
  tui layout default
  tui enable
One thing I think is sorely lacking is approachable documentation for writing python extensions to GDB.

I've managed to cobble together a collection of data structure explorers written in Python but it is barely an improvement over straight gdb scripting due to the way all structs end up as dictionaries. Some higher level libraries for inspection might be nice. Automatic integration with something like graphviz would be amazing. For instance, it would be cool to just describe my data structure(specifying 'next' pointers or how to access edge lists for a graph) and just have a library dump a visual representation for me. That said, I wonder if half of that logic is best left in a debug module inside the application or library where it remains more tightly coupled to the actual layout.

ChatGPT might work well for this.
Funny you say that. Literally the first thing I tried to get ChatGPT to do for me was to give me an example gdb extension written in Python. It hallucinated badly and as I pushed it, it produced increasingly erroneous errors. That was about 6-8 months ago though. It might be better now.
Make sure you try gpt4 if you didn't.

I've had partial success in getting gpt4 to write rubocop cops (i.e. custom linting rules for ruby). I had to iterate a bit but eventually got something working and wouldn't have tried if I didn't have gpt helping me.

I think it was gpt3 at the time. I just tried 4 and it got it right!
3 is unusable and mostly just a curiosity. 4 is scary smart.

There's 3 years between them. Bit worried about 2026.

Beej has lots of great guides, check them out:

https://beej.us/guide/

Everyone knows the networking guide, but Beej also has: C, UNIX, Python, and many more.

(comment deleted)
For some reason, I initially read the title as “…Guide to PBJ” and I got really excited about a potential guide to better indulgent sandwiches… but nope.
Very lightly toasting the bread makes them tastier. That's just a general sandwich tip, really. But with a PBJ you want it to stay soft enough that the filling doesn't squeeze out the side.
This guide is the only reason I passed my school's version of CMU's CS:APP (malloc)

Huge shoutout to Beej!

I didn't know about `jump`, that is super useful.
[flagged]