Classes | Defines | Typedefs | Functions

jsdbgapi.h File Reference

#include "jsapi.h"
#include "jsopcode.h"
#include "jsprvtd.h"
Include dependency graph for jsdbgapi.h:
This graph shows which files directly or indirectly include this file:

Classes

struct  JSPropertyDesc
struct  JSPropertyDescArray

Defines

#define JS_IsContructorFrame   JS_IsConstructorFrame
#define JS_SetNewScriptHook   JS_SetNewScriptHookProc
#define JS_SetDestroyScriptHook   JS_SetDestroyScriptHookProc
#define JSPD_ENUMERATE   0x01
#define JSPD_READONLY   0x02
#define JSPD_PERMANENT   0x04
#define JSPD_ALIAS   0x08
#define JSPD_ARGUMENT   0x10
#define JSPD_VARIABLE   0x20
#define JSPD_EXCEPTION   0x40
#define JSPD_ERROR   0x80
#define JSFILENAME_NULL   0xffffffff
#define JSFILENAME_SYSTEM   0x00000001
#define JSFILENAME_PROTECTED   0x00000002

Typedefs

typedef struct JSPropertyDesc JSPropertyDesc
typedef struct JSPropertyDescArray JSPropertyDescArray
typedef struct JSScopeProperty JSScopeProperty

Functions

void JS_SetRuntimeDebugMode (JSRuntime *rt, JSBool debug)
JSBool JS_GetDebugMode (JSContext *cx)
JSBool js_SetDebugMode (JSContext *cx, JSBool debug)
JSBool JS_SetDebugMode (JSContext *cx, JSBool debug)
JSBool js_SetSingleStepMode (JSContext *cx, JSScript *script, JSBool singleStep)
JSBool JS_SetSingleStepMode (JSContext *cx, JSScript *script, JSBool singleStep)
jsbytecodejs_UntrapScriptCode (JSContext *cx, JSScript *script)
JSBool JS_SetTrap (JSContext *cx, JSScript *script, jsbytecode *pc, JSTrapHandler handler, jsval closure)
JSOp JS_GetTrapOpcode (JSContext *cx, JSScript *script, jsbytecode *pc)
void JS_ClearTrap (JSContext *cx, JSScript *script, jsbytecode *pc, JSTrapHandler *handlerp, jsval *closurep)
void JS_ClearScriptTraps (JSContext *cx, JSScript *script)
void JS_ClearAllTraps (JSContext *cx)
JSTrapStatus JS_HandleTrap (JSContext *cx, JSScript *script, jsbytecode *pc, jsval *rval)
JSBool JS_SetInterrupt (JSRuntime *rt, JSInterruptHook handler, void *closure)
JSBool JS_ClearInterrupt (JSRuntime *rt, JSInterruptHook *handlerp, void **closurep)
JSBool JS_SetWatchPoint (JSContext *cx, JSObject *obj, jsid id, JSWatchPointHandler handler, JSObject *closure)
JSBool JS_ClearWatchPoint (JSContext *cx, JSObject *obj, jsid id, JSWatchPointHandler *handlerp, JSObject **closurep)
JSBool JS_ClearWatchPointsForObject (JSContext *cx, JSObject *obj)
JSBool JS_ClearAllWatchPoints (JSContext *cx)
uintN JS_PCToLineNumber (JSContext *cx, JSScript *script, jsbytecode *pc)
jsbytecodeJS_LineNumberToPC (JSContext *cx, JSScript *script, uintN lineno)
jsbytecodeJS_EndPC (JSContext *cx, JSScript *script)
uintN JS_GetFunctionArgumentCount (JSContext *cx, JSFunction *fun)
JSBool JS_FunctionHasLocalNames (JSContext *cx, JSFunction *fun)
jsuwordJS_GetFunctionLocalNameArray (JSContext *cx, JSFunction *fun, void **markp)
JSAtomJS_LocalNameToAtom (jsuword w)
JSStringJS_AtomKey (JSAtom *atom)
void JS_ReleaseFunctionLocalNameArray (JSContext *cx, void *mark)
JSScriptJS_GetFunctionScript (JSContext *cx, JSFunction *fun)
JSNative JS_GetFunctionNative (JSContext *cx, JSFunction *fun)
JSPrincipalsJS_GetScriptPrincipals (JSContext *cx, JSScript *script)
JSStackFrameJS_FrameIterator (JSContext *cx, JSStackFrame **iteratorp)
JSScriptJS_GetFrameScript (JSContext *cx, JSStackFrame *fp)
jsbytecodeJS_GetFramePC (JSContext *cx, JSStackFrame *fp)
JSStackFrameJS_GetScriptedCaller (JSContext *cx, JSStackFrame *fp)
JSPrincipalsjs_StackFramePrincipals (JSContext *cx, JSStackFrame *fp)
JSPrincipalsjs_EvalFramePrincipals (JSContext *cx, JSObject *callee, JSStackFrame *caller)
void * JS_GetFrameAnnotation (JSContext *cx, JSStackFrame *fp)
void JS_SetFrameAnnotation (JSContext *cx, JSStackFrame *fp, void *annotation)
void * JS_GetFramePrincipalArray (JSContext *cx, JSStackFrame *fp)
JSBool JS_IsScriptFrame (JSContext *cx, JSStackFrame *fp)
JSObjectJS_GetFrameObject (JSContext *cx, JSStackFrame *fp)
JSObjectJS_GetFrameScopeChain (JSContext *cx, JSStackFrame *fp)
JSObjectJS_GetFrameCallObject (JSContext *cx, JSStackFrame *fp)
JSBool JS_GetFrameThis (JSContext *cx, JSStackFrame *fp, jsval *thisv)
JSFunctionJS_GetFrameFunction (JSContext *cx, JSStackFrame *fp)
JSObjectJS_GetFrameFunctionObject (JSContext *cx, JSStackFrame *fp)
JSBool JS_IsConstructorFrame (JSContext *cx, JSStackFrame *fp)
JSBool JS_IsDebuggerFrame (JSContext *cx, JSStackFrame *fp)
jsval JS_GetFrameReturnValue (JSContext *cx, JSStackFrame *fp)
void JS_SetFrameReturnValue (JSContext *cx, JSStackFrame *fp, jsval rval)
JSObjectJS_GetFrameCalleeObject (JSContext *cx, JSStackFrame *fp)
 Return fp's callee function object (fp->callee) if it has one.
JSBool JS_GetValidFrameCalleeObject (JSContext *cx, JSStackFrame *fp, jsval *vp)
 Return fp's callee function object after running the deferred closure cloning "method read barrier".
const char * JS_GetScriptFilename (JSContext *cx, JSScript *script)
uintN JS_GetScriptBaseLineNumber (JSContext *cx, JSScript *script)
uintN JS_GetScriptLineExtent (JSContext *cx, JSScript *script)
JSVersion JS_GetScriptVersion (JSContext *cx, JSScript *script)
void JS_SetNewScriptHookProc (JSRuntime *rt, JSNewScriptHook hook, void *callerdata)
void JS_SetDestroyScriptHookProc (JSRuntime *rt, JSDestroyScriptHook hook, void *callerdata)
JSBool JS_EvaluateUCInStackFrame (JSContext *cx, JSStackFrame *fp, const jschar *chars, uintN length, const char *filename, uintN lineno, jsval *rval)
JSBool JS_EvaluateInStackFrame (JSContext *cx, JSStackFrame *fp, const char *bytes, uintN length, const char *filename, uintN lineno, jsval *rval)
JSScopePropertyJS_PropertyIterator (JSObject *obj, JSScopeProperty **iteratorp)
JSBool JS_GetPropertyDesc (JSContext *cx, JSObject *obj, JSScopeProperty *shape, JSPropertyDesc *pd)
JSBool JS_GetPropertyDescArray (JSContext *cx, JSObject *obj, JSPropertyDescArray *pda)
void JS_PutPropertyDescArray (JSContext *cx, JSPropertyDescArray *pda)
JSBool JS_SetDebuggerHandler (JSRuntime *rt, JSDebuggerHandler hook, void *closure)
JSBool JS_SetSourceHandler (JSRuntime *rt, JSSourceHandler handler, void *closure)
JSBool JS_SetExecuteHook (JSRuntime *rt, JSInterpreterHook hook, void *closure)
JSBool JS_SetCallHook (JSRuntime *rt, JSInterpreterHook hook, void *closure)
JSBool JS_SetThrowHook (JSRuntime *rt, JSThrowHook hook, void *closure)
JSBool JS_SetDebugErrorHook (JSRuntime *rt, JSDebugErrorHook hook, void *closure)
size_t JS_GetObjectTotalSize (JSContext *cx, JSObject *obj)
size_t JS_GetFunctionTotalSize (JSContext *cx, JSFunction *fun)
size_t JS_GetScriptTotalSize (JSContext *cx, JSScript *script)
uint32 JS_GetTopScriptFilenameFlags (JSContext *cx, JSStackFrame *fp)
uint32 JS_GetScriptFilenameFlags (JSScript *script)
JSBool JS_FlagScriptFilenamePrefix (JSRuntime *rt, const char *prefix, uint32 flags)
JSBool JS_IsSystemObject (JSContext *cx, JSObject *obj)
JSBool JS_MakeSystemObject (JSContext *cx, JSObject *obj)
JSObjectJS_UnwrapObject (JSContext *cx, JSObject *obj)
void js_RevertVersion (JSContext *cx)
const JSDebugHooksJS_GetGlobalDebugHooks (JSRuntime *rt)
JSDebugHooksJS_SetContextDebugHooks (JSContext *cx, const JSDebugHooks *hooks)
JSDebugHooksJS_ClearContextDebugHooks (JSContext *cx)
JSBool JS_StartProfiling ()
void JS_StopProfiling ()
JSBool JS_DefineProfilingFunctions (JSContext *cx, JSObject *obj)

Define Documentation

#define JS_IsContructorFrame   JS_IsConstructorFrame
#define JS_SetDestroyScriptHook   JS_SetDestroyScriptHookProc
#define JS_SetNewScriptHook   JS_SetNewScriptHookProc
#define JSFILENAME_NULL   0xffffffff
#define JSFILENAME_PROTECTED   0x00000002
#define JSFILENAME_SYSTEM   0x00000001
#define JSPD_ALIAS   0x08
#define JSPD_ARGUMENT   0x10
#define JSPD_ENUMERATE   0x01
#define JSPD_ERROR   0x80
#define JSPD_EXCEPTION   0x40
#define JSPD_PERMANENT   0x04
#define JSPD_READONLY   0x02
#define JSPD_VARIABLE   0x20

Typedef Documentation


Function Documentation

JSString* JS_AtomKey ( JSAtom atom  ) 
void JS_ClearAllTraps ( JSContext cx  ) 
JSBool JS_ClearAllWatchPoints ( JSContext cx  ) 
JSDebugHooks* JS_ClearContextDebugHooks ( JSContext cx  ) 
JSBool JS_ClearInterrupt ( JSRuntime rt,
JSInterruptHook handlerp,
void **  closurep 
)
void JS_ClearScriptTraps ( JSContext cx,
JSScript script 
)
void JS_ClearTrap ( JSContext cx,
JSScript script,
jsbytecode pc,
JSTrapHandler handlerp,
jsval closurep 
)
JSBool JS_ClearWatchPoint ( JSContext cx,
JSObject obj,
jsid  id,
JSWatchPointHandler handlerp,
JSObject **  closurep 
)
JSBool JS_ClearWatchPointsForObject ( JSContext cx,
JSObject obj 
)
JSBool JS_DefineProfilingFunctions ( JSContext cx,
JSObject obj 
)
jsbytecode* JS_EndPC ( JSContext cx,
JSScript script 
)
JSPrincipals* js_EvalFramePrincipals ( JSContext cx,
JSObject callee,
JSStackFrame caller 
)
JSBool JS_EvaluateInStackFrame ( JSContext cx,
JSStackFrame fp,
const char *  bytes,
uintN  length,
const char *  filename,
uintN  lineno,
jsval rval 
)
JSBool JS_EvaluateUCInStackFrame ( JSContext cx,
JSStackFrame fp,
const jschar chars,
uintN  length,
const char *  filename,
uintN  lineno,
jsval rval 
)
JSBool JS_FlagScriptFilenamePrefix ( JSRuntime rt,
const char *  prefix,
uint32  flags 
)
JSStackFrame* JS_FrameIterator ( JSContext cx,
JSStackFrame **  iteratorp 
)
JSBool JS_FunctionHasLocalNames ( JSContext cx,
JSFunction fun 
)
JSBool JS_GetDebugMode ( JSContext cx  ) 
void* JS_GetFrameAnnotation ( JSContext cx,
JSStackFrame fp 
)
JSObject* JS_GetFrameCalleeObject ( JSContext cx,
JSStackFrame fp 
)

Return fp's callee function object (fp->callee) if it has one.

Note that this API cannot fail. A null return means "no callee": fp is a global or eval-from-global frame, not a call frame.

This API began life as an infallible getter, but now it can return either:

1. An optimized closure that was compiled assuming the function could not escape and be called from sites the compiler could not see.

2. A "joined function object", an optimization whereby SpiderMonkey avoids creating fresh function objects for every evaluation of a function expression that is used only once by a consumer that either promises to clone later when asked for the value or that cannot leak the value.

Because Mozilla's Gecko embedding of SpiderMonkey (and no doubt other embeddings) calls this API in potentially performance-sensitive ways (e.g. in nsContentUtils::GetDocumentFromCaller), we are leaving this API alone. It may now return an unwrapped non-escaping optimized closure, or a joined function object. Such optimized objects may work well if called from the correct context, never mutated or compared for identity, etc.

However, if you really need to get the same callee object that JS code would see, which means undoing the optimizations, where an undo attempt can fail, then use JS_GetValidFrameCalleeObject.

JSObject* JS_GetFrameCallObject ( JSContext cx,
JSStackFrame fp 
)
JSFunction* JS_GetFrameFunction ( JSContext cx,
JSStackFrame fp 
)
JSObject* JS_GetFrameFunctionObject ( JSContext cx,
JSStackFrame fp 
)
JSObject* JS_GetFrameObject ( JSContext cx,
JSStackFrame fp 
)
jsbytecode* JS_GetFramePC ( JSContext cx,
JSStackFrame fp 
)
void* JS_GetFramePrincipalArray ( JSContext cx,
JSStackFrame fp 
)
jsval JS_GetFrameReturnValue ( JSContext cx,
JSStackFrame fp 
)
JSObject* JS_GetFrameScopeChain ( JSContext cx,
JSStackFrame fp 
)
JSScript* JS_GetFrameScript ( JSContext cx,
JSStackFrame fp 
)
JSBool JS_GetFrameThis ( JSContext cx,
JSStackFrame fp,
jsval thisv 
)
uintN JS_GetFunctionArgumentCount ( JSContext cx,
JSFunction fun 
)
jsuword* JS_GetFunctionLocalNameArray ( JSContext cx,
JSFunction fun,
void **  markp 
)
JSNative JS_GetFunctionNative ( JSContext cx,
JSFunction fun 
)
JSScript* JS_GetFunctionScript ( JSContext cx,
JSFunction fun 
)
size_t JS_GetFunctionTotalSize ( JSContext cx,
JSFunction fun 
)
const JSDebugHooks* JS_GetGlobalDebugHooks ( JSRuntime rt  ) 
size_t JS_GetObjectTotalSize ( JSContext cx,
JSObject obj 
)
JSBool JS_GetPropertyDesc ( JSContext cx,
JSObject obj,
JSScopeProperty shape,
JSPropertyDesc pd 
)
JSBool JS_GetPropertyDescArray ( JSContext cx,
JSObject obj,
JSPropertyDescArray pda 
)
uintN JS_GetScriptBaseLineNumber ( JSContext cx,
JSScript script 
)
JSStackFrame* JS_GetScriptedCaller ( JSContext cx,
JSStackFrame fp 
)
const char* JS_GetScriptFilename ( JSContext cx,
JSScript script 
)
uint32 JS_GetScriptFilenameFlags ( JSScript script  ) 
uintN JS_GetScriptLineExtent ( JSContext cx,
JSScript script 
)
JSPrincipals* JS_GetScriptPrincipals ( JSContext cx,
JSScript script 
)
size_t JS_GetScriptTotalSize ( JSContext cx,
JSScript script 
)
JSVersion JS_GetScriptVersion ( JSContext cx,
JSScript script 
)
uint32 JS_GetTopScriptFilenameFlags ( JSContext cx,
JSStackFrame fp 
)
JSOp JS_GetTrapOpcode ( JSContext cx,
JSScript script,
jsbytecode pc 
)
JSBool JS_GetValidFrameCalleeObject ( JSContext cx,
JSStackFrame fp,
jsval vp 
)

Return fp's callee function object after running the deferred closure cloning "method read barrier".

This API can fail! If the frame has no callee, this API returns true with JSVAL_IS_VOID(*vp).

JSTrapStatus JS_HandleTrap ( JSContext cx,
JSScript script,
jsbytecode pc,
jsval rval 
)
JSBool JS_IsConstructorFrame ( JSContext cx,
JSStackFrame fp 
)
JSBool JS_IsDebuggerFrame ( JSContext cx,
JSStackFrame fp 
)
JSBool JS_IsScriptFrame ( JSContext cx,
JSStackFrame fp 
)
JSBool JS_IsSystemObject ( JSContext cx,
JSObject obj 
)
jsbytecode* JS_LineNumberToPC ( JSContext cx,
JSScript script,
uintN  lineno 
)
JSAtom* JS_LocalNameToAtom ( jsuword  w  ) 
JSBool JS_MakeSystemObject ( JSContext cx,
JSObject obj 
)
uintN JS_PCToLineNumber ( JSContext cx,
JSScript script,
jsbytecode pc 
)
JSScopeProperty* JS_PropertyIterator ( JSObject obj,
JSScopeProperty **  iteratorp 
)
void JS_PutPropertyDescArray ( JSContext cx,
JSPropertyDescArray pda 
)
void JS_ReleaseFunctionLocalNameArray ( JSContext cx,
void *  mark 
)
void js_RevertVersion ( JSContext cx  ) 
JSBool JS_SetCallHook ( JSRuntime rt,
JSInterpreterHook  hook,
void *  closure 
)
JSDebugHooks* JS_SetContextDebugHooks ( JSContext cx,
const JSDebugHooks hooks 
)
JSBool JS_SetDebugErrorHook ( JSRuntime rt,
JSDebugErrorHook  hook,
void *  closure 
)
JSBool JS_SetDebuggerHandler ( JSRuntime rt,
JSDebuggerHandler  hook,
void *  closure 
)
JSBool js_SetDebugMode ( JSContext cx,
JSBool  debug 
)
JSBool JS_SetDebugMode ( JSContext cx,
JSBool  debug 
)
void JS_SetDestroyScriptHookProc ( JSRuntime rt,
JSDestroyScriptHook  hook,
void *  callerdata 
)
JSBool JS_SetExecuteHook ( JSRuntime rt,
JSInterpreterHook  hook,
void *  closure 
)
void JS_SetFrameAnnotation ( JSContext cx,
JSStackFrame fp,
void *  annotation 
)
void JS_SetFrameReturnValue ( JSContext cx,
JSStackFrame fp,
jsval  rval 
)
JSBool JS_SetInterrupt ( JSRuntime rt,
JSInterruptHook  handler,
void *  closure 
)
void JS_SetNewScriptHookProc ( JSRuntime rt,
JSNewScriptHook  hook,
void *  callerdata 
)
void JS_SetRuntimeDebugMode ( JSRuntime rt,
JSBool  debug 
)
JSBool js_SetSingleStepMode ( JSContext cx,
JSScript script,
JSBool  singleStep 
)
JSBool JS_SetSingleStepMode ( JSContext cx,
JSScript script,
JSBool  singleStep 
)
JSBool JS_SetSourceHandler ( JSRuntime rt,
JSSourceHandler  handler,
void *  closure 
)
JSBool JS_SetThrowHook ( JSRuntime rt,
JSThrowHook  hook,
void *  closure 
)
JSBool JS_SetTrap ( JSContext cx,
JSScript script,
jsbytecode pc,
JSTrapHandler  handler,
jsval  closure 
)
JSBool JS_SetWatchPoint ( JSContext cx,
JSObject obj,
jsid  id,
JSWatchPointHandler  handler,
JSObject closure 
)
JSPrincipals* js_StackFramePrincipals ( JSContext cx,
JSStackFrame fp 
)
JSBool JS_StartProfiling (  ) 
void JS_StopProfiling (  ) 
jsbytecode* js_UntrapScriptCode ( JSContext cx,
JSScript script 
)
JSObject* JS_UnwrapObject ( JSContext cx,
JSObject obj 
)