Cleanup a bit of exception/error handling between the VM and the debugger

We had two similar-but-different functions for getting a notification from the VM about an exception. Cleaned that up by using the proper one for a thrown exception where appropriate, and moving the old one into a hook (like the other VM->debugger hooks) specifically for error messages.
Esse commit está contido em:
Mike Magruder
2013-06-07 15:12:13 -07:00
commit de sgolemon
commit eec54a0f6c
10 arquivos alterados com 36 adições e 45 exclusões
+17 -3
Ver Arquivo
@@ -66,14 +66,13 @@ void phpDebuggerOpcodeHook(const uchar* pc) {
}
// Hook called from iopThrow to signal that we are about to throw an exception.
// NB: this does not hook any portion of exception unwind.
void phpDebuggerExceptionThrownHook(ObjectData* e) {
void phpDebuggerExceptionThrownHook(ObjectData* exception) {
TRACE(5, "in phpDebuggerExceptionThrownHook()\n");
if (UNLIKELY(g_vmContext->m_dbgNoBreak)) {
TRACE(5, "NoBreak flag is on\n");
return;
}
Eval::Debugger::InterruptVMHook(Eval::ExceptionThrown, e);
Eval::Debugger::InterruptVMHook(Eval::ExceptionThrown, exception);
TRACE(5, "out phpDebuggerExceptionThrownHook()\n");
}
@@ -89,6 +88,21 @@ void phpDebuggerExceptionHandlerHook() {
TRACE(5, "out phpDebuggerExceptionHandlerHook()\n");
}
// Hook called when the VM raises an error.
void phpDebuggerErrorHook(const std::string& message) {
TRACE(5, "in phpDebuggerErrorHook()\n");
if (UNLIKELY(g_vmContext->m_dbgNoBreak)) {
TRACE(5, "NoBreak flag is on\n");
return;
}
try {
Eval::Debugger::InterruptVMHook(Eval::ExceptionThrown, String(message));
} catch (const Eval::DebuggerClientExitException &e) {
// Don't disturb the error handler just because a debugger quits.
}
TRACE(5, "out phpDebuggerErrorHook()\n");
}
bool isDebuggerAttachedProcess() {
return Eval::Debugger::CountConnectedProxy() > 0;
}