7#include <assembler/MacroAssemblerCodeRef.h>
9#include <QtCore/qdebug.h>
11#include <qt_windows.h>
74 codeRef->executableMemory()->exceptionHandlerStart());
76 record->info.Version = 1;
77 record->info.Flags = 0;
78 record->info.SizeOfProlog = 4;
79 record->info.CountOfUnwindCodes = 2;
80 record->info.FrameRegister =
RBP;
81 record->info.FrameRegisterOffset = 0;
88 const quintptr codeStart = quintptr(codeRef->code().executableAddress());
89 const quintptr codeSize = codeRef->size();
91 record->handler.BeginAddress = DWORD(codeStart - quintptr(record));
92 record->handler.EndAddress = DWORD(codeStart + codeSize - quintptr(record));
93 record->handler.UnwindData = offsetof(ExceptionHandlerRecord, info);
95 if (!RtlAddFunctionTable(&record->handler, 1, DWORD64(record))) {
96 const unsigned int errorCode = GetLastError();
97 qWarning() <<
"Failed to install win64 unwind hook. Error code:" << errorCode;
104 codeRef->executableMemory()->exceptionHandlerStart());
105 if (!RtlDeleteFunctionTable(&record->handler)) {
106 const unsigned int errorCode = GetLastError();
107 qWarning() <<
"Failed to remove win64 unwind hook. Error code:" << errorCode;
size_t exceptionHandlerSize()
void generateFunctionTable(Function *function, JSC::MacroAssemblerCodeRef *codeRef)
void destroyFunctionTable(Function *function, JSC::MacroAssemblerCodeRef *codeRef)
UnwindCode(UINT8 offset, UnwindOpcode operation, Register info)
UnwindCode UnwindCodes[2]
UINT8 FrameRegisterOffset