Subj : Re: JSD_SetExecutionHook To : netscape.public.mozilla.jseng From : Shanti Rao Date : Thu Mar 10 2005 09:09 pm If you'd like some example code, look at http://www.jsdb.org/wrap_debug.cpp The debugging system works fine, and I don't recall ever using a JSDScript. Shanti > The jsdebugger forum seems to be dead (not used) so I put my question here > instead. > > What is wrong with this basic outline? (some code skipped for brevity) > > rt = JS_NewRuntime(0x100000); > cx = JS_NewContext(rt, 0x1000); > global = JS_NewObject(cx, &global_class, NULL, NULL); > JS_InitStandardClasses(cx, global); > ...setup function structs here... > JSBool ok= JS_DefineFunctions(cx, global, my_functions); > > //Debugger setup part... > JSDContext* pJSDContext = JSD_DebuggerOnForUser(rt, NULL, NULL); > JSD_JSContextInUse(pJSDContext, cx); //Associate the debugger with the > context we are using. > > //These are set from a DebugController wrapper class. this refers to the > class itself. > //The file scope DC... static methods just call back into the class > JS_SetNewScriptHook(pRunTime, &DCNewScriptHook, this ); > JS_SetExecuteHook(pRunTime, &DCExecuteHook, this); > > JSD_SetScriptHook(pJSDContext, &DCScriptHookProc, this); > JSD_SetThrowHook(pJSDContext, &DCThrowHook, this); > JSD_SetDebugBreakHook(pJSDContext, &DCDebugBreakHookProc, this ); > JSD_SetErrorReporter(pJSDContext, &DCErrorReporter, this); > > ok = JS_EvaluateScript(cx, global, script, strlen(script), filename, lineno, > &rval); > str = JS_ValueToString(cx, rval); > JSD_DebuggerOff(pJSDContext); > > I want to call JSD_SetExecutionHook to set a breakpoint. > However it requires a JSDScript* as an argument. > > Where do I call JSD_SetExecutionHook from and how do I get a JSDScript* in > the first place? > Do I need to load, compile, and execute instead of using JS_EvaluateScript? > > What is the trick here? > Thanks for your help! > > So many callbacks...so little time.... > > Mike > > .