aboutsummaryrefslogtreecommitdiff
path: root/include/sysemu
diff options
context:
space:
mode:
authorPhil Dennis-Jordan <phil@philjordan.eu>2024-06-05 13:25:56 +0200
committerPaolo Bonzini <pbonzini@redhat.com>2024-06-08 10:33:38 +0200
commita3c67dfc140018626f21ee507a726151cdb95ce3 (patch)
treefec8ba9ace2e44b010af5f702c64454292a31b67 /include/sysemu
parenta59f5b2f83d4de113556e5b68cbd68c03f712679 (diff)
downloadqemu-a3c67dfc140018626f21ee507a726151cdb95ce3.zip
qemu-a3c67dfc140018626f21ee507a726151cdb95ce3.tar.gz
qemu-a3c67dfc140018626f21ee507a726151cdb95ce3.tar.bz2
hvf: Makes assert_hvf_ok report failed expression
When a macOS Hypervisor.framework call fails which is checked by assert_hvf_ok(), Qemu exits printing the error value, but not the location in the code, as regular assert() macro expansions would. This change turns assert_hvf_ok() into a macro similar to other assertions, which expands to a call to the corresponding _impl() function together with information about the expression that failed the assertion and its location in the code. Additionally, stringifying the numeric hv_return_t code is factored into a helper function that can be reused for diagnostics and debugging outside of assertions. Signed-off-by: Phil Dennis-Jordan <phil@philjordan.eu> Message-ID: <20240605112556.43193-8-phil@philjordan.eu> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'include/sysemu')
-rw-r--r--include/sysemu/hvf_int.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/include/sysemu/hvf_int.h b/include/sysemu/hvf_int.h
index 30e739a..5b28d17 100644
--- a/include/sysemu/hvf_int.h
+++ b/include/sysemu/hvf_int.h
@@ -60,7 +60,10 @@ struct AccelCPUState {
bool dirty;
};
-void assert_hvf_ok(hv_return_t ret);
+void assert_hvf_ok_impl(hv_return_t ret, const char *file, unsigned int line,
+ const char *exp);
+#define assert_hvf_ok(EX) assert_hvf_ok_impl((EX), __FILE__, __LINE__, #EX)
+const char *hvf_return_string(hv_return_t ret);
int hvf_arch_init(void);
int hvf_arch_init_vcpu(CPUState *cpu);
void hvf_arch_vcpu_destroy(CPUState *cpu);