From fa145ae40175ba19cc82385450af3e1df2aca897 Mon Sep 17 00:00:00 2001 From: MerryMage Date: Sun, 21 Jun 2020 16:23:01 +0100 Subject: [PATCH] a32_unicorn: Print code on unicorn error --- tests/unicorn_emu/a32_unicorn.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/unicorn_emu/a32_unicorn.cpp b/tests/unicorn_emu/a32_unicorn.cpp index 3d71d9a9..f7501913 100644 --- a/tests/unicorn_emu/a32_unicorn.cpp +++ b/tests/unicorn_emu/a32_unicorn.cpp @@ -43,7 +43,10 @@ void A32Unicorn::Run() { // Thumb execution mode requires the LSB to be set to 1. constexpr u64 pc_mask = std::is_same_v ? 0 : 1; while (testenv.ticks_left > 0) { - CHECKED(uc_emu_start(uc, GetPC() | pc_mask, END_ADDRESS, 0, 1)); + const u32 pc = GetPC() | pc_mask; + if (auto cerr_ = uc_emu_start(uc, pc, END_ADDRESS, 0, 1)) { + ASSERT_MSG(false, "uc_emu_start failed @ {:08x} (code = {:08x}) with error {} ({})", pc, testenv.MemoryReadCode(pc), cerr_, uc_strerror(cerr_)); + } testenv.ticks_left--; if (!testenv.interrupts.empty() || testenv.code_mem_modified_by_guest) { return;