Beej is the man. I liked his networking guide.
Beej's Quick Guide to GDB (2009)
21–29 of 29 posts
Re: Beej's Quick Guide to GDB (2009)
#22Earlier quoted context omitted.
The manual is worth a read. This is a software (as gcc) in which the "man" page or the information displayed with "--help" is not near the bunch of things there are described in the complete documentation.
(for those who don't know, the full manual can be read with `info gdb` - `man gdb` is only a short help)
Re: Beej's Quick Guide to GDB (2009)
#23Looks like a great guide. If people are interested in something similar, here's one I wrote recently http://www.brendangregg.com/blog/2016-08-09/gdb-example-ncur...
Re: Beej's Quick Guide to GDB (2009)
#24I'll preface this by saying that I don't have that much C or C++ experience. Now on to the topic of debugging em: I'd suggest trying out lldb [0] as an alternative to gdb. In general it has more sensible commands [1] and it can be scripted with python. If you're willing to pay, CLion [2] is amazing and it includes an interactive debugger [3] which, IMO, completely blows away these CLI tools. [0] https://lldb.llvm.org…
In general it has more sensible commands I completely disagree (and I don't think GDB's command set is all that great either); the page you linked shows that LLDB's commands are even longer, which is extremely annoying when you're forced to use it for any length of time. Getting a good standard hexdump out of either is a pain too, and LLDB has this ridiculously stupid arbitrary limit of 1024 bytes to display each com…
Where? In almost all cases, LLDB has an alias for the GDB command.
Re: Beej's Quick Guide to GDB (2009)
#25Looks like a great guide. If people are interested in something similar, here's one I wrote recently http://www.brendangregg.com/blog/2016-08-09/gdb-example-ncur...
My own debugging with gdb summary: http://www.pixelbeat.org/programming/debugger/
Re: Beej's Quick Guide to GDB (2009)
#26Re: Beej's Quick Guide to GDB (2009)
#27His networking and IPC guides are also one of the sole reasons I managed to pass my 3rd year operating systems paper. From memory we were actually recommended to use his networking guide instead of any particular textbook.
Re: Beej's Quick Guide to GDB (2009)
#28Watches are incredibly useful. I remember struggling with a bug, wasted days or even weeks on it. Then during lunch an older more experience engineer told me to use watchpoints, and just like that I could see the trace of what was writing over that particular memory address and the problem was solved. It's like in the movies where the master utters some cryptic koan and the struggling apprentice is suddenly enlightened.
Speaking of corrupted memory, another command to add is "x" it stands for "examine memory" and it does just that. Then after examining the memory, for fun, set a watchpoint to see what code ends writing or reading from it.
Re: Beej's Quick Guide to GDB (2009)
#29I'll preface this by saying that I don't have that much C or C++ experience. Now on to the topic of debugging em: I'd suggest trying out lldb [0] as an alternative to gdb. In general it has more sensible commands [1] and it can be scripted with python. If you're willing to pay, CLion [2] is amazing and it includes an interactive debugger [3] which, IMO, completely blows away these CLI tools. [0] https://lldb.llvm.org…
How is CLion for embedded work these days? If I have, say, an ARM GDB server running, can I use that with CLion's debugger?
https://blog.jetbrains.com/clion/2017/12/clion-for-embedded-...