Skip to content

Stack trace (aka backtrace) in crash logs

Alex requested to merge branch/backtrace into branch/unified

Cherry-picked from the qemu branch. Some unit tests are available there.

To test:

extern void * _AllocateMemory(int);
static void run_test()
    /* this will fail with ERR70 => should trigger a crash log */
    void * ptr = _AllocateMemory(5 * 1024 * 1024);

    /* do something with "ptr" to prevent a tail call */
    printf("%x\n", ptr);

More info:

Memory usage: 1536 bytes = 0x7f9f4 - 0x7f3f4 (MemSiz 500D); 1280 without BKT_BRUTE_FORCE_STACK. From those, 256 bytes are from the increased buffer size in assert_msg.

Update: enabled the fault emulations in the selftest module, so there are two ways to test this directly from menu:

  • Debug -> Fault emulation -> Allocate 1MB of system RAM (click a few times)
  • Debug -> Fault emulation -> Allocate 10MB of RAM, then develop a CR2 from the playback menu (will show the example from the forum thread).

Or, of course, reproduce some ML bug that triggers an assertion - that would also show a stack trace.


  • script for creating a human-readable trace (example on the forum)
  • address to name mapping for modules (how?)
  • include this in QEMU (if only to start a test suite for nightly builds)

Who's going to help with that? :D

Merge request reports