C/C++ software development

(think I had a list of flags in my twitter - move here)

there are a bunch of GCC instrumentation flags - some fairly recent - that can make working with C/C++ a way more ergonomic experience. I use AddressSanitizer/LeakSanitizer/UBSan, -fsanitize=address -fsanitize=undefined -fsanitize=leak (maybe + -g -fno-omit-frame-pointer ) religiously - makes these lovely verbose runtime errors when I do silly things.

To get more accurate stack traces, it is possible to use options such as -O0, -O1, or -Og (which, for instance, prevent most function inlining), -fno-optimize-sibling-calls (which prevents optimizing sibling and tail recursive calls; this option is implicit for -O0, -O1, or -Og), or -fno-ipa-icf (which disables Identical Code Folding for functions). Since multiple runs of the program may yield backtraces with different addresses due to ASLR (Address Space Layout Randomization), it may be desirable to turn ASLR off. On Linux, this can be achieved with ‘setarch uname -m -R ./prog’.