From 2d401b6f23f532604cb7999b18a07284dcf970ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20Benn=C3=A9e?= Date: Thu, 22 Feb 2018 10:00:51 -0500 Subject: [PATCH] qemu-log: new option -dfilter to limit output When debugging big programs or system emulation sometimes you want both the verbosity of cpu,exec et all but don't want to generate lots of logs for unneeded stuff. This patch adds a new option -dfilter which allows you to specify interesting address ranges in the form: -dfilter 0x8000..0x8fff,0xffffffc000080000+0x200,... Then logging code can use the new qemu_log_in_addr_range() function to decide if it will output logging information for the given range. Backports commit 3514552e04388d8e7686bcf89efd022e892acb5b from qemu --- qemu/include/qemu/log.h | 3 +++ qemu/qemu-log.c | 14 ++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/qemu/include/qemu/log.h b/qemu/include/qemu/log.h index 0d68e2e4..ceb442a4 100644 --- a/qemu/include/qemu/log.h +++ b/qemu/include/qemu/log.h @@ -123,4 +123,7 @@ static inline void qemu_log_close(void) } } +void qemu_set_dfilter_ranges(const char *ranges); +bool qemu_log_in_addr_range(uint64_t addr); + #endif diff --git a/qemu/qemu-log.c b/qemu/qemu-log.c index 39432fdb..4e9f38ee 100644 --- a/qemu/qemu-log.c +++ b/qemu/qemu-log.c @@ -34,3 +34,17 @@ void qemu_log(const char *fmt, ...) } va_end(ap); } + +/* Returns true if addr is in our debug filter or no filter defined + */ +bool qemu_log_in_addr_range(uint64_t addr) +{ + // Unicorn: stubbed + return true; +} + + +void qemu_set_dfilter_ranges(const char *filter_spec) +{ + // Unicorn: stubbed +}