js/public/OldDebugAPI.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
michael@0 2 * vim: set ts=8 sts=4 et sw=4 tw=99:
michael@0 3 * This Source Code Form is subject to the terms of the Mozilla Public
michael@0 4 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 6
michael@0 7 #ifndef js_OldDebugAPI_h
michael@0 8 #define js_OldDebugAPI_h
michael@0 9
michael@0 10 /*
michael@0 11 * JS debugger API.
michael@0 12 */
michael@0 13
michael@0 14 #include "mozilla/NullPtr.h"
michael@0 15
michael@0 16 #include "jsapi.h"
michael@0 17 #include "jsbytecode.h"
michael@0 18
michael@0 19 #include "js/CallArgs.h"
michael@0 20 #include "js/TypeDecls.h"
michael@0 21
michael@0 22 class JSAtom;
michael@0 23 class JSFreeOp;
michael@0 24
michael@0 25 namespace js {
michael@0 26 class InterpreterFrame;
michael@0 27 class ScriptFrameIter;
michael@0 28 }
michael@0 29
michael@0 30 // Raw JSScript* because this needs to be callable from a signal handler.
michael@0 31 extern JS_PUBLIC_API(unsigned)
michael@0 32 JS_PCToLineNumber(JSContext *cx, JSScript *script, jsbytecode *pc);
michael@0 33
michael@0 34 extern JS_PUBLIC_API(const char *)
michael@0 35 JS_GetScriptFilename(JSScript *script);
michael@0 36
michael@0 37 namespace JS {
michael@0 38
michael@0 39 class FrameDescription
michael@0 40 {
michael@0 41 public:
michael@0 42 explicit FrameDescription(const js::ScriptFrameIter& iter);
michael@0 43
michael@0 44 unsigned lineno() {
michael@0 45 if (!linenoComputed) {
michael@0 46 lineno_ = JS_PCToLineNumber(nullptr, script_, pc_);
michael@0 47 linenoComputed = true;
michael@0 48 }
michael@0 49 return lineno_;
michael@0 50 }
michael@0 51
michael@0 52 const char *filename() const {
michael@0 53 return JS_GetScriptFilename(script_);
michael@0 54 }
michael@0 55
michael@0 56 JSFlatString *funDisplayName() const {
michael@0 57 return funDisplayName_ ? JS_ASSERT_STRING_IS_FLAT(funDisplayName_) : nullptr;
michael@0 58 }
michael@0 59
michael@0 60 // Both these locations should be traced during GC but otherwise not used;
michael@0 61 // they are implementation details.
michael@0 62 Heap<JSScript*> &markedLocation1() {
michael@0 63 return script_;
michael@0 64 }
michael@0 65 Heap<JSString*> &markedLocation2() {
michael@0 66 return funDisplayName_;
michael@0 67 }
michael@0 68
michael@0 69 private:
michael@0 70 Heap<JSScript*> script_;
michael@0 71 Heap<JSString*> funDisplayName_;
michael@0 72 jsbytecode *pc_;
michael@0 73 unsigned lineno_;
michael@0 74 bool linenoComputed;
michael@0 75 };
michael@0 76
michael@0 77 struct StackDescription
michael@0 78 {
michael@0 79 unsigned nframes;
michael@0 80 FrameDescription *frames;
michael@0 81 };
michael@0 82
michael@0 83 extern JS_PUBLIC_API(StackDescription *)
michael@0 84 DescribeStack(JSContext *cx, unsigned maxFrames);
michael@0 85
michael@0 86 extern JS_PUBLIC_API(void)
michael@0 87 FreeStackDescription(JSContext *cx, StackDescription *desc);
michael@0 88
michael@0 89 extern JS_PUBLIC_API(char *)
michael@0 90 FormatStackDump(JSContext *cx, char *buf, bool showArgs, bool showLocals, bool showThisProps);
michael@0 91
michael@0 92 } // namespace JS
michael@0 93
michael@0 94 # ifdef JS_DEBUG
michael@0 95 JS_FRIEND_API(void) js_DumpValue(const JS::Value &val);
michael@0 96 JS_FRIEND_API(void) js_DumpId(jsid id);
michael@0 97 JS_FRIEND_API(void) js_DumpInterpreterFrame(JSContext *cx, js::InterpreterFrame *start = nullptr);
michael@0 98 # endif
michael@0 99
michael@0 100 JS_FRIEND_API(void)
michael@0 101 js_DumpBacktrace(JSContext *cx);
michael@0 102
michael@0 103 typedef enum JSTrapStatus {
michael@0 104 JSTRAP_ERROR,
michael@0 105 JSTRAP_CONTINUE,
michael@0 106 JSTRAP_RETURN,
michael@0 107 JSTRAP_THROW,
michael@0 108 JSTRAP_LIMIT
michael@0 109 } JSTrapStatus;
michael@0 110
michael@0 111 typedef JSTrapStatus
michael@0 112 (* JSTrapHandler)(JSContext *cx, JSScript *script, jsbytecode *pc, JS::Value *rval,
michael@0 113 JS::Value closure);
michael@0 114
michael@0 115 typedef JSTrapStatus
michael@0 116 (* JSInterruptHook)(JSContext *cx, JSScript *script, jsbytecode *pc, JS::Value *rval,
michael@0 117 void *closure);
michael@0 118
michael@0 119 typedef JSTrapStatus
michael@0 120 (* JSDebuggerHandler)(JSContext *cx, JSScript *script, jsbytecode *pc, JS::Value *rval,
michael@0 121 void *closure);
michael@0 122
michael@0 123 typedef JSTrapStatus
michael@0 124 (* JSThrowHook)(JSContext *cx, JSScript *script, jsbytecode *pc, JS::Value *rval,
michael@0 125 void *closure);
michael@0 126
michael@0 127 typedef bool
michael@0 128 (* JSWatchPointHandler)(JSContext *cx, JSObject *obj, jsid id, JS::Value old,
michael@0 129 JS::Value *newp, void *closure);
michael@0 130
michael@0 131 /* called just after script creation */
michael@0 132 typedef void
michael@0 133 (* JSNewScriptHook)(JSContext *cx,
michael@0 134 const char *filename, /* URL of script */
michael@0 135 unsigned lineno, /* first line */
michael@0 136 JSScript *script,
michael@0 137 JSFunction *fun,
michael@0 138 void *callerdata);
michael@0 139
michael@0 140 /* called just before script destruction */
michael@0 141 typedef void
michael@0 142 (* JSDestroyScriptHook)(JSFreeOp *fop,
michael@0 143 JSScript *script,
michael@0 144 void *callerdata);
michael@0 145
michael@0 146 typedef void
michael@0 147 (* JSSourceHandler)(const char *filename, unsigned lineno, const jschar *str,
michael@0 148 size_t length, void **listenerTSData, void *closure);
michael@0 149
michael@0 150
michael@0 151
michael@0 152 extern JS_PUBLIC_API(JSCompartment *)
michael@0 153 JS_EnterCompartmentOfScript(JSContext *cx, JSScript *target);
michael@0 154
michael@0 155 extern JS_PUBLIC_API(JSString *)
michael@0 156 JS_DecompileScript(JSContext *cx, JS::HandleScript script, const char *name, unsigned indent);
michael@0 157
michael@0 158 /*
michael@0 159 * Currently, we only support runtime-wide debugging. In the future, we should
michael@0 160 * be able to support compartment-wide debugging.
michael@0 161 */
michael@0 162 extern JS_PUBLIC_API(void)
michael@0 163 JS_SetRuntimeDebugMode(JSRuntime *rt, bool debug);
michael@0 164
michael@0 165 /*
michael@0 166 * Debug mode is a compartment-wide mode that enables a debugger to attach
michael@0 167 * to and interact with running methodjit-ed frames. In particular, it causes
michael@0 168 * every function to be compiled as if an eval was present (so eval-in-frame)
michael@0 169 * can work, and it ensures that functions can be re-JITed for other debug
michael@0 170 * features. In general, it is not safe to interact with frames that were live
michael@0 171 * before debug mode was enabled. For this reason, it is also not safe to
michael@0 172 * enable debug mode while frames are live.
michael@0 173 */
michael@0 174
michael@0 175 /* Get current state of debugging mode. */
michael@0 176 extern JS_PUBLIC_API(bool)
michael@0 177 JS_GetDebugMode(JSContext *cx);
michael@0 178
michael@0 179 /*
michael@0 180 * Turn on/off debugging mode for all compartments. This returns false if any code
michael@0 181 * from any of the runtime's compartments is running or on the stack.
michael@0 182 */
michael@0 183 JS_FRIEND_API(bool)
michael@0 184 JS_SetDebugModeForAllCompartments(JSContext *cx, bool debug);
michael@0 185
michael@0 186 /*
michael@0 187 * Turn on/off debugging mode for a single compartment. This should only be
michael@0 188 * used when no code from this compartment is running or on the stack in any
michael@0 189 * thread.
michael@0 190 */
michael@0 191 JS_FRIEND_API(bool)
michael@0 192 JS_SetDebugModeForCompartment(JSContext *cx, JSCompartment *comp, bool debug);
michael@0 193
michael@0 194 /*
michael@0 195 * Turn on/off debugging mode for a context's compartment.
michael@0 196 */
michael@0 197 JS_FRIEND_API(bool)
michael@0 198 JS_SetDebugMode(JSContext *cx, bool debug);
michael@0 199
michael@0 200 /* Turn on single step mode. */
michael@0 201 extern JS_PUBLIC_API(bool)
michael@0 202 JS_SetSingleStepMode(JSContext *cx, JS::HandleScript script, bool singleStep);
michael@0 203
michael@0 204 /* The closure argument will be marked. */
michael@0 205 extern JS_PUBLIC_API(bool)
michael@0 206 JS_SetTrap(JSContext *cx, JS::HandleScript script, jsbytecode *pc,
michael@0 207 JSTrapHandler handler, JS::HandleValue closure);
michael@0 208
michael@0 209 extern JS_PUBLIC_API(void)
michael@0 210 JS_ClearTrap(JSContext *cx, JSScript *script, jsbytecode *pc,
michael@0 211 JSTrapHandler *handlerp, JS::Value *closurep);
michael@0 212
michael@0 213 extern JS_PUBLIC_API(void)
michael@0 214 JS_ClearScriptTraps(JSRuntime *rt, JSScript *script);
michael@0 215
michael@0 216 extern JS_PUBLIC_API(void)
michael@0 217 JS_ClearAllTrapsForCompartment(JSContext *cx);
michael@0 218
michael@0 219 extern JS_PUBLIC_API(bool)
michael@0 220 JS_SetInterrupt(JSRuntime *rt, JSInterruptHook handler, void *closure);
michael@0 221
michael@0 222 extern JS_PUBLIC_API(bool)
michael@0 223 JS_ClearInterrupt(JSRuntime *rt, JSInterruptHook *handlerp, void **closurep);
michael@0 224
michael@0 225 /************************************************************************/
michael@0 226
michael@0 227 extern JS_PUBLIC_API(bool)
michael@0 228 JS_SetWatchPoint(JSContext *cx, JS::HandleObject obj, JS::HandleId id,
michael@0 229 JSWatchPointHandler handler, JS::HandleObject closure);
michael@0 230
michael@0 231 extern JS_PUBLIC_API(bool)
michael@0 232 JS_ClearWatchPoint(JSContext *cx, JSObject *obj, jsid id,
michael@0 233 JSWatchPointHandler *handlerp, JSObject **closurep);
michael@0 234
michael@0 235 extern JS_PUBLIC_API(bool)
michael@0 236 JS_ClearWatchPointsForObject(JSContext *cx, JSObject *obj);
michael@0 237
michael@0 238 /************************************************************************/
michael@0 239
michael@0 240 extern JS_PUBLIC_API(jsbytecode *)
michael@0 241 JS_LineNumberToPC(JSContext *cx, JSScript *script, unsigned lineno);
michael@0 242
michael@0 243 extern JS_PUBLIC_API(jsbytecode *)
michael@0 244 JS_EndPC(JSContext *cx, JSScript *script);
michael@0 245
michael@0 246 extern JS_PUBLIC_API(bool)
michael@0 247 JS_GetLinePCs(JSContext *cx, JSScript *script,
michael@0 248 unsigned startLine, unsigned maxLines,
michael@0 249 unsigned* count, unsigned** lines, jsbytecode*** pcs);
michael@0 250
michael@0 251 extern JS_PUBLIC_API(unsigned)
michael@0 252 JS_GetFunctionArgumentCount(JSContext *cx, JSFunction *fun);
michael@0 253
michael@0 254 extern JS_PUBLIC_API(bool)
michael@0 255 JS_FunctionHasLocalNames(JSContext *cx, JSFunction *fun);
michael@0 256
michael@0 257 /*
michael@0 258 * N.B. The mark is in the context temp pool and thus the caller must take care
michael@0 259 * to call JS_ReleaseFunctionLocalNameArray in a LIFO manner (wrt to any other
michael@0 260 * call that may use the temp pool.
michael@0 261 */
michael@0 262 extern JS_PUBLIC_API(uintptr_t *)
michael@0 263 JS_GetFunctionLocalNameArray(JSContext *cx, JSFunction *fun, void **markp);
michael@0 264
michael@0 265 extern JS_PUBLIC_API(JSAtom *)
michael@0 266 JS_LocalNameToAtom(uintptr_t w);
michael@0 267
michael@0 268 extern JS_PUBLIC_API(JSString *)
michael@0 269 JS_AtomKey(JSAtom *atom);
michael@0 270
michael@0 271 extern JS_PUBLIC_API(void)
michael@0 272 JS_ReleaseFunctionLocalNameArray(JSContext *cx, void *mark);
michael@0 273
michael@0 274 extern JS_PUBLIC_API(JSScript *)
michael@0 275 JS_GetFunctionScript(JSContext *cx, JS::HandleFunction fun);
michael@0 276
michael@0 277 extern JS_PUBLIC_API(JSNative)
michael@0 278 JS_GetFunctionNative(JSContext *cx, JSFunction *fun);
michael@0 279
michael@0 280 extern JS_PUBLIC_API(JSPrincipals *)
michael@0 281 JS_GetScriptPrincipals(JSScript *script);
michael@0 282
michael@0 283 extern JS_PUBLIC_API(JSPrincipals *)
michael@0 284 JS_GetScriptOriginPrincipals(JSScript *script);
michael@0 285
michael@0 286 JS_PUBLIC_API(JSFunction *)
michael@0 287 JS_GetScriptFunction(JSContext *cx, JSScript *script);
michael@0 288
michael@0 289 extern JS_PUBLIC_API(JSObject *)
michael@0 290 JS_GetParentOrScopeChain(JSContext *cx, JSObject *obj);
michael@0 291
michael@0 292 /************************************************************************/
michael@0 293
michael@0 294 /*
michael@0 295 * This is almost JS_GetClass(obj)->name except that certain debug-only
michael@0 296 * proxies are made transparent. In particular, this function turns the class
michael@0 297 * of any scope (returned via JS_GetFrameScopeChain or JS_GetFrameCalleeObject)
michael@0 298 * from "Proxy" to "Call", "Block", "With" etc.
michael@0 299 */
michael@0 300 extern JS_PUBLIC_API(const char *)
michael@0 301 JS_GetDebugClassName(JSObject *obj);
michael@0 302
michael@0 303 /************************************************************************/
michael@0 304
michael@0 305 extern JS_PUBLIC_API(const jschar *)
michael@0 306 JS_GetScriptSourceMap(JSContext *cx, JSScript *script);
michael@0 307
michael@0 308 extern JS_PUBLIC_API(unsigned)
michael@0 309 JS_GetScriptBaseLineNumber(JSContext *cx, JSScript *script);
michael@0 310
michael@0 311 extern JS_PUBLIC_API(unsigned)
michael@0 312 JS_GetScriptLineExtent(JSContext *cx, JSScript *script);
michael@0 313
michael@0 314 extern JS_PUBLIC_API(JSVersion)
michael@0 315 JS_GetScriptVersion(JSContext *cx, JSScript *script);
michael@0 316
michael@0 317 extern JS_PUBLIC_API(bool)
michael@0 318 JS_GetScriptIsSelfHosted(JSScript *script);
michael@0 319
michael@0 320 /************************************************************************/
michael@0 321
michael@0 322 /*
michael@0 323 * Hook setters for script creation and destruction. These macros provide
michael@0 324 * binary compatibility and newer, shorter synonyms.
michael@0 325 */
michael@0 326 #define JS_SetNewScriptHook JS_SetNewScriptHookProc
michael@0 327 #define JS_SetDestroyScriptHook JS_SetDestroyScriptHookProc
michael@0 328
michael@0 329 extern JS_PUBLIC_API(void)
michael@0 330 JS_SetNewScriptHook(JSRuntime *rt, JSNewScriptHook hook, void *callerdata);
michael@0 331
michael@0 332 extern JS_PUBLIC_API(void)
michael@0 333 JS_SetDestroyScriptHook(JSRuntime *rt, JSDestroyScriptHook hook,
michael@0 334 void *callerdata);
michael@0 335
michael@0 336 /************************************************************************/
michael@0 337
michael@0 338 typedef struct JSPropertyDesc {
michael@0 339 JS::Value id; /* primary id, atomized string, or int */
michael@0 340 JS::Value value; /* property value */
michael@0 341 uint8_t flags; /* flags, see below */
michael@0 342 uint8_t spare; /* unused */
michael@0 343 JS::Value alias; /* alias id if JSPD_ALIAS flag */
michael@0 344 } JSPropertyDesc;
michael@0 345
michael@0 346 #define JSPD_ENUMERATE 0x01 /* visible to for/in loop */
michael@0 347 #define JSPD_READONLY 0x02 /* assignment is error */
michael@0 348 #define JSPD_PERMANENT 0x04 /* property cannot be deleted */
michael@0 349 #define JSPD_ALIAS 0x08 /* property has an alias id */
michael@0 350 #define JSPD_EXCEPTION 0x40 /* exception occurred fetching the property, */
michael@0 351 /* value is exception */
michael@0 352 #define JSPD_ERROR 0x80 /* native getter returned false without */
michael@0 353 /* throwing an exception */
michael@0 354
michael@0 355 typedef struct JSPropertyDescArray {
michael@0 356 uint32_t length; /* number of elements in array */
michael@0 357 JSPropertyDesc *array; /* alloc'd by Get, freed by Put */
michael@0 358 } JSPropertyDescArray;
michael@0 359
michael@0 360 typedef struct JSScopeProperty JSScopeProperty;
michael@0 361
michael@0 362 extern JS_PUBLIC_API(bool)
michael@0 363 JS_GetPropertyDescArray(JSContext *cx, JS::HandleObject obj, JSPropertyDescArray *pda);
michael@0 364
michael@0 365 extern JS_PUBLIC_API(void)
michael@0 366 JS_PutPropertyDescArray(JSContext *cx, JSPropertyDescArray *pda);
michael@0 367
michael@0 368 /************************************************************************/
michael@0 369
michael@0 370 /*
michael@0 371 * JSAbstractFramePtr is the public version of AbstractFramePtr, a pointer to a
michael@0 372 * StackFrame or baseline JIT frame.
michael@0 373 */
michael@0 374 class JS_PUBLIC_API(JSAbstractFramePtr)
michael@0 375 {
michael@0 376 uintptr_t ptr_;
michael@0 377 jsbytecode *pc_;
michael@0 378
michael@0 379 protected:
michael@0 380 JSAbstractFramePtr()
michael@0 381 : ptr_(0), pc_(nullptr)
michael@0 382 { }
michael@0 383
michael@0 384 public:
michael@0 385 JSAbstractFramePtr(void *raw, jsbytecode *pc);
michael@0 386
michael@0 387 uintptr_t raw() const { return ptr_; }
michael@0 388 jsbytecode *pc() const { return pc_; }
michael@0 389
michael@0 390 operator bool() const { return !!ptr_; }
michael@0 391
michael@0 392 JSObject *scopeChain(JSContext *cx);
michael@0 393 JSObject *callObject(JSContext *cx);
michael@0 394
michael@0 395 JSFunction *maybeFun();
michael@0 396 JSScript *script();
michael@0 397
michael@0 398 bool getThisValue(JSContext *cx, JS::MutableHandleValue thisv);
michael@0 399
michael@0 400 bool isDebuggerFrame();
michael@0 401
michael@0 402 bool evaluateInStackFrame(JSContext *cx,
michael@0 403 const char *bytes, unsigned length,
michael@0 404 const char *filename, unsigned lineno,
michael@0 405 JS::MutableHandleValue rval);
michael@0 406
michael@0 407 bool evaluateUCInStackFrame(JSContext *cx,
michael@0 408 const jschar *chars, unsigned length,
michael@0 409 const char *filename, unsigned lineno,
michael@0 410 JS::MutableHandleValue rval);
michael@0 411 };
michael@0 412
michael@0 413 class JS_PUBLIC_API(JSNullFramePtr) : public JSAbstractFramePtr
michael@0 414 {
michael@0 415 public:
michael@0 416 JSNullFramePtr()
michael@0 417 : JSAbstractFramePtr()
michael@0 418 {}
michael@0 419 };
michael@0 420
michael@0 421 /*
michael@0 422 * This class does not work when IonMonkey is active. It's only used by jsd,
michael@0 423 * which can only be used when IonMonkey is disabled.
michael@0 424 *
michael@0 425 * To find the calling script and line number, use JS_DescribeSciptedCaller.
michael@0 426 * To summarize the call stack, use JS::DescribeStack.
michael@0 427 */
michael@0 428 class JS_PUBLIC_API(JSBrokenFrameIterator)
michael@0 429 {
michael@0 430 void *data_;
michael@0 431
michael@0 432 public:
michael@0 433 JSBrokenFrameIterator(JSContext *cx);
michael@0 434 ~JSBrokenFrameIterator();
michael@0 435
michael@0 436 bool done() const;
michael@0 437 JSBrokenFrameIterator& operator++();
michael@0 438
michael@0 439 JSAbstractFramePtr abstractFramePtr() const;
michael@0 440 jsbytecode *pc() const;
michael@0 441
michael@0 442 bool isConstructing() const;
michael@0 443 };
michael@0 444
michael@0 445 /*
michael@0 446 * This hook captures high level script execution and function calls (JS or
michael@0 447 * native). It is used by JS_SetExecuteHook to hook top level scripts and by
michael@0 448 * JS_SetCallHook to hook function calls. It will get called twice per script
michael@0 449 * or function call: just before execution begins and just after it finishes.
michael@0 450 * In both cases the 'current' frame is that of the executing code.
michael@0 451 *
michael@0 452 * The 'before' param is true for the hook invocation before the execution
michael@0 453 * and false for the invocation after the code has run.
michael@0 454 *
michael@0 455 * The 'ok' param is significant only on the post execution invocation to
michael@0 456 * signify whether or not the code completed 'normally'.
michael@0 457 *
michael@0 458 * The 'closure' param is as passed to JS_SetExecuteHook or JS_SetCallHook
michael@0 459 * for the 'before'invocation, but is whatever value is returned from that
michael@0 460 * invocation for the 'after' invocation. Thus, the hook implementor *could*
michael@0 461 * allocate a structure in the 'before' invocation and return a pointer to that
michael@0 462 * structure. The pointer would then be handed to the hook for the 'after'
michael@0 463 * invocation. Alternately, the 'before' could just return the same value as
michael@0 464 * in 'closure' to cause the 'after' invocation to be called with the same
michael@0 465 * 'closure' value as the 'before'.
michael@0 466 *
michael@0 467 * Returning nullptr in the 'before' hook will cause the 'after' hook *not* to
michael@0 468 * be called.
michael@0 469 */
michael@0 470 typedef void *
michael@0 471 (* JSInterpreterHook)(JSContext *cx, JSAbstractFramePtr frame, bool isConstructing,
michael@0 472 bool before, bool *ok, void *closure);
michael@0 473
michael@0 474 typedef bool
michael@0 475 (* JSDebugErrorHook)(JSContext *cx, const char *message, JSErrorReport *report,
michael@0 476 void *closure);
michael@0 477
michael@0 478 typedef struct JSDebugHooks {
michael@0 479 JSInterruptHook interruptHook;
michael@0 480 void *interruptHookData;
michael@0 481 JSNewScriptHook newScriptHook;
michael@0 482 void *newScriptHookData;
michael@0 483 JSDestroyScriptHook destroyScriptHook;
michael@0 484 void *destroyScriptHookData;
michael@0 485 JSDebuggerHandler debuggerHandler;
michael@0 486 void *debuggerHandlerData;
michael@0 487 JSSourceHandler sourceHandler;
michael@0 488 void *sourceHandlerData;
michael@0 489 JSInterpreterHook executeHook;
michael@0 490 void *executeHookData;
michael@0 491 JSInterpreterHook callHook;
michael@0 492 void *callHookData;
michael@0 493 JSThrowHook throwHook;
michael@0 494 void *throwHookData;
michael@0 495 JSDebugErrorHook debugErrorHook;
michael@0 496 void *debugErrorHookData;
michael@0 497 } JSDebugHooks;
michael@0 498
michael@0 499 /************************************************************************/
michael@0 500
michael@0 501 extern JS_PUBLIC_API(bool)
michael@0 502 JS_SetDebuggerHandler(JSRuntime *rt, JSDebuggerHandler hook, void *closure);
michael@0 503
michael@0 504 extern JS_PUBLIC_API(bool)
michael@0 505 JS_SetSourceHandler(JSRuntime *rt, JSSourceHandler handler, void *closure);
michael@0 506
michael@0 507 extern JS_PUBLIC_API(bool)
michael@0 508 JS_SetExecuteHook(JSRuntime *rt, JSInterpreterHook hook, void *closure);
michael@0 509
michael@0 510 extern JS_PUBLIC_API(bool)
michael@0 511 JS_SetCallHook(JSRuntime *rt, JSInterpreterHook hook, void *closure);
michael@0 512
michael@0 513 extern JS_PUBLIC_API(bool)
michael@0 514 JS_SetThrowHook(JSRuntime *rt, JSThrowHook hook, void *closure);
michael@0 515
michael@0 516 extern JS_PUBLIC_API(bool)
michael@0 517 JS_SetDebugErrorHook(JSRuntime *rt, JSDebugErrorHook hook, void *closure);
michael@0 518
michael@0 519 /************************************************************************/
michael@0 520
michael@0 521 extern JS_PUBLIC_API(const JSDebugHooks *)
michael@0 522 JS_GetGlobalDebugHooks(JSRuntime *rt);
michael@0 523
michael@0 524 /**
michael@0 525 * Add various profiling-related functions as properties of the given object.
michael@0 526 */
michael@0 527 extern JS_PUBLIC_API(bool)
michael@0 528 JS_DefineProfilingFunctions(JSContext *cx, JSObject *obj);
michael@0 529
michael@0 530 /* Defined in vm/Debugger.cpp. */
michael@0 531 extern JS_PUBLIC_API(bool)
michael@0 532 JS_DefineDebuggerObject(JSContext *cx, JS::HandleObject obj);
michael@0 533
michael@0 534 extern JS_PUBLIC_API(void)
michael@0 535 JS_DumpPCCounts(JSContext *cx, JS::HandleScript script);
michael@0 536
michael@0 537 extern JS_PUBLIC_API(void)
michael@0 538 JS_DumpCompartmentPCCounts(JSContext *cx);
michael@0 539
michael@0 540 namespace js {
michael@0 541 extern JS_FRIEND_API(bool)
michael@0 542 CanCallContextDebugHandler(JSContext *cx);
michael@0 543 }
michael@0 544
michael@0 545 /* Call the context debug handler on the topmost scripted frame. */
michael@0 546 extern JS_FRIEND_API(bool)
michael@0 547 js_CallContextDebugHandler(JSContext *cx);
michael@0 548
michael@0 549 #endif /* js_OldDebugAPI_h */

mercurial