selftest: Improve gdb_backtrace to run in batch mode