chore: replace aborts with panics

main
Sean McBride 4 years ago
parent 9bed646e3b
commit e3261244ee

@ -181,7 +181,7 @@ sandbox_state_stringify(sandbox_state_t state)
return "Error"; return "Error";
default: default:
/* Crash, as this should be exclusive */ /* Crash, as this should be exclusive */
abort(); panic("%d is an unrecognized sandbox state\n", state);
} }
} }

@ -3,6 +3,8 @@
#include <stdbool.h> #include <stdbool.h>
#include <stdlib.h> #include <stdlib.h>
#include "panic.h"
/** /**
* Called by the inline assembly in arch_context_switch to send a SIGUSR1 in order to restore a previously preempted * Called by the inline assembly in arch_context_switch to send a SIGUSR1 in order to restore a previously preempted
* thread. The only way to restore all of the mcontext registers of a preempted sandbox is to send ourselves a signal, * thread. The only way to restore all of the mcontext registers of a preempted sandbox is to send ourselves a signal,
@ -12,5 +14,5 @@
void __attribute__((noinline)) __attribute__((noreturn)) arch_context_restore_preempted(void) void __attribute__((noinline)) __attribute__((noreturn)) arch_context_restore_preempted(void)
{ {
pthread_kill(pthread_self(), SIGUSR1); pthread_kill(pthread_self(), SIGUSR1);
abort(); panic("Unexpectedly reached code after sending self SIGUSR1\n");
} }

@ -628,7 +628,7 @@ wasm_fcntl(uint32_t file_descriptor, uint32_t cmd, uint32_t arg_or_lock_ptr)
case WF_SETLK: case WF_SETLK:
return 0; return 0;
default: default:
abort(); panic("Invalid command %d\n", cmd);
} }
} }

@ -320,5 +320,5 @@ worker_thread_on_sandbox_exit(struct sandbox *exiting_sandbox)
assert(!software_interrupt_is_enabled()); assert(!software_interrupt_is_enabled());
worker_thread_dump_lock_overhead(); worker_thread_dump_lock_overhead();
worker_thread_switch_to_base_context(); worker_thread_switch_to_base_context();
abort(); panic("Unexpected return\n");
} }

Loading…
Cancel
Save