Two handy GDB breakpoint tricks

232 · Christopher Wellons · Jan. 28, 2024, 10:32 p.m.
Over the past couple months I’ve discovered a couple of handy tricks for working with GDB breakpoints. I figured these out on my own, and I’ve not seen either discussed elsewhere, so I really ought to share them. Continuable assertions The assert macro in typical C implementations leaves a lot to be desired, and so I’ve suggested alternative definitions that behave better under debuggers: #define assert(c) while (!(c)) __builtin_trap() #define assert(c) while (!(c)) __builtin_unreachable() #de...