Made generated prettyasserts more debuggable

The main star of the show is the adoption of __builtin_trap() for
aborting on assert failure. I discovered this GCC/Clang extension
recently and it integrates much, _much_ better with GDB.

With stdlib's abort(), GDB drops you off in several layers of internal
stdlib functions, which is a pain to navigate out of to get to where the
assert actually happened. With __builtin_trap(), GDB stops immediately,
making debugging quick and easy.

This is great! The pain of debugging needs to come from understanding
the error, not just getting to it.

---

Also tweaked a few things with the internal print functions to make
reading the generated source easier, though I realize this is a rare
thing to do.
This commit is contained in:
Christopher Haster
2024-02-14 01:01:37 -06:00
parent 06a360462a
commit 1422a61d16
5 changed files with 25 additions and 38 deletions
+1
View File
@@ -20,6 +20,7 @@
#include <stdio.h>
#include <unistd.h>
#include <execinfo.h>
#include <signal.h>
#include <time.h>
+1
View File
@@ -21,6 +21,7 @@
#include <unistd.h>
#include <time.h>
#include <execinfo.h>
#include <signal.h>
// some helpers