Obviously this stuff is almost entirely undocumented.
See the implementation of the trap, untrap, watch, unwatch, line2pc
, and pc2line
functions in js/src/shell/js.cpp
. Also the (scant) comments in js/src/jsdbgapi.h
.
Breakpoints
JS_SetTrap
JS_GetTrapOpcode
JS_ClearTrap
JS_ClearScriptTraps
JS_ClearAllTraps
JS_HandleTrap
JS_SetInterrupt
JS_ClearInterrupt
Watchpoints
Inspecting the stack
JS_PCToLineNumber
JS_LineNumberToPC
JS_GetFunctionScript
JS_GetFunctionNative
JS_GetFunctionFastNative
JS_GetScriptPrincipals
- typedef
JSStackFrame
JS_FrameIterator
JS_GetFrameScript
JS_GetFramePC
JS_GetScriptedCaller
JS_StackFramePrincipals
JS_EvalFramePrincipals
JS_GetFrameAnnotation
JS_SetFrameAnnotation
JS_GetFramePrincipalArray
JS_IsNativeFrame
JS_GetFrameObject
JS_GetFrameScopeChain
JS_GetFrameCallObject
JS_GetFrameThis
JS_GetFrameFunction
JS_GetFrameFunctionObject
JS_IsConstructorFrame
JS_IsDebuggerFrame
JS_GetFrameReturnValue
JS_SetFrameReturnValue
JS_GetFrameCalleeObject
Evaluating debug code
Examining object properties
- typedef
JSPropertyDesc
JSPD_ENUMERATE
JSPD_READONLY
JSPD_PERMANENT
JSPD_ALIAS
JSPD_ARGUMENT
JSPD_VARIABLE
JSPD_EXCEPTION
JSPD_ERROR
- typedef
JSPropertyDescArray
Hooks
JS_SetDebuggerHandler
JS_SetSourceHandler
JS_SetExecuteHook
JS_SetCallHook
JS_SetObjectHook
JS_SetThrowHook
JS_SetDebugErrorHook
JS_SetNewScriptHook
JS_SetDestroyScriptHook
Memory usage
System objects
Profiling
These functions can be used to profile a SpiderMonkey application using the Mac profiler, Shark. See Profiling JavaScript with Shark.
The following JSNative
functions can be used to expose the above four APIs to scripts.