From 835b293d35a209d38047126443d41fa7090daa4c Mon Sep 17 00:00:00 2001 From: Justus Winter Date: Mon, 19 Jun 2017 21:20:57 +0200 Subject: Use our own variant of 'assert' and 'assert_perror'. Our variants print stack traces on failures. This will make locating errors much easier. --- exec/elfcore.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'exec/elfcore.c') diff --git a/exec/elfcore.c b/exec/elfcore.c index 3e4551e5..12ecf34f 100644 --- a/exec/elfcore.c +++ b/exec/elfcore.c @@ -40,7 +40,7 @@ #endif #include -#include +#include #ifdef i386_THREAD_STATE # define ELF_MACHINE EM_386 @@ -56,9 +56,9 @@ fetch_thread_regset (thread_t thread, prgregset_t *gregs) prgregset_t gregs; } *u = (void *) gregs; mach_msg_type_number_t count = i386_THREAD_STATE_COUNT; - assert (sizeof (struct i386_thread_state) < sizeof (prgregset_t)); - assert (offsetof (struct i386_thread_state, gs) == REG_GS * 4); - assert (offsetof (struct i386_thread_state, eax) == REG_EAX * 4); + assert_backtrace (sizeof (struct i386_thread_state) < sizeof (prgregset_t)); + assert_backtrace (offsetof (struct i386_thread_state, gs) == REG_GS * 4); + assert_backtrace (offsetof (struct i386_thread_state, eax) == REG_EAX * 4); (void) thread_get_state (thread, i386_THREAD_STATE, (thread_state_t) &u->state, &count); @@ -82,7 +82,7 @@ fetch_thread_fpregset (thread_t thread, prfpregset_t *fpregs) (thread_state_t) &st, &count); if (err == 0 && st.initialized) { - assert (sizeof *fpregs >= sizeof st.hw_state); + assert_backtrace (sizeof *fpregs >= sizeof st.hw_state); memcpy (fpregs, st.hw_state, sizeof st.hw_state); } } @@ -96,7 +96,7 @@ static inline void fetch_thread_regset (thread_t thread, prgregset_t *gregs) { mach_msg_type_number_t count = ALPHA_THREAD_STATE_COUNT; - assert (sizeof (struct alpha_thread_state) <= sizeof (prgregset_t)); + assert_backtrace (sizeof (struct alpha_thread_state) <= sizeof (prgregset_t)); (void) thread_get_state (thread, ALPHA_THREAD_STATE, (thread_state_t) gregs, &count); /* XXX @@ -110,7 +110,7 @@ static inline void fetch_thread_fpregset (thread_t thread, prfpregset_t *fpregs) { mach_msg_type_number_t count = ALPHA_FLOAT_STATE_COUNT; - assert (sizeof (struct alpha_float_state) == sizeof *fpregs); + assert_backtrace (sizeof (struct alpha_float_state) == sizeof *fpregs); (void) thread_get_state (thread, ALPHA_FLOAT_STATE, (thread_state_t) fpregs, &count); } -- cgit v1.2.3