diff mbox series

[v5,07/31] target/arm: Use cpu_abort in assert_hflags_rebuild_correctly

Message ID 20210419202257.161730-8-richard.henderson@linaro.org
State New
Headers show
Series target/arm: enforce alignment | expand

Commit Message

Richard Henderson April 19, 2021, 8:22 p.m. UTC
Using cpu_abort takes care of things like unregistering a
SIGABRT handler for user-only.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>

---
 target/arm/helper.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

-- 
2.25.1

Comments

Peter Maydell April 20, 2021, 9:07 a.m. UTC | #1
On Mon, 19 Apr 2021 at 21:36, Richard Henderson
<richard.henderson@linaro.org> wrote:
>

> Using cpu_abort takes care of things like unregistering a

> SIGABRT handler for user-only.


I would find this argument more persuasive if we didn't have a
ton of other places where we call abort() or assert() or
g_assert_not_reached(). Either we should have a consistent
mechanism for assertions in linux-user turning off the SIGABRT
handler, or we should just not worry about it on the basis that it's
a "can't happen" error anyway...

thanks
-- PMM
diff mbox series

Patch

diff --git a/target/arm/helper.c b/target/arm/helper.c
index 4aa7650d3a..8275eb2e65 100644
--- a/target/arm/helper.c
+++ b/target/arm/helper.c
@@ -13257,11 +13257,10 @@  static inline void assert_hflags_rebuild_correctly(CPUARMState *env)
     CPUARMTBFlags r = rebuild_hflags_internal(env);
 
     if (unlikely(c.flags != r.flags || c.flags2 != r.flags2)) {
-        fprintf(stderr, "TCG hflags mismatch "
-                        "(current:(0x%08x,0x" TARGET_FMT_lx ")"
-                        " rebuilt:(0x%08x,0x" TARGET_FMT_lx ")\n",
-                c.flags, c.flags2, r.flags, r.flags2);
-        abort();
+        cpu_abort(env_cpu(env), "TCG hflags mismatch "
+                  "(current:(0x%08x,0x" TARGET_FMT_lx ")"
+                  " rebuilt:(0x%08x,0x" TARGET_FMT_lx ")\n",
+                  c.flags, c.flags2, r.flags, r.flags2);
     }
 #endif
 }