diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2018-07-21 05:03:46 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2018-07-24 18:15:17 +0200 |
commit | 3b2c7056e82ff584ae5195e3badbfe9814a50642 (patch) | |
tree | 3bf29d8325bbb8b20f39fcf70b1313b6cf938117 /src | |
parent | 42af90b5fa44c984b1b1c55da79e9f42ff20376f (diff) |
qemu: show log if process crashes
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/tests/qemu/init.c | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/src/tests/qemu/init.c b/src/tests/qemu/init.c index 8d783e9..7db1d4b 100644 --- a/src/tests/qemu/init.c +++ b/src/tests/qemu/init.c @@ -111,17 +111,23 @@ static void enable_logging(void) int fd; pretty_message("[+] Enabling logging..."); fd = open("/proc/sys/kernel/printk", O_WRONLY); - if (fd < 0) - panic("open(printk)"); - if (write(fd, "9\n", 2) != 2) - panic("write(printk)"); - close(fd); + if (fd >= 0) { + if (write(fd, "9\n", 2) != 2) + panic("write(printk)"); + close(fd); + } + fd = open("/proc/sys/debug/exception-trace", O_WRONLY); + if (fd >= 0) { + if (write(fd, "1\n", 2) != 2) + panic("write(exception-trace)"); + close(fd); + } fd = open("/proc/sys/kernel/panic_on_warn", O_WRONLY); - if (fd < 0) - return; /* < 3.18 doesn't have it */ - if (write(fd, "1\n", 2) != 2) - panic("write(panic_on_warn)"); - close(fd); + if (fd >= 0) { + if (write(fd, "1\n", 2) != 2) + panic("write(panic_on_warn)"); + close(fd); + } } static void kmod_selftests(void) |