예제 #1
0
void
jsd_DebuggerUnpause(JSDContext* jsdc)
{
    JS_SetDebuggerHandler(jsdc->jsrt, jsd_DebuggerHandler, jsdc);
    JS_SetExecuteHook(jsdc->jsrt, jsd_TopLevelCallHook, jsdc);
    JS_SetCallHook(jsdc->jsrt, jsd_FunctionCallHook, jsdc);
    JS_SetThrowHook(jsdc->jsrt, jsd_ThrowHandler, jsdc);
    JS_SetDebugErrorHook(jsdc->jsrt, jsd_DebugErrorHook, jsdc);
}
예제 #2
0
JSD_SetContextFlags(JSDContext *jsdc, uint32_t flags)
{
    JSD_ASSERT_VALID_CONTEXT(jsdc);
    jsdc->flags = flags;
    if (flags & JSD_COLLECT_PROFILE_DATA) {
        /* Need to reenable our call hooks now */
        JS_SetExecuteHook(jsdc->jsrt, jsd_TopLevelCallHook, jsdc);
        JS_SetCallHook(jsdc->jsrt, jsd_FunctionCallHook, jsdc);
    }
}
예제 #3
0
void
jsd_DebuggerPause(JSDContext* jsdc, JSBool forceAllHooksOff)
{
    JS_SetDebuggerHandler(jsdc->jsrt, NULL, NULL);
    if (forceAllHooksOff || !(jsdc->flags & JSD_COLLECT_PROFILE_DATA)) {
        JS_SetExecuteHook(jsdc->jsrt, NULL, NULL);
        JS_SetCallHook(jsdc->jsrt, NULL, NULL);
    }
    JS_SetThrowHook(jsdc->jsrt, NULL, NULL);
    JS_SetDebugErrorHook(jsdc->jsrt, NULL, NULL);
}
예제 #4
0
CThreadDebugger::~CThreadDebugger()
{
	// Clear all Traps and Breakpoints that are marked for removal
	ClearTrapsToRemove();
	
	// Return all breakpoints to the associated CDebuggingServer
	ReturnActiveBreakPoints(NULL);

	// Remove all the hooks because they store a pointer to this object
	JS_SetExecuteHook(m->m_pScriptInterface->GetRuntime(), NULL, NULL);
	JS_SetCallHook(m->m_pScriptInterface->GetRuntime(), NULL, NULL);
	JS_SetNewScriptHook(m->m_pScriptInterface->GetRuntime(), NULL, NULL);
	JS_SetDestroyScriptHook(m->m_pScriptInterface->GetRuntime(), NULL, NULL);
}
예제 #5
0
파일: runtime.c 프로젝트: ripta/johnson
/*
 * call-seq:
 *   debugger=(debugger)
 *
 * Sets a debugger object
 */
static VALUE
set_debugger(VALUE self, VALUE debugger)
{
  JohnsonRuntime* runtime;
  JSDebugHooks* debug_hooks;

  rb_iv_set(self, "@debugger", debugger);
  Data_Get_Struct(self, JohnsonRuntime, runtime);
  Data_Get_Struct(debugger, JSDebugHooks, debug_hooks);

  JSContext * context = johnson_get_current_context(runtime);

  JS_SetInterrupt(          runtime->js,
                            debug_hooks->interruptHandler,
                            debug_hooks->interruptHandlerData);
  JS_SetNewScriptHook(      runtime->js,
                            debug_hooks->newScriptHook,
                            debug_hooks->newScriptHookData);
  JS_SetDestroyScriptHook(  runtime->js,
                            debug_hooks->destroyScriptHook,
                            debug_hooks->destroyScriptHookData);
  JS_SetDebuggerHandler(    runtime->js,
                            debug_hooks->debuggerHandler,
                            debug_hooks->debuggerHandlerData);
  JS_SetSourceHandler(      runtime->js,
                            debug_hooks->sourceHandler,
                            debug_hooks->sourceHandlerData);
  JS_SetExecuteHook(        runtime->js,
                            debug_hooks->executeHook,
                            debug_hooks->executeHookData);
  JS_SetCallHook(           runtime->js,
                            debug_hooks->callHook,
                            debug_hooks->callHookData);
  JS_SetObjectHook(         runtime->js,
                            debug_hooks->objectHook,
                            debug_hooks->objectHookData);
  JS_SetThrowHook(          runtime->js,
                            debug_hooks->throwHook,
                            debug_hooks->throwHookData);
  JS_SetDebugErrorHook(     runtime->js,
                            debug_hooks->debugErrorHook,
                            debug_hooks->debugErrorHookData);

  JS_SetContextDebugHooks(context, debug_hooks);

  return debugger;
}
예제 #6
0
void CThreadDebugger::Initialize(uint id, std::string name, ScriptInterface* pScriptInterface, CDebuggingServer* pDebuggingServer)
{
	ENSURE(id != 0);
	m->m_ID = id;
	m->m_Name = name;
	m->m_pScriptInterface = pScriptInterface;
	m->m_pDebuggingServer = pDebuggingServer;
	JS_SetExecuteHook(m->m_pScriptInterface->GetRuntime(), CallHook_, (void*)this);
	JS_SetCallHook(m->m_pScriptInterface->GetRuntime(), CallHook_, (void*)this);
	JS_SetNewScriptHook(m->m_pScriptInterface->GetRuntime(), NewScriptHook_, (void*)this);
	JS_SetDestroyScriptHook(m->m_pScriptInterface->GetRuntime(), DestroyScriptHook_, (void*)this);
	JS_SetThrowHook(m->m_pScriptInterface->GetRuntime(), ThrowHandler_, (void*)this);
	
	if (m->m_pDebuggingServer->GetSettingSimultaneousThreadBreak())
	{
		// Setup a handler to check for break-requests from the DebuggingServer regularly
		JS_SetInterrupt(m->m_pScriptInterface->GetRuntime(), CheckForBreakRequestHandler_, (void*)this);
	}
}
예제 #7
0
	ScriptRuntime(int runtimeSize) :
		m_rooter(NULL), m_compartmentGlobal(NULL)
	{
		m_rt = JS_NewRuntime(runtimeSize);
		ENSURE(m_rt); // TODO: error handling

		if (g_ScriptProfilingEnabled)
		{
			// Profiler isn't thread-safe, so only enable this on the main thread
			if (ThreadUtil::IsMainThread())
			{
				if (CProfileManager::IsInitialised())
				{
					JS_SetExecuteHook(m_rt, jshook_script, this);
					JS_SetCallHook(m_rt, jshook_function, this);
				}
			}
		}

		JS_SetExtraGCRoots(m_rt, jshook_trace, this);
	}
예제 #8
0
JSD_SetContextFlags(JSDContext *jsdc, uint32 flags)
{
    uint32 oldFlags = jsdc->flags;
    JSD_ASSERT_VALID_CONTEXT(jsdc);
    jsdc->flags = flags;
    if ((flags & JSD_COLLECT_PROFILE_DATA) ||
        !(flags & JSD_DISABLE_OBJECT_TRACE)) {
        /* Need to reenable our call hooks now */
        JS_SetExecuteHook(jsdc->jsrt, jsd_TopLevelCallHook, jsdc);
        JS_SetCallHook(jsdc->jsrt, jsd_FunctionCallHook, jsdc);
    }
    if ((oldFlags ^ flags) & JSD_DISABLE_OBJECT_TRACE) {
        /* Changing our JSD_DISABLE_OBJECT_TRACE flag */
        if (!(flags & JSD_DISABLE_OBJECT_TRACE)) {
            /* Need to reenable our object hooks now */
            JS_SetObjectHook(jsdc->jsrt, jsd_ObjectHook, jsdc);
        } else {
            jsd_DestroyObjects(jsdc);
            JS_SetObjectHook(jsdc->jsrt, NULL, NULL);
        }
    }
}