3 ms·
Beej's Quick Guide to GDB (2009)
- the-smug-one 3y agoI 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?
- tcoff91 3y agoCLion is definitely good.
- BaculumMeumEst 3y agoVS 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.
- NextHendrix 3y agoHave you tried the Emacs gdb mode?
- dannymi 3y agoI wrote https://github.com/daym/idea-native2-debugger 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 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.
- monocasa 3y agoI'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.html https://sourceware.org/gdb/current/onlinedocs/gdb.html/TUI.h...
- spicynoodles 3y agoI think gdbgui [0] is useful. I'm not sure about its performance though. [0] https://www.gdbgui.com/ https://www.gdbgui.com/
- GuB-42 3y agoQt 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).
- fsociety 3y agoSounds like you want a full UI, but GEF is quite good for making GDB pleasant to use.
- i15e 3y agogf2 is worth looking at: https://github.com/nakst/gf https://github.com/nakst/gf
- the-smug-one 3y agoWow! I just tried it out, and that was like a dream come true. Thank you for linking this.
- amadvance 3y agoIf you need something text based, cgdb is nice: http://cgdb.github.io/ http://cgdb.github.io/
- hegzploit 3y agoThere is also GEF, which is widely used by the reverse engineering and CTF community. https://github.com/hugsy/gef https://github.com/hugsy/gef
- matheusmoreira 3y agoThank 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...
- b5n 3y ago> 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
- 01100011 3y agoOne 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.
- jaredsohn 3y agoChatGPT might work well for this.
- 01100011 3y agoFunny 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.
- jaredsohn 3y agoMake 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.
- 01100011 3y agoI think it was gpt3 at the time. I just tried 4 and it got it right!
- alberth 3y agoBeej has lots of great guides, check them out: https://beej.us/guide/ https://beej.us/guide/ Everyone knows the networking guide, but Beej also has: C, UNIX, Python, and many more.
- deleted 3y ago[deleted]
- BirAdam 3y agoFor 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.
- andrewflnr 3y agoVery 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.
- arun-mani-j 3y agoAwesome guide :) I these days use coredumpctl with gdb to debug seg faults. So if a program crashes, I simply do: $ coredumpctl debug Now it launches gdb (or your default debugger) on the latest core dump. Then I use `bt` and others to debug the issue. https://www.freedesktop.org/software/systemd/man/latest/coredumpctl.html https://www.freedesktop.org/software/systemd/man/latest/core...
- zzixp 3y agoThis guide is the only reason I passed my school's version of CMU's CS:APP (malloc) Huge shoutout to Beej!
- monlockandkey 3y agoAnyone know which is "better", GDB or LDB?
- blux 3y agoI didn't know about `jump`, that is super useful.
- bbths 3y ago[flagged]
- T3RMINATED 3y ago[dead]
- aoetalks 3y agoBeej’s guide for networking really saved me: https://beej.us/guide/bgnet/ https://beej.us/guide/bgnet/ I continue to find that knowledge useful in my day job working on distributed systems.