4 ms·
Having come from a background of WinDbg (Windows) and DEBUG (DOS) before it, GDB feels very "unergonomic" in comparison. The general verbosity (why do you need
by userbinator 6y ago
Having come from a background of WinDbg (Windows) and DEBUG (DOS) before it, GDB feels very "unergonomic" in comparison. The general verbosity (why do you need an asterisk in front of an address when writing a breakpoint --- as the title of this site so prominently reminds?), lack of a regular hexdump command (16-byte hex+ASCII format) and the rather perplexing behaviour of the "disassemble" command (https://stackoverflow.com/questions/1237489/how-to-disassemble-a-memory-range-with-gdb https://stackoverflow.com/questions/1237489/how-to-disassemb...) are what comes to mind immediately.
WinDbg also lets you set the default base to 16, a feature whose usefulness is greatly appreciated when working with Asm: https://docs.microsoft.com/en-us/windows-hardware/drivers/debugger/n--set-number-base- https://docs.microsoft.com/en-us/windows-hardware/drivers/de...
GDB... makes an attempt: https://sourceware.org/bugzilla/show_bug.cgi?id=23390 https://sourceware.org/bugzilla/show_bug.cgi?id=23390
- PaulDavisThe1st 6y agogdb) watch my_ptr what does this mean? watch when the value at the address given by my_ptr changes, or watch when the value of my_ptr changes (i.e. it is modified to point to a different location) ? gdb) watch * my_ptr Ah ... now it's clear what is meant. gdb) watch 0xfeedface hmm, now 0xfeedface is not a variable but literally an address. But wait, is it? What does this mean? Watch the value at memory location 0xfeedface? But that's totally inconsistent with the semantics of "watch my_ptr". So, gdb) watch * 0xfeedface and once again, no ambiguity over what is going on and consistent syntax. As for you other complaints, I've been programming for about 33 years in C and C++, and I don't recall ever needing to use a hexdump inside the debugger or the disassemble command. Which is not to say that they're not important for some work, but they are also not important for all work.
- mhh__ 6y agoI think GDB is an example of a program which should've been designed around a kind of inverse Greenspun's tenth rule principle i.e. vague semantics and weird syntax so just build a lisp from the start to control it.
- mormegil 6y agoWasn't that _exactly_ the OP's point? That GDB is a fine C debugger but its logic and UX choices do not make much sense for debugging assembly code (e.g. there are no asterisks in assembly addresses, so no consistency there, etc.).
- secondcoming 6y ago> Ah ... now it's clear what is meant. Is it? I can't tell if your post has a sarcastic tone or not!
- PaulDavisThe1st 6y agonot sarcastic.
- tom_ 6y agoNames of locations in assembly language are typically constants, similar to global arrays in C. There's no my_ptr, as such; there's an address, and my_ptr is its name. When you watch my_ptr, you want to monitor what's at that address - ``watch *my_ptr'', in gdb terms. Not the end of the world, just annoying.
- PaulDavisThe1st 6y agoIt seems that people read my comment as sarcastic. It wasn't. I was trying to make the point you're making.
- trott 6y agoIf you can use DDD (which is an interface to GDB), it shows the disassembly.