Misc cleanups in the trap handling code.

This commit is contained in:
Dan Gohman
2018-12-13 12:09:04 -08:00
parent 26eb8131da
commit 717f60bda1
4 changed files with 48 additions and 59 deletions

View File

@@ -406,13 +406,7 @@ HandleTrap(CONTEXT* context)
{
assert(sAlreadyHandlingTrap);
const uint8_t* pc = ContextToPC(context);
const CodeSegment* codeSegment = LookupCodeSegment(pc);
if (!codeSegment) {
return false;
}
RecordTrap(pc, codeSegment);
RecordTrap(ContextToPC(context));
// Unwind calls longjmp, so it doesn't run the automatic
// sAlreadhHanldingTrap cleanups, so reset it manually before doing

View File

@@ -11,19 +11,12 @@
extern "C" {
#endif
struct CodeSegment;
// Record the Trap code and wasm bytecode offset in TLS somewhere
void RecordTrap(const uint8_t* pc, const struct CodeSegment* codeSegment);
void RecordTrap(const uint8_t* pc);
// Initiate an unwind.
void Unwind(void);
// Return the CodeSegment containing the given pc, if any exist in the process.
// This method does not take a lock.
const struct CodeSegment*
LookupCodeSegment(const void* pc);
// Trap initialization state.
struct TrapContext {
bool triedToInstallSignalHandlers;