On Tue, Aug 05, 2025 at 12:19:26PM +0300, Manos Pitsidianakis wrote: > Add a backtrace_on_error meson feature (enabled with > --enable-backtrace-on-error) that compiles system binaries with > -rdynamic option and prints a function backtrace on error to stderr. > > Example output by adding an unconditional error_setg on error_abort in > hw/arm/boot.c: > > ./qemu-system-aarch64(+0x13b4a2c) [0x55d015406a2c] > ./qemu-system-aarch64(+0x13b4abd) [0x55d015406abd] > ./qemu-system-aarch64(+0x13b4d49) [0x55d015406d49] > ./qemu-system-aarch64(error_setg_internal+0xe7) [0x55d015406f62] > ./qemu-system-aarch64(arm_load_dtb+0xbf) [0x55d014d7686f] > ./qemu-system-aarch64(+0xd2f1d8) [0x55d014d811d8] > ./qemu-system-aarch64(notifier_list_notify+0x44) [0x55d01540a282] > ./qemu-system-aarch64(qdev_machine_creation_done+0xa0) [0x55d01476ae17] > ./qemu-system-aarch64(+0xaa691e) [0x55d014af891e] > ./qemu-system-aarch64(qmp_x_exit_preconfig+0x72) [0x55d014af8a5d] > ./qemu-system-aarch64(qemu_init+0x2a89) [0x55d014afb657] > ./qemu-system-aarch64(main+0x2f) [0x55d01521e836] > /lib/x86_64-linux-gnu/libc.so.6(+0x29ca8) [0x7f3033d67ca8] > /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0x85) [0x7f3033d67d65] > ./qemu-system-aarch64(_start+0x21) [0x55d0146814f1] > > Unexpected error in arm_load_dtb() at ../hw/arm/boot.c:529:
>From an end-user POV, IMHO the error messages need to be good enough that such backtraces aren't needed to understand the problem. For developers, GDB can give much better backtraces (file+line numbers, plus parameters plus local variables) in the ideally rare cases that the error message alone has insufficient info. So I'm not really convinced that programs (in general, not just QEMU) should try to create backtraces themselves. With regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|