2001-09-20 00:02:59 +00:00
|
|
|
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
1998-03-28 02:44:41 +00:00
|
|
|
*
|
2001-09-20 00:02:59 +00:00
|
|
|
* The contents of this file are subject to the Netscape Public
|
1999-09-28 23:12:09 +00:00
|
|
|
* License Version 1.1 (the "License"); you may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of
|
2001-09-20 00:02:59 +00:00
|
|
|
* the License at http://www.mozilla.org/NPL/
|
1998-03-28 02:44:41 +00:00
|
|
|
*
|
1999-09-28 23:12:09 +00:00
|
|
|
* Software distributed under the License is distributed on an "AS
|
2001-09-20 00:02:59 +00:00
|
|
|
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express oqr
|
1999-09-28 23:12:09 +00:00
|
|
|
* implied. See the License for the specific language governing
|
|
|
|
* rights and limitations under the License.
|
1998-03-28 02:44:41 +00:00
|
|
|
*
|
2001-09-20 00:02:59 +00:00
|
|
|
* The Original Code is Mozilla Communicator client code, released
|
|
|
|
* March 31, 1998.
|
1999-09-28 23:12:09 +00:00
|
|
|
*
|
2001-09-20 00:02:59 +00:00
|
|
|
* The Initial Developer of the Original Code is Netscape
|
|
|
|
* Communications Corporation. Portions created by Netscape are
|
1999-09-28 23:12:09 +00:00
|
|
|
* Copyright (C) 1998 Netscape Communications Corporation. All
|
|
|
|
* Rights Reserved.
|
|
|
|
*
|
2001-09-20 00:02:59 +00:00
|
|
|
* Contributor(s):
|
1999-09-28 23:12:09 +00:00
|
|
|
*
|
2001-09-20 00:02:59 +00:00
|
|
|
* Alternatively, the contents of this file may be used under the
|
|
|
|
* terms of the GNU Public License (the "GPL"), in which case the
|
|
|
|
* provisions of the GPL are applicable instead of those above.
|
|
|
|
* If you wish to allow use of your version of this file only
|
|
|
|
* under the terms of the GPL and not to allow others to use your
|
|
|
|
* version of this file under the NPL, indicate your decision by
|
|
|
|
* deleting the provisions above and replace them with the notice
|
|
|
|
* and other provisions required by the GPL. If you do not delete
|
|
|
|
* the provisions above, a recipient may use your version of this
|
|
|
|
* file under either the NPL or the GPL.
|
|
|
|
*/
|
1998-03-28 02:44:41 +00:00
|
|
|
|
|
|
|
#ifndef jsdbgapi_h___
|
|
|
|
#define jsdbgapi_h___
|
|
|
|
/*
|
|
|
|
* JS debugger API.
|
|
|
|
*/
|
|
|
|
#include "jsapi.h"
|
|
|
|
#include "jsopcode.h"
|
|
|
|
#include "jsprvtd.h"
|
|
|
|
|
1998-10-14 10:22:38 +00:00
|
|
|
JS_BEGIN_EXTERN_C
|
1998-03-28 02:44:41 +00:00
|
|
|
|
|
|
|
extern void
|
|
|
|
js_PatchOpcode(JSContext *cx, JSScript *script, jsbytecode *pc, JSOp op);
|
|
|
|
|
1998-04-24 00:31:11 +00:00
|
|
|
extern JS_PUBLIC_API(JSBool)
|
1998-03-28 02:44:41 +00:00
|
|
|
JS_SetTrap(JSContext *cx, JSScript *script, jsbytecode *pc,
|
|
|
|
JSTrapHandler handler, void *closure);
|
|
|
|
|
1998-04-24 00:31:11 +00:00
|
|
|
extern JS_PUBLIC_API(JSOp)
|
1998-03-28 02:44:41 +00:00
|
|
|
JS_GetTrapOpcode(JSContext *cx, JSScript *script, jsbytecode *pc);
|
|
|
|
|
1998-04-24 00:31:11 +00:00
|
|
|
extern JS_PUBLIC_API(void)
|
1998-03-28 02:44:41 +00:00
|
|
|
JS_ClearTrap(JSContext *cx, JSScript *script, jsbytecode *pc,
|
|
|
|
JSTrapHandler *handlerp, void **closurep);
|
|
|
|
|
1998-04-24 00:31:11 +00:00
|
|
|
extern JS_PUBLIC_API(void)
|
1998-03-28 02:44:41 +00:00
|
|
|
JS_ClearScriptTraps(JSContext *cx, JSScript *script);
|
|
|
|
|
1998-04-24 00:31:11 +00:00
|
|
|
extern JS_PUBLIC_API(void)
|
1998-03-28 02:44:41 +00:00
|
|
|
JS_ClearAllTraps(JSContext *cx);
|
|
|
|
|
1998-04-24 00:31:11 +00:00
|
|
|
extern JS_PUBLIC_API(JSTrapStatus)
|
1998-03-28 02:44:41 +00:00
|
|
|
JS_HandleTrap(JSContext *cx, JSScript *script, jsbytecode *pc, jsval *rval);
|
|
|
|
|
1998-04-24 00:31:11 +00:00
|
|
|
extern JS_PUBLIC_API(JSBool)
|
1998-03-28 02:44:41 +00:00
|
|
|
JS_SetInterrupt(JSRuntime *rt, JSTrapHandler handler, void *closure);
|
|
|
|
|
1998-04-24 00:31:11 +00:00
|
|
|
extern JS_PUBLIC_API(JSBool)
|
1998-03-28 02:44:41 +00:00
|
|
|
JS_ClearInterrupt(JSRuntime *rt, JSTrapHandler *handlerp, void **closurep);
|
|
|
|
|
|
|
|
/************************************************************************/
|
|
|
|
|
1998-04-24 00:31:11 +00:00
|
|
|
extern JS_PUBLIC_API(JSBool)
|
1998-03-28 02:44:41 +00:00
|
|
|
JS_SetWatchPoint(JSContext *cx, JSObject *obj, jsval id,
|
|
|
|
JSWatchPointHandler handler, void *closure);
|
|
|
|
|
1998-04-24 00:31:11 +00:00
|
|
|
extern JS_PUBLIC_API(void)
|
1998-03-28 02:44:41 +00:00
|
|
|
JS_ClearWatchPoint(JSContext *cx, JSObject *obj, jsval id,
|
|
|
|
JSWatchPointHandler *handlerp, void **closurep);
|
|
|
|
|
1998-04-24 00:31:11 +00:00
|
|
|
extern JS_PUBLIC_API(void)
|
1998-03-28 02:44:41 +00:00
|
|
|
JS_ClearWatchPointsForObject(JSContext *cx, JSObject *obj);
|
|
|
|
|
1998-04-24 00:31:11 +00:00
|
|
|
extern JS_PUBLIC_API(void)
|
1998-03-28 02:44:41 +00:00
|
|
|
JS_ClearAllWatchPoints(JSContext *cx);
|
|
|
|
|
1998-04-24 00:31:11 +00:00
|
|
|
#ifdef JS_HAS_OBJ_WATCHPOINT
|
|
|
|
/*
|
|
|
|
* Hide these non-API function prototypes by testing whether the internal
|
|
|
|
* header file "jsconfig.h" has been included.
|
|
|
|
*/
|
|
|
|
extern JSScopeProperty *
|
|
|
|
js_FindWatchPoint(JSRuntime *rt, JSObject *obj, jsval userid);
|
|
|
|
|
1998-10-14 10:22:38 +00:00
|
|
|
extern JSBool JS_DLL_CALLBACK
|
1998-04-24 00:31:11 +00:00
|
|
|
js_watch_set(JSContext *cx, JSObject *obj, jsval id, jsval *vp);
|
|
|
|
#endif
|
|
|
|
|
1998-03-28 02:44:41 +00:00
|
|
|
/************************************************************************/
|
|
|
|
|
1998-04-24 00:31:11 +00:00
|
|
|
extern JS_PUBLIC_API(uintN)
|
1998-03-28 02:44:41 +00:00
|
|
|
JS_PCToLineNumber(JSContext *cx, JSScript *script, jsbytecode *pc);
|
|
|
|
|
1998-04-24 00:31:11 +00:00
|
|
|
extern JS_PUBLIC_API(jsbytecode *)
|
1998-03-28 02:44:41 +00:00
|
|
|
JS_LineNumberToPC(JSContext *cx, JSScript *script, uintN lineno);
|
|
|
|
|
1998-04-24 00:31:11 +00:00
|
|
|
extern JS_PUBLIC_API(JSScript *)
|
1998-03-28 02:44:41 +00:00
|
|
|
JS_GetFunctionScript(JSContext *cx, JSFunction *fun);
|
|
|
|
|
1998-04-24 00:31:11 +00:00
|
|
|
extern JS_PUBLIC_API(JSPrincipals *)
|
1998-03-28 02:44:41 +00:00
|
|
|
JS_GetScriptPrincipals(JSContext *cx, JSScript *script);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Stack Frame Iterator
|
|
|
|
*
|
|
|
|
* Used to iterate through the JS stack frames to extract
|
|
|
|
* information from the frames.
|
|
|
|
*/
|
|
|
|
|
1998-04-24 00:31:11 +00:00
|
|
|
extern JS_PUBLIC_API(JSStackFrame *)
|
1998-03-28 02:44:41 +00:00
|
|
|
JS_FrameIterator(JSContext *cx, JSStackFrame **iteratorp);
|
|
|
|
|
1998-04-24 00:31:11 +00:00
|
|
|
extern JS_PUBLIC_API(JSScript *)
|
1998-03-28 02:44:41 +00:00
|
|
|
JS_GetFrameScript(JSContext *cx, JSStackFrame *fp);
|
|
|
|
|
1998-04-24 00:31:11 +00:00
|
|
|
extern JS_PUBLIC_API(jsbytecode *)
|
1998-03-28 02:44:41 +00:00
|
|
|
JS_GetFramePC(JSContext *cx, JSStackFrame *fp);
|
|
|
|
|
1998-04-24 00:31:11 +00:00
|
|
|
extern JS_PUBLIC_API(JSBool)
|
1998-03-28 02:44:41 +00:00
|
|
|
JS_IsNativeFrame(JSContext *cx, JSStackFrame *fp);
|
|
|
|
|
1998-04-24 00:31:11 +00:00
|
|
|
extern JS_PUBLIC_API(void *)
|
1998-03-28 02:44:41 +00:00
|
|
|
JS_GetFrameAnnotation(JSContext *cx, JSStackFrame *fp);
|
|
|
|
|
1998-04-24 00:31:11 +00:00
|
|
|
extern JS_PUBLIC_API(void)
|
1998-03-28 02:44:41 +00:00
|
|
|
JS_SetFrameAnnotation(JSContext *cx, JSStackFrame *fp, void *annotation);
|
|
|
|
|
1998-04-24 00:31:11 +00:00
|
|
|
extern JS_PUBLIC_API(void *)
|
1998-03-28 02:44:41 +00:00
|
|
|
JS_GetFramePrincipalArray(JSContext *cx, JSStackFrame *fp);
|
|
|
|
|
1998-10-14 10:22:38 +00:00
|
|
|
/* this is deprecated, use JS_GetFrameScopeChain instead */
|
1998-04-24 00:31:11 +00:00
|
|
|
extern JS_PUBLIC_API(JSObject *)
|
1998-03-28 02:44:41 +00:00
|
|
|
JS_GetFrameObject(JSContext *cx, JSStackFrame *fp);
|
|
|
|
|
1998-10-14 10:22:38 +00:00
|
|
|
extern JS_PUBLIC_API(JSObject *)
|
|
|
|
JS_GetFrameScopeChain(JSContext *cx, JSStackFrame *fp);
|
|
|
|
|
|
|
|
extern JS_PUBLIC_API(JSObject *)
|
|
|
|
JS_GetFrameCallObject(JSContext *cx, JSStackFrame *fp);
|
|
|
|
|
1998-04-24 00:31:11 +00:00
|
|
|
extern JS_PUBLIC_API(JSObject *)
|
1998-03-28 02:44:41 +00:00
|
|
|
JS_GetFrameThis(JSContext *cx, JSStackFrame *fp);
|
|
|
|
|
1998-04-24 00:31:11 +00:00
|
|
|
extern JS_PUBLIC_API(JSFunction *)
|
1998-03-28 02:44:41 +00:00
|
|
|
JS_GetFrameFunction(JSContext *cx, JSStackFrame *fp);
|
|
|
|
|
2000-04-14 03:14:53 +00:00
|
|
|
extern JS_PUBLIC_API(JSObject *)
|
|
|
|
JS_GetFrameFunctionObject(JSContext *cx, JSStackFrame *fp);
|
|
|
|
|
2002-02-14 07:52:02 +00:00
|
|
|
/* XXXrginda Initially published with typo */
|
|
|
|
#define JS_IsContructorFrame JS_IsConstructorFrame
|
1998-10-14 10:22:38 +00:00
|
|
|
extern JS_PUBLIC_API(JSBool)
|
2002-02-14 07:52:02 +00:00
|
|
|
JS_IsConstructorFrame(JSContext *cx, JSStackFrame *fp);
|
1998-10-14 10:22:38 +00:00
|
|
|
|
|
|
|
extern JS_PUBLIC_API(JSBool)
|
|
|
|
JS_IsDebuggerFrame(JSContext *cx, JSStackFrame *fp);
|
|
|
|
|
|
|
|
extern JS_PUBLIC_API(jsval)
|
|
|
|
JS_GetFrameReturnValue(JSContext *cx, JSStackFrame *fp);
|
|
|
|
|
|
|
|
extern JS_PUBLIC_API(void)
|
|
|
|
JS_SetFrameReturnValue(JSContext *cx, JSStackFrame *fp, jsval rval);
|
|
|
|
|
1998-03-28 02:44:41 +00:00
|
|
|
/************************************************************************/
|
|
|
|
|
1998-04-24 00:31:11 +00:00
|
|
|
extern JS_PUBLIC_API(const char *)
|
1998-03-28 02:44:41 +00:00
|
|
|
JS_GetScriptFilename(JSContext *cx, JSScript *script);
|
|
|
|
|
1998-04-24 00:31:11 +00:00
|
|
|
extern JS_PUBLIC_API(uintN)
|
1998-03-28 02:44:41 +00:00
|
|
|
JS_GetScriptBaseLineNumber(JSContext *cx, JSScript *script);
|
|
|
|
|
1998-04-24 00:31:11 +00:00
|
|
|
extern JS_PUBLIC_API(uintN)
|
1998-03-28 02:44:41 +00:00
|
|
|
JS_GetScriptLineExtent(JSContext *cx, JSScript *script);
|
|
|
|
|
|
|
|
/************************************************************************/
|
|
|
|
|
1998-04-24 00:31:11 +00:00
|
|
|
/*
|
|
|
|
* Hook setters for script creation and destruction, see jsprvtd.h for the
|
|
|
|
* typedefs. These macros provide binary compatibility and newer, shorter
|
|
|
|
* synonyms.
|
|
|
|
*/
|
|
|
|
#define JS_SetNewScriptHook JS_SetNewScriptHookProc
|
|
|
|
#define JS_SetDestroyScriptHook JS_SetDestroyScriptHookProc
|
1998-03-28 02:44:41 +00:00
|
|
|
|
1998-04-24 00:31:11 +00:00
|
|
|
extern JS_PUBLIC_API(void)
|
|
|
|
JS_SetNewScriptHook(JSRuntime *rt, JSNewScriptHook hook, void *callerdata);
|
|
|
|
|
|
|
|
extern JS_PUBLIC_API(void)
|
|
|
|
JS_SetDestroyScriptHook(JSRuntime *rt, JSDestroyScriptHook hook,
|
|
|
|
void *callerdata);
|
1998-03-28 02:44:41 +00:00
|
|
|
|
|
|
|
/************************************************************************/
|
|
|
|
|
2001-05-04 23:03:11 +00:00
|
|
|
extern JS_PUBLIC_API(JSBool)
|
|
|
|
JS_EvaluateUCInStackFrame(JSContext *cx, JSStackFrame *fp,
|
|
|
|
const jschar *bytes, uintN length,
|
|
|
|
const char *filename, uintN lineno,
|
|
|
|
jsval *rval);
|
|
|
|
|
1998-04-24 00:31:11 +00:00
|
|
|
extern JS_PUBLIC_API(JSBool)
|
1998-03-28 02:44:41 +00:00
|
|
|
JS_EvaluateInStackFrame(JSContext *cx, JSStackFrame *fp,
|
|
|
|
const char *bytes, uintN length,
|
|
|
|
const char *filename, uintN lineno,
|
|
|
|
jsval *rval);
|
|
|
|
|
|
|
|
/************************************************************************/
|
|
|
|
|
|
|
|
typedef struct JSPropertyDesc {
|
|
|
|
jsval id; /* primary id, a string or int */
|
|
|
|
jsval value; /* property value */
|
|
|
|
uint8 flags; /* flags, see below */
|
|
|
|
uint8 spare; /* unused */
|
|
|
|
uint16 slot; /* argument/variable slot */
|
|
|
|
jsval alias; /* alias id if JSPD_ALIAS flag */
|
|
|
|
} JSPropertyDesc;
|
|
|
|
|
|
|
|
#define JSPD_ENUMERATE 0x01 /* visible to for/in loop */
|
|
|
|
#define JSPD_READONLY 0x02 /* assignment is error */
|
|
|
|
#define JSPD_PERMANENT 0x04 /* property cannot be deleted */
|
|
|
|
#define JSPD_ALIAS 0x08 /* property has an alias id */
|
|
|
|
#define JSPD_ARGUMENT 0x10 /* argument to function */
|
|
|
|
#define JSPD_VARIABLE 0x20 /* local variable in function */
|
|
|
|
|
|
|
|
typedef struct JSPropertyDescArray {
|
|
|
|
uint32 length; /* number of elements in array */
|
|
|
|
JSPropertyDesc *array; /* alloc'd by Get, freed by Put */
|
|
|
|
} JSPropertyDescArray;
|
|
|
|
|
1998-04-24 00:31:11 +00:00
|
|
|
extern JS_PUBLIC_API(JSScopeProperty *)
|
|
|
|
JS_PropertyIterator(JSObject *obj, JSScopeProperty **iteratorp);
|
1998-03-28 02:44:41 +00:00
|
|
|
|
1998-04-24 00:31:11 +00:00
|
|
|
extern JS_PUBLIC_API(JSBool)
|
|
|
|
JS_GetPropertyDesc(JSContext *cx, JSObject *obj, JSScopeProperty *sprop,
|
|
|
|
JSPropertyDesc *pd);
|
1998-03-28 02:44:41 +00:00
|
|
|
|
1998-04-24 00:31:11 +00:00
|
|
|
extern JS_PUBLIC_API(JSBool)
|
1998-03-28 02:44:41 +00:00
|
|
|
JS_GetPropertyDescArray(JSContext *cx, JSObject *obj, JSPropertyDescArray *pda);
|
|
|
|
|
1998-04-24 00:31:11 +00:00
|
|
|
extern JS_PUBLIC_API(void)
|
1998-03-28 02:44:41 +00:00
|
|
|
JS_PutPropertyDescArray(JSContext *cx, JSPropertyDescArray *pda);
|
|
|
|
|
1998-07-31 00:07:22 +00:00
|
|
|
/************************************************************************/
|
|
|
|
|
|
|
|
extern JS_PUBLIC_API(JSBool)
|
|
|
|
JS_SetDebuggerHandler(JSRuntime *rt, JSTrapHandler handler, void *closure);
|
|
|
|
|
1998-10-14 10:22:38 +00:00
|
|
|
extern JS_PUBLIC_API(JSBool)
|
|
|
|
JS_SetSourceHandler(JSRuntime *rt, JSSourceHandler handler, void *closure);
|
|
|
|
|
|
|
|
extern JS_PUBLIC_API(JSBool)
|
|
|
|
JS_SetExecuteHook(JSRuntime *rt, JSInterpreterHook hook, void *closure);
|
|
|
|
|
|
|
|
extern JS_PUBLIC_API(JSBool)
|
|
|
|
JS_SetCallHook(JSRuntime *rt, JSInterpreterHook hook, void *closure);
|
|
|
|
|
|
|
|
extern JS_PUBLIC_API(JSBool)
|
|
|
|
JS_SetObjectHook(JSRuntime *rt, JSObjectHook hook, void *closure);
|
|
|
|
|
1998-11-05 00:08:43 +00:00
|
|
|
extern JS_PUBLIC_API(JSBool)
|
|
|
|
JS_SetThrowHook(JSRuntime *rt, JSTrapHandler hook, void *closure);
|
|
|
|
|
|
|
|
extern JS_PUBLIC_API(JSBool)
|
|
|
|
JS_SetDebugErrorHook(JSRuntime *rt, JSDebugErrorHook hook, void *closure);
|
|
|
|
|
2001-02-02 20:52:06 +00:00
|
|
|
/************************************************************************/
|
|
|
|
|
|
|
|
extern JS_PUBLIC_API(size_t)
|
|
|
|
JS_GetObjectTotalSize(JSContext *cx, JSObject *obj);
|
|
|
|
|
|
|
|
extern JS_PUBLIC_API(size_t)
|
|
|
|
JS_GetFunctionTotalSize(JSContext *cx, JSFunction *fun);
|
|
|
|
|
|
|
|
extern JS_PUBLIC_API(size_t)
|
|
|
|
JS_GetScriptTotalSize(JSContext *cx, JSScript *script);
|
|
|
|
|
1998-10-14 10:22:38 +00:00
|
|
|
JS_END_EXTERN_C
|
1998-03-28 02:44:41 +00:00
|
|
|
|
|
|
|
#endif /* jsdbgapi_h___ */
|