|
|
1.1 ! root 1: /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- ! 2: * ! 3: * ***** BEGIN LICENSE BLOCK ***** ! 4: * Version: MPL 1.1/GPL 2.0/LGPL 2.1 ! 5: * ! 6: * The contents of this file are subject to the Mozilla Public License Version ! 7: * 1.1 (the "License"); you may not use this file except in compliance with ! 8: * the License. You may obtain a copy of the License at ! 9: * http://www.mozilla.org/MPL/ ! 10: * ! 11: * Software distributed under the License is distributed on an "AS IS" basis, ! 12: * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License ! 13: * for the specific language governing rights and limitations under the ! 14: * License. ! 15: * ! 16: * The Original Code is Mozilla Communicator client code, released ! 17: * March 31, 1998. ! 18: * ! 19: * The Initial Developer of the Original Code is ! 20: * Netscape Communications Corporation. ! 21: * Portions created by the Initial Developer are Copyright (C) 1998 ! 22: * the Initial Developer. All Rights Reserved. ! 23: * ! 24: * Contributor(s): ! 25: * ! 26: * Alternatively, the contents of this file may be used under the terms of ! 27: * either of the GNU General Public License Version 2 or later (the "GPL"), ! 28: * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), ! 29: * in which case the provisions of the GPL or the LGPL are applicable instead ! 30: * of those above. If you wish to allow use of your version of this file only ! 31: * under the terms of either the GPL or the LGPL, and not to allow others to ! 32: * use your version of this file under the terms of the MPL, indicate your ! 33: * decision by deleting the provisions above and replace them with the notice ! 34: * and other provisions required by the GPL or the LGPL. If you do not delete ! 35: * the provisions above, a recipient may use your version of this file under ! 36: * the terms of any one of the MPL, the GPL or the LGPL. ! 37: * ! 38: * ***** END LICENSE BLOCK ***** */ ! 39: ! 40: #ifndef jsdbgapi_h___ ! 41: #define jsdbgapi_h___ ! 42: /* ! 43: * JS debugger API. ! 44: */ ! 45: #include "jsapi.h" ! 46: #include "jsopcode.h" ! 47: #include "jsprvtd.h" ! 48: ! 49: JS_BEGIN_EXTERN_C ! 50: ! 51: extern void ! 52: js_PatchOpcode(JSContext *cx, JSScript *script, jsbytecode *pc, JSOp op); ! 53: ! 54: extern JS_PUBLIC_API(JSBool) ! 55: JS_SetTrap(JSContext *cx, JSScript *script, jsbytecode *pc, ! 56: JSTrapHandler handler, void *closure); ! 57: ! 58: extern JS_PUBLIC_API(JSOp) ! 59: JS_GetTrapOpcode(JSContext *cx, JSScript *script, jsbytecode *pc); ! 60: ! 61: extern JS_PUBLIC_API(void) ! 62: JS_ClearTrap(JSContext *cx, JSScript *script, jsbytecode *pc, ! 63: JSTrapHandler *handlerp, void **closurep); ! 64: ! 65: extern JS_PUBLIC_API(void) ! 66: JS_ClearScriptTraps(JSContext *cx, JSScript *script); ! 67: ! 68: extern JS_PUBLIC_API(void) ! 69: JS_ClearAllTraps(JSContext *cx); ! 70: ! 71: extern JS_PUBLIC_API(JSTrapStatus) ! 72: JS_HandleTrap(JSContext *cx, JSScript *script, jsbytecode *pc, jsval *rval); ! 73: ! 74: extern JS_PUBLIC_API(JSBool) ! 75: JS_SetInterrupt(JSRuntime *rt, JSTrapHandler handler, void *closure); ! 76: ! 77: extern JS_PUBLIC_API(JSBool) ! 78: JS_ClearInterrupt(JSRuntime *rt, JSTrapHandler *handlerp, void **closurep); ! 79: ! 80: /************************************************************************/ ! 81: ! 82: extern JS_PUBLIC_API(JSBool) ! 83: JS_SetWatchPoint(JSContext *cx, JSObject *obj, jsval id, ! 84: JSWatchPointHandler handler, void *closure); ! 85: ! 86: extern JS_PUBLIC_API(JSBool) ! 87: JS_ClearWatchPoint(JSContext *cx, JSObject *obj, jsval id, ! 88: JSWatchPointHandler *handlerp, void **closurep); ! 89: ! 90: extern JS_PUBLIC_API(JSBool) ! 91: JS_ClearWatchPointsForObject(JSContext *cx, JSObject *obj); ! 92: ! 93: extern JS_PUBLIC_API(JSBool) ! 94: JS_ClearAllWatchPoints(JSContext *cx); ! 95: ! 96: #ifdef JS_HAS_OBJ_WATCHPOINT ! 97: /* ! 98: * Hide these non-API function prototypes by testing whether the internal ! 99: * header file "jsconfig.h" has been included. ! 100: */ ! 101: extern void ! 102: js_MarkWatchPoints(JSRuntime *rt); ! 103: ! 104: extern JSScopeProperty * ! 105: js_FindWatchPoint(JSRuntime *rt, JSScope *scope, jsid id); ! 106: ! 107: extern JSPropertyOp ! 108: js_GetWatchedSetter(JSRuntime *rt, JSScope *scope, ! 109: const JSScopeProperty *sprop); ! 110: ! 111: extern JSBool JS_DLL_CALLBACK ! 112: js_watch_set(JSContext *cx, JSObject *obj, jsval id, jsval *vp); ! 113: ! 114: extern JSBool JS_DLL_CALLBACK ! 115: js_watch_set_wrapper(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, ! 116: jsval *rval); ! 117: ! 118: extern JSPropertyOp ! 119: js_WrapWatchedSetter(JSContext *cx, jsid id, uintN attrs, JSPropertyOp setter); ! 120: ! 121: #endif /* JS_HAS_OBJ_WATCHPOINT */ ! 122: ! 123: /************************************************************************/ ! 124: ! 125: extern JS_PUBLIC_API(uintN) ! 126: JS_PCToLineNumber(JSContext *cx, JSScript *script, jsbytecode *pc); ! 127: ! 128: extern JS_PUBLIC_API(jsbytecode *) ! 129: JS_LineNumberToPC(JSContext *cx, JSScript *script, uintN lineno); ! 130: ! 131: extern JS_PUBLIC_API(JSScript *) ! 132: JS_GetFunctionScript(JSContext *cx, JSFunction *fun); ! 133: ! 134: extern JS_PUBLIC_API(JSPrincipals *) ! 135: JS_GetScriptPrincipals(JSContext *cx, JSScript *script); ! 136: ! 137: /* ! 138: * Stack Frame Iterator ! 139: * ! 140: * Used to iterate through the JS stack frames to extract ! 141: * information from the frames. ! 142: */ ! 143: ! 144: extern JS_PUBLIC_API(JSStackFrame *) ! 145: JS_FrameIterator(JSContext *cx, JSStackFrame **iteratorp); ! 146: ! 147: extern JS_PUBLIC_API(JSScript *) ! 148: JS_GetFrameScript(JSContext *cx, JSStackFrame *fp); ! 149: ! 150: extern JS_PUBLIC_API(jsbytecode *) ! 151: JS_GetFramePC(JSContext *cx, JSStackFrame *fp); ! 152: ! 153: /* ! 154: * Get the closest scripted frame below fp. If fp is null, start from cx->fp. ! 155: */ ! 156: extern JS_PUBLIC_API(JSStackFrame *) ! 157: JS_GetScriptedCaller(JSContext *cx, JSStackFrame *fp); ! 158: ! 159: /* ! 160: * Return a weak reference to fp's principals. A null return does not denote ! 161: * an error, it means there are no principals. ! 162: */ ! 163: extern JS_PUBLIC_API(JSPrincipals *) ! 164: JS_StackFramePrincipals(JSContext *cx, JSStackFrame *fp); ! 165: ! 166: /* ! 167: * Like JS_StackFramePrincipals(cx, caller), but if cx->findObjectPrincipals ! 168: * is non-null, return the object principals for fp's callee function object ! 169: * (fp->argv[-2]), which is eval, Function, or a similar eval-like method. ! 170: * The caller parameter should be the result of JS_GetScriptedCaller(cx, fp). ! 171: * ! 172: * All eval-like methods must use JS_EvalFramePrincipals to acquire a weak ! 173: * reference to the correct principals for the eval call to be secure, given ! 174: * an embedding that calls JS_SetObjectPrincipalsFinder (see jsapi.h). ! 175: */ ! 176: extern JS_PUBLIC_API(JSPrincipals *) ! 177: JS_EvalFramePrincipals(JSContext *cx, JSStackFrame *fp, JSStackFrame *caller); ! 178: ! 179: extern JS_PUBLIC_API(void *) ! 180: JS_GetFrameAnnotation(JSContext *cx, JSStackFrame *fp); ! 181: ! 182: extern JS_PUBLIC_API(void) ! 183: JS_SetFrameAnnotation(JSContext *cx, JSStackFrame *fp, void *annotation); ! 184: ! 185: extern JS_PUBLIC_API(void *) ! 186: JS_GetFramePrincipalArray(JSContext *cx, JSStackFrame *fp); ! 187: ! 188: extern JS_PUBLIC_API(JSBool) ! 189: JS_IsNativeFrame(JSContext *cx, JSStackFrame *fp); ! 190: ! 191: /* this is deprecated, use JS_GetFrameScopeChain instead */ ! 192: extern JS_PUBLIC_API(JSObject *) ! 193: JS_GetFrameObject(JSContext *cx, JSStackFrame *fp); ! 194: ! 195: extern JS_PUBLIC_API(JSObject *) ! 196: JS_GetFrameScopeChain(JSContext *cx, JSStackFrame *fp); ! 197: ! 198: extern JS_PUBLIC_API(JSObject *) ! 199: JS_GetFrameCallObject(JSContext *cx, JSStackFrame *fp); ! 200: ! 201: extern JS_PUBLIC_API(JSObject *) ! 202: JS_GetFrameThis(JSContext *cx, JSStackFrame *fp); ! 203: ! 204: extern JS_PUBLIC_API(JSFunction *) ! 205: JS_GetFrameFunction(JSContext *cx, JSStackFrame *fp); ! 206: ! 207: extern JS_PUBLIC_API(JSObject *) ! 208: JS_GetFrameFunctionObject(JSContext *cx, JSStackFrame *fp); ! 209: ! 210: /* XXXrginda Initially published with typo */ ! 211: #define JS_IsContructorFrame JS_IsConstructorFrame ! 212: extern JS_PUBLIC_API(JSBool) ! 213: JS_IsConstructorFrame(JSContext *cx, JSStackFrame *fp); ! 214: ! 215: extern JS_PUBLIC_API(JSBool) ! 216: JS_IsDebuggerFrame(JSContext *cx, JSStackFrame *fp); ! 217: ! 218: extern JS_PUBLIC_API(jsval) ! 219: JS_GetFrameReturnValue(JSContext *cx, JSStackFrame *fp); ! 220: ! 221: extern JS_PUBLIC_API(void) ! 222: JS_SetFrameReturnValue(JSContext *cx, JSStackFrame *fp, jsval rval); ! 223: ! 224: /************************************************************************/ ! 225: ! 226: extern JS_PUBLIC_API(const char *) ! 227: JS_GetScriptFilename(JSContext *cx, JSScript *script); ! 228: ! 229: extern JS_PUBLIC_API(uintN) ! 230: JS_GetScriptBaseLineNumber(JSContext *cx, JSScript *script); ! 231: ! 232: extern JS_PUBLIC_API(uintN) ! 233: JS_GetScriptLineExtent(JSContext *cx, JSScript *script); ! 234: ! 235: extern JS_PUBLIC_API(JSVersion) ! 236: JS_GetScriptVersion(JSContext *cx, JSScript *script); ! 237: ! 238: /************************************************************************/ ! 239: ! 240: /* ! 241: * Hook setters for script creation and destruction, see jsprvtd.h for the ! 242: * typedefs. These macros provide binary compatibility and newer, shorter ! 243: * synonyms. ! 244: */ ! 245: #define JS_SetNewScriptHook JS_SetNewScriptHookProc ! 246: #define JS_SetDestroyScriptHook JS_SetDestroyScriptHookProc ! 247: ! 248: extern JS_PUBLIC_API(void) ! 249: JS_SetNewScriptHook(JSRuntime *rt, JSNewScriptHook hook, void *callerdata); ! 250: ! 251: extern JS_PUBLIC_API(void) ! 252: JS_SetDestroyScriptHook(JSRuntime *rt, JSDestroyScriptHook hook, ! 253: void *callerdata); ! 254: ! 255: /************************************************************************/ ! 256: ! 257: extern JS_PUBLIC_API(JSBool) ! 258: JS_EvaluateUCInStackFrame(JSContext *cx, JSStackFrame *fp, ! 259: const jschar *bytes, uintN length, ! 260: const char *filename, uintN lineno, ! 261: jsval *rval); ! 262: ! 263: extern JS_PUBLIC_API(JSBool) ! 264: JS_EvaluateInStackFrame(JSContext *cx, JSStackFrame *fp, ! 265: const char *bytes, uintN length, ! 266: const char *filename, uintN lineno, ! 267: jsval *rval); ! 268: ! 269: /************************************************************************/ ! 270: ! 271: typedef struct JSPropertyDesc { ! 272: jsval id; /* primary id, a string or int */ ! 273: jsval value; /* property value */ ! 274: uint8 flags; /* flags, see below */ ! 275: uint8 spare; /* unused */ ! 276: uint16 slot; /* argument/variable slot */ ! 277: jsval alias; /* alias id if JSPD_ALIAS flag */ ! 278: } JSPropertyDesc; ! 279: ! 280: #define JSPD_ENUMERATE 0x01 /* visible to for/in loop */ ! 281: #define JSPD_READONLY 0x02 /* assignment is error */ ! 282: #define JSPD_PERMANENT 0x04 /* property cannot be deleted */ ! 283: #define JSPD_ALIAS 0x08 /* property has an alias id */ ! 284: #define JSPD_ARGUMENT 0x10 /* argument to function */ ! 285: #define JSPD_VARIABLE 0x20 /* local variable in function */ ! 286: #define JSPD_EXCEPTION 0x40 /* exception occurred fetching the property, */ ! 287: /* value is exception */ ! 288: #define JSPD_ERROR 0x80 /* native getter returned JS_FALSE without */ ! 289: /* throwing an exception */ ! 290: ! 291: typedef struct JSPropertyDescArray { ! 292: uint32 length; /* number of elements in array */ ! 293: JSPropertyDesc *array; /* alloc'd by Get, freed by Put */ ! 294: } JSPropertyDescArray; ! 295: ! 296: extern JS_PUBLIC_API(JSScopeProperty *) ! 297: JS_PropertyIterator(JSObject *obj, JSScopeProperty **iteratorp); ! 298: ! 299: extern JS_PUBLIC_API(JSBool) ! 300: JS_GetPropertyDesc(JSContext *cx, JSObject *obj, JSScopeProperty *sprop, ! 301: JSPropertyDesc *pd); ! 302: ! 303: extern JS_PUBLIC_API(JSBool) ! 304: JS_GetPropertyDescArray(JSContext *cx, JSObject *obj, JSPropertyDescArray *pda); ! 305: ! 306: extern JS_PUBLIC_API(void) ! 307: JS_PutPropertyDescArray(JSContext *cx, JSPropertyDescArray *pda); ! 308: ! 309: /************************************************************************/ ! 310: ! 311: extern JS_PUBLIC_API(JSBool) ! 312: JS_SetDebuggerHandler(JSRuntime *rt, JSTrapHandler handler, void *closure); ! 313: ! 314: extern JS_PUBLIC_API(JSBool) ! 315: JS_SetSourceHandler(JSRuntime *rt, JSSourceHandler handler, void *closure); ! 316: ! 317: extern JS_PUBLIC_API(JSBool) ! 318: JS_SetExecuteHook(JSRuntime *rt, JSInterpreterHook hook, void *closure); ! 319: ! 320: extern JS_PUBLIC_API(JSBool) ! 321: JS_SetCallHook(JSRuntime *rt, JSInterpreterHook hook, void *closure); ! 322: ! 323: extern JS_PUBLIC_API(JSBool) ! 324: JS_SetObjectHook(JSRuntime *rt, JSObjectHook hook, void *closure); ! 325: ! 326: extern JS_PUBLIC_API(JSBool) ! 327: JS_SetThrowHook(JSRuntime *rt, JSTrapHandler hook, void *closure); ! 328: ! 329: extern JS_PUBLIC_API(JSBool) ! 330: JS_SetDebugErrorHook(JSRuntime *rt, JSDebugErrorHook hook, void *closure); ! 331: ! 332: /************************************************************************/ ! 333: ! 334: extern JS_PUBLIC_API(size_t) ! 335: JS_GetObjectTotalSize(JSContext *cx, JSObject *obj); ! 336: ! 337: extern JS_PUBLIC_API(size_t) ! 338: JS_GetFunctionTotalSize(JSContext *cx, JSFunction *fun); ! 339: ! 340: extern JS_PUBLIC_API(size_t) ! 341: JS_GetScriptTotalSize(JSContext *cx, JSScript *script); ! 342: ! 343: JS_END_EXTERN_C ! 344: ! 345: #endif /* jsdbgapi_h___ */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.