will continue as normal. Note that comment (3) above re passing
signals applies here too.
+The default build of Valgrind uses "-g -O2". This is OK most of the
+time, but with sophisticated optimization it can be difficult to
+see the contents of variables. A quick way to get to see function
+variables is to temporarily add "__attribute__((optnone))" before
+the function definition and rebuild. Alternatively modify
+Makefile.all.am and remove -O2 from AM_CFLAGS_BASE. That will
+require you to reconfigure and rebuild Valgrind.
Self-hosting
~~~~~~~~~~~~
//
// Maybe on FreeBSD the pointer to argc is 16byte aligned and can be 8 bytes above the
// start of the stack?
+//
+// Some answers to this mystery here
+// https://forums.freebsd.org/threads/stack-alignment-argc-location-in-assembled-binaries.89302/#post-613119
+// and here
+// https://github.com/freebsd/freebsd-src/blob/releng/5.1/sys/amd64/amd64/machdep.c#LL487C1-L488C42
asm("\n"
".text\n"
------------------------------------------------------------------ */
/* Run a thread all the way to the end, then do appropriate exit actions
- (this is the last-one-out-turn-off-the-lights bit). */
+ * (this is the last-one-out-turn-off-the-lights bit).
+ *
+ * This is marked as __attribute__((noreturn)). That has the effect of
+ * making clang++ no longer emit the function prologue and epilogue
+ * to save the base pointer.
+ *
+ * As far as I can tell clang -O2 does not include -fomit-frame-pointer
+ * However, since from here on the saved base pointer values are
+ * junk tools like FreeBSD pstack that only rely on base pointer
+ * walking will not work. FreeBSD bstack does work, based on GDB and
+ * reading debuginfo.
+ *
+ * If you really need a working base pointer modify Makefile.all.am
+ * and add -fno-omit-frame-pointer to AM_CFLAGS_BASE.
+ */
__attribute__((noreturn))
static void run_a_thread_NORETURN ( Word tidW )
{