js/public/OldDebugAPI.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/public/OldDebugAPI.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,549 @@
     1.4 +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
     1.5 + * vim: set ts=8 sts=4 et sw=4 tw=99:
     1.6 + * This Source Code Form is subject to the terms of the Mozilla Public
     1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.9 +
    1.10 +#ifndef js_OldDebugAPI_h
    1.11 +#define js_OldDebugAPI_h
    1.12 +
    1.13 +/*
    1.14 + * JS debugger API.
    1.15 + */
    1.16 +
    1.17 +#include "mozilla/NullPtr.h"
    1.18 +
    1.19 +#include "jsapi.h"
    1.20 +#include "jsbytecode.h"
    1.21 +
    1.22 +#include "js/CallArgs.h"
    1.23 +#include "js/TypeDecls.h"
    1.24 +
    1.25 +class JSAtom;
    1.26 +class JSFreeOp;
    1.27 +
    1.28 +namespace js {
    1.29 +class InterpreterFrame;
    1.30 +class ScriptFrameIter;
    1.31 +}
    1.32 +
    1.33 +// Raw JSScript* because this needs to be callable from a signal handler.
    1.34 +extern JS_PUBLIC_API(unsigned)
    1.35 +JS_PCToLineNumber(JSContext *cx, JSScript *script, jsbytecode *pc);
    1.36 +
    1.37 +extern JS_PUBLIC_API(const char *)
    1.38 +JS_GetScriptFilename(JSScript *script);
    1.39 +
    1.40 +namespace JS {
    1.41 +
    1.42 +class FrameDescription
    1.43 +{
    1.44 +  public:
    1.45 +    explicit FrameDescription(const js::ScriptFrameIter& iter);
    1.46 +
    1.47 +    unsigned lineno() {
    1.48 +        if (!linenoComputed) {
    1.49 +            lineno_ = JS_PCToLineNumber(nullptr, script_, pc_);
    1.50 +            linenoComputed = true;
    1.51 +        }
    1.52 +        return lineno_;
    1.53 +    }
    1.54 +
    1.55 +    const char *filename() const {
    1.56 +        return JS_GetScriptFilename(script_);
    1.57 +    }
    1.58 +
    1.59 +    JSFlatString *funDisplayName() const {
    1.60 +        return funDisplayName_ ? JS_ASSERT_STRING_IS_FLAT(funDisplayName_) : nullptr;
    1.61 +    }
    1.62 +
    1.63 +    // Both these locations should be traced during GC but otherwise not used;
    1.64 +    // they are implementation details.
    1.65 +    Heap<JSScript*> &markedLocation1() {
    1.66 +        return script_;
    1.67 +    }
    1.68 +    Heap<JSString*> &markedLocation2() {
    1.69 +        return funDisplayName_;
    1.70 +    }
    1.71 +
    1.72 +  private:
    1.73 +    Heap<JSScript*> script_;
    1.74 +    Heap<JSString*> funDisplayName_;
    1.75 +    jsbytecode *pc_;
    1.76 +    unsigned lineno_;
    1.77 +    bool linenoComputed;
    1.78 +};
    1.79 +
    1.80 +struct StackDescription
    1.81 +{
    1.82 +    unsigned nframes;
    1.83 +    FrameDescription *frames;
    1.84 +};
    1.85 +
    1.86 +extern JS_PUBLIC_API(StackDescription *)
    1.87 +DescribeStack(JSContext *cx, unsigned maxFrames);
    1.88 +
    1.89 +extern JS_PUBLIC_API(void)
    1.90 +FreeStackDescription(JSContext *cx, StackDescription *desc);
    1.91 +
    1.92 +extern JS_PUBLIC_API(char *)
    1.93 +FormatStackDump(JSContext *cx, char *buf, bool showArgs, bool showLocals, bool showThisProps);
    1.94 +
    1.95 +} // namespace JS
    1.96 +
    1.97 +# ifdef JS_DEBUG
    1.98 +JS_FRIEND_API(void) js_DumpValue(const JS::Value &val);
    1.99 +JS_FRIEND_API(void) js_DumpId(jsid id);
   1.100 +JS_FRIEND_API(void) js_DumpInterpreterFrame(JSContext *cx, js::InterpreterFrame *start = nullptr);
   1.101 +# endif
   1.102 +
   1.103 +JS_FRIEND_API(void)
   1.104 +js_DumpBacktrace(JSContext *cx);
   1.105 +
   1.106 +typedef enum JSTrapStatus {
   1.107 +    JSTRAP_ERROR,
   1.108 +    JSTRAP_CONTINUE,
   1.109 +    JSTRAP_RETURN,
   1.110 +    JSTRAP_THROW,
   1.111 +    JSTRAP_LIMIT
   1.112 +} JSTrapStatus;
   1.113 +
   1.114 +typedef JSTrapStatus
   1.115 +(* JSTrapHandler)(JSContext *cx, JSScript *script, jsbytecode *pc, JS::Value *rval,
   1.116 +                  JS::Value closure);
   1.117 +
   1.118 +typedef JSTrapStatus
   1.119 +(* JSInterruptHook)(JSContext *cx, JSScript *script, jsbytecode *pc, JS::Value *rval,
   1.120 +                    void *closure);
   1.121 +
   1.122 +typedef JSTrapStatus
   1.123 +(* JSDebuggerHandler)(JSContext *cx, JSScript *script, jsbytecode *pc, JS::Value *rval,
   1.124 +                      void *closure);
   1.125 +
   1.126 +typedef JSTrapStatus
   1.127 +(* JSThrowHook)(JSContext *cx, JSScript *script, jsbytecode *pc, JS::Value *rval,
   1.128 +                void *closure);
   1.129 +
   1.130 +typedef bool
   1.131 +(* JSWatchPointHandler)(JSContext *cx, JSObject *obj, jsid id, JS::Value old,
   1.132 +                        JS::Value *newp, void *closure);
   1.133 +
   1.134 +/* called just after script creation */
   1.135 +typedef void
   1.136 +(* JSNewScriptHook)(JSContext  *cx,
   1.137 +                    const char *filename,  /* URL of script */
   1.138 +                    unsigned   lineno,     /* first line */
   1.139 +                    JSScript   *script,
   1.140 +                    JSFunction *fun,
   1.141 +                    void       *callerdata);
   1.142 +
   1.143 +/* called just before script destruction */
   1.144 +typedef void
   1.145 +(* JSDestroyScriptHook)(JSFreeOp *fop,
   1.146 +                        JSScript *script,
   1.147 +                        void     *callerdata);
   1.148 +
   1.149 +typedef void
   1.150 +(* JSSourceHandler)(const char *filename, unsigned lineno, const jschar *str,
   1.151 +                    size_t length, void **listenerTSData, void *closure);
   1.152 +
   1.153 +
   1.154 +
   1.155 +extern JS_PUBLIC_API(JSCompartment *)
   1.156 +JS_EnterCompartmentOfScript(JSContext *cx, JSScript *target);
   1.157 +
   1.158 +extern JS_PUBLIC_API(JSString *)
   1.159 +JS_DecompileScript(JSContext *cx, JS::HandleScript script, const char *name, unsigned indent);
   1.160 +
   1.161 +/*
   1.162 + * Currently, we only support runtime-wide debugging. In the future, we should
   1.163 + * be able to support compartment-wide debugging.
   1.164 + */
   1.165 +extern JS_PUBLIC_API(void)
   1.166 +JS_SetRuntimeDebugMode(JSRuntime *rt, bool debug);
   1.167 +
   1.168 +/*
   1.169 + * Debug mode is a compartment-wide mode that enables a debugger to attach
   1.170 + * to and interact with running methodjit-ed frames. In particular, it causes
   1.171 + * every function to be compiled as if an eval was present (so eval-in-frame)
   1.172 + * can work, and it ensures that functions can be re-JITed for other debug
   1.173 + * features. In general, it is not safe to interact with frames that were live
   1.174 + * before debug mode was enabled. For this reason, it is also not safe to
   1.175 + * enable debug mode while frames are live.
   1.176 + */
   1.177 +
   1.178 +/* Get current state of debugging mode. */
   1.179 +extern JS_PUBLIC_API(bool)
   1.180 +JS_GetDebugMode(JSContext *cx);
   1.181 +
   1.182 +/*
   1.183 + * Turn on/off debugging mode for all compartments. This returns false if any code
   1.184 + * from any of the runtime's compartments is running or on the stack.
   1.185 + */
   1.186 +JS_FRIEND_API(bool)
   1.187 +JS_SetDebugModeForAllCompartments(JSContext *cx, bool debug);
   1.188 +
   1.189 +/*
   1.190 + * Turn on/off debugging mode for a single compartment. This should only be
   1.191 + * used when no code from this compartment is running or on the stack in any
   1.192 + * thread.
   1.193 + */
   1.194 +JS_FRIEND_API(bool)
   1.195 +JS_SetDebugModeForCompartment(JSContext *cx, JSCompartment *comp, bool debug);
   1.196 +
   1.197 +/*
   1.198 + * Turn on/off debugging mode for a context's compartment.
   1.199 + */
   1.200 +JS_FRIEND_API(bool)
   1.201 +JS_SetDebugMode(JSContext *cx, bool debug);
   1.202 +
   1.203 +/* Turn on single step mode. */
   1.204 +extern JS_PUBLIC_API(bool)
   1.205 +JS_SetSingleStepMode(JSContext *cx, JS::HandleScript script, bool singleStep);
   1.206 +
   1.207 +/* The closure argument will be marked. */
   1.208 +extern JS_PUBLIC_API(bool)
   1.209 +JS_SetTrap(JSContext *cx, JS::HandleScript script, jsbytecode *pc,
   1.210 +           JSTrapHandler handler, JS::HandleValue closure);
   1.211 +
   1.212 +extern JS_PUBLIC_API(void)
   1.213 +JS_ClearTrap(JSContext *cx, JSScript *script, jsbytecode *pc,
   1.214 +             JSTrapHandler *handlerp, JS::Value *closurep);
   1.215 +
   1.216 +extern JS_PUBLIC_API(void)
   1.217 +JS_ClearScriptTraps(JSRuntime *rt, JSScript *script);
   1.218 +
   1.219 +extern JS_PUBLIC_API(void)
   1.220 +JS_ClearAllTrapsForCompartment(JSContext *cx);
   1.221 +
   1.222 +extern JS_PUBLIC_API(bool)
   1.223 +JS_SetInterrupt(JSRuntime *rt, JSInterruptHook handler, void *closure);
   1.224 +
   1.225 +extern JS_PUBLIC_API(bool)
   1.226 +JS_ClearInterrupt(JSRuntime *rt, JSInterruptHook *handlerp, void **closurep);
   1.227 +
   1.228 +/************************************************************************/
   1.229 +
   1.230 +extern JS_PUBLIC_API(bool)
   1.231 +JS_SetWatchPoint(JSContext *cx, JS::HandleObject obj, JS::HandleId id,
   1.232 +                 JSWatchPointHandler handler, JS::HandleObject closure);
   1.233 +
   1.234 +extern JS_PUBLIC_API(bool)
   1.235 +JS_ClearWatchPoint(JSContext *cx, JSObject *obj, jsid id,
   1.236 +                   JSWatchPointHandler *handlerp, JSObject **closurep);
   1.237 +
   1.238 +extern JS_PUBLIC_API(bool)
   1.239 +JS_ClearWatchPointsForObject(JSContext *cx, JSObject *obj);
   1.240 +
   1.241 +/************************************************************************/
   1.242 +
   1.243 +extern JS_PUBLIC_API(jsbytecode *)
   1.244 +JS_LineNumberToPC(JSContext *cx, JSScript *script, unsigned lineno);
   1.245 +
   1.246 +extern JS_PUBLIC_API(jsbytecode *)
   1.247 +JS_EndPC(JSContext *cx, JSScript *script);
   1.248 +
   1.249 +extern JS_PUBLIC_API(bool)
   1.250 +JS_GetLinePCs(JSContext *cx, JSScript *script,
   1.251 +              unsigned startLine, unsigned maxLines,
   1.252 +              unsigned* count, unsigned** lines, jsbytecode*** pcs);
   1.253 +
   1.254 +extern JS_PUBLIC_API(unsigned)
   1.255 +JS_GetFunctionArgumentCount(JSContext *cx, JSFunction *fun);
   1.256 +
   1.257 +extern JS_PUBLIC_API(bool)
   1.258 +JS_FunctionHasLocalNames(JSContext *cx, JSFunction *fun);
   1.259 +
   1.260 +/*
   1.261 + * N.B. The mark is in the context temp pool and thus the caller must take care
   1.262 + * to call JS_ReleaseFunctionLocalNameArray in a LIFO manner (wrt to any other
   1.263 + * call that may use the temp pool.
   1.264 + */
   1.265 +extern JS_PUBLIC_API(uintptr_t *)
   1.266 +JS_GetFunctionLocalNameArray(JSContext *cx, JSFunction *fun, void **markp);
   1.267 +
   1.268 +extern JS_PUBLIC_API(JSAtom *)
   1.269 +JS_LocalNameToAtom(uintptr_t w);
   1.270 +
   1.271 +extern JS_PUBLIC_API(JSString *)
   1.272 +JS_AtomKey(JSAtom *atom);
   1.273 +
   1.274 +extern JS_PUBLIC_API(void)
   1.275 +JS_ReleaseFunctionLocalNameArray(JSContext *cx, void *mark);
   1.276 +
   1.277 +extern JS_PUBLIC_API(JSScript *)
   1.278 +JS_GetFunctionScript(JSContext *cx, JS::HandleFunction fun);
   1.279 +
   1.280 +extern JS_PUBLIC_API(JSNative)
   1.281 +JS_GetFunctionNative(JSContext *cx, JSFunction *fun);
   1.282 +
   1.283 +extern JS_PUBLIC_API(JSPrincipals *)
   1.284 +JS_GetScriptPrincipals(JSScript *script);
   1.285 +
   1.286 +extern JS_PUBLIC_API(JSPrincipals *)
   1.287 +JS_GetScriptOriginPrincipals(JSScript *script);
   1.288 +
   1.289 +JS_PUBLIC_API(JSFunction *)
   1.290 +JS_GetScriptFunction(JSContext *cx, JSScript *script);
   1.291 +
   1.292 +extern JS_PUBLIC_API(JSObject *)
   1.293 +JS_GetParentOrScopeChain(JSContext *cx, JSObject *obj);
   1.294 +
   1.295 +/************************************************************************/
   1.296 +
   1.297 +/*
   1.298 + * This is almost JS_GetClass(obj)->name except that certain debug-only
   1.299 + * proxies are made transparent. In particular, this function turns the class
   1.300 + * of any scope (returned via JS_GetFrameScopeChain or JS_GetFrameCalleeObject)
   1.301 + * from "Proxy" to "Call", "Block", "With" etc.
   1.302 + */
   1.303 +extern JS_PUBLIC_API(const char *)
   1.304 +JS_GetDebugClassName(JSObject *obj);
   1.305 +
   1.306 +/************************************************************************/
   1.307 +
   1.308 +extern JS_PUBLIC_API(const jschar *)
   1.309 +JS_GetScriptSourceMap(JSContext *cx, JSScript *script);
   1.310 +
   1.311 +extern JS_PUBLIC_API(unsigned)
   1.312 +JS_GetScriptBaseLineNumber(JSContext *cx, JSScript *script);
   1.313 +
   1.314 +extern JS_PUBLIC_API(unsigned)
   1.315 +JS_GetScriptLineExtent(JSContext *cx, JSScript *script);
   1.316 +
   1.317 +extern JS_PUBLIC_API(JSVersion)
   1.318 +JS_GetScriptVersion(JSContext *cx, JSScript *script);
   1.319 +
   1.320 +extern JS_PUBLIC_API(bool)
   1.321 +JS_GetScriptIsSelfHosted(JSScript *script);
   1.322 +
   1.323 +/************************************************************************/
   1.324 +
   1.325 +/*
   1.326 + * Hook setters for script creation and destruction.  These macros provide
   1.327 + * binary compatibility and newer, shorter synonyms.
   1.328 + */
   1.329 +#define JS_SetNewScriptHook     JS_SetNewScriptHookProc
   1.330 +#define JS_SetDestroyScriptHook JS_SetDestroyScriptHookProc
   1.331 +
   1.332 +extern JS_PUBLIC_API(void)
   1.333 +JS_SetNewScriptHook(JSRuntime *rt, JSNewScriptHook hook, void *callerdata);
   1.334 +
   1.335 +extern JS_PUBLIC_API(void)
   1.336 +JS_SetDestroyScriptHook(JSRuntime *rt, JSDestroyScriptHook hook,
   1.337 +                        void *callerdata);
   1.338 +
   1.339 +/************************************************************************/
   1.340 +
   1.341 +typedef struct JSPropertyDesc {
   1.342 +    JS::Value       id;         /* primary id, atomized string, or int */
   1.343 +    JS::Value       value;      /* property value */
   1.344 +    uint8_t         flags;      /* flags, see below */
   1.345 +    uint8_t         spare;      /* unused */
   1.346 +    JS::Value       alias;      /* alias id if JSPD_ALIAS flag */
   1.347 +} JSPropertyDesc;
   1.348 +
   1.349 +#define JSPD_ENUMERATE  0x01    /* visible to for/in loop */
   1.350 +#define JSPD_READONLY   0x02    /* assignment is error */
   1.351 +#define JSPD_PERMANENT  0x04    /* property cannot be deleted */
   1.352 +#define JSPD_ALIAS      0x08    /* property has an alias id */
   1.353 +#define JSPD_EXCEPTION  0x40    /* exception occurred fetching the property, */
   1.354 +                                /* value is exception */
   1.355 +#define JSPD_ERROR      0x80    /* native getter returned false without */
   1.356 +                                /* throwing an exception */
   1.357 +
   1.358 +typedef struct JSPropertyDescArray {
   1.359 +    uint32_t        length;     /* number of elements in array */
   1.360 +    JSPropertyDesc  *array;     /* alloc'd by Get, freed by Put */
   1.361 +} JSPropertyDescArray;
   1.362 +
   1.363 +typedef struct JSScopeProperty JSScopeProperty;
   1.364 +
   1.365 +extern JS_PUBLIC_API(bool)
   1.366 +JS_GetPropertyDescArray(JSContext *cx, JS::HandleObject obj, JSPropertyDescArray *pda);
   1.367 +
   1.368 +extern JS_PUBLIC_API(void)
   1.369 +JS_PutPropertyDescArray(JSContext *cx, JSPropertyDescArray *pda);
   1.370 +
   1.371 +/************************************************************************/
   1.372 +
   1.373 +/*
   1.374 + * JSAbstractFramePtr is the public version of AbstractFramePtr, a pointer to a
   1.375 + * StackFrame or baseline JIT frame.
   1.376 + */
   1.377 +class JS_PUBLIC_API(JSAbstractFramePtr)
   1.378 +{
   1.379 +    uintptr_t ptr_;
   1.380 +    jsbytecode *pc_;
   1.381 +
   1.382 +  protected:
   1.383 +    JSAbstractFramePtr()
   1.384 +      : ptr_(0), pc_(nullptr)
   1.385 +    { }
   1.386 +
   1.387 +  public:
   1.388 +    JSAbstractFramePtr(void *raw, jsbytecode *pc);
   1.389 +
   1.390 +    uintptr_t raw() const { return ptr_; }
   1.391 +    jsbytecode *pc() const { return pc_; }
   1.392 +
   1.393 +    operator bool() const { return !!ptr_; }
   1.394 +
   1.395 +    JSObject *scopeChain(JSContext *cx);
   1.396 +    JSObject *callObject(JSContext *cx);
   1.397 +
   1.398 +    JSFunction *maybeFun();
   1.399 +    JSScript *script();
   1.400 +
   1.401 +    bool getThisValue(JSContext *cx, JS::MutableHandleValue thisv);
   1.402 +
   1.403 +    bool isDebuggerFrame();
   1.404 +
   1.405 +    bool evaluateInStackFrame(JSContext *cx,
   1.406 +                              const char *bytes, unsigned length,
   1.407 +                              const char *filename, unsigned lineno,
   1.408 +                              JS::MutableHandleValue rval);
   1.409 +
   1.410 +    bool evaluateUCInStackFrame(JSContext *cx,
   1.411 +                                const jschar *chars, unsigned length,
   1.412 +                                const char *filename, unsigned lineno,
   1.413 +                                JS::MutableHandleValue rval);
   1.414 +};
   1.415 +
   1.416 +class JS_PUBLIC_API(JSNullFramePtr) : public JSAbstractFramePtr
   1.417 +{
   1.418 +  public:
   1.419 +    JSNullFramePtr()
   1.420 +      : JSAbstractFramePtr()
   1.421 +    {}
   1.422 +};
   1.423 +
   1.424 +/*
   1.425 + * This class does not work when IonMonkey is active. It's only used by jsd,
   1.426 + * which can only be used when IonMonkey is disabled.
   1.427 + *
   1.428 + * To find the calling script and line number, use JS_DescribeSciptedCaller.
   1.429 + * To summarize the call stack, use JS::DescribeStack.
   1.430 + */
   1.431 +class JS_PUBLIC_API(JSBrokenFrameIterator)
   1.432 +{
   1.433 +    void *data_;
   1.434 +
   1.435 +  public:
   1.436 +    JSBrokenFrameIterator(JSContext *cx);
   1.437 +    ~JSBrokenFrameIterator();
   1.438 +
   1.439 +    bool done() const;
   1.440 +    JSBrokenFrameIterator& operator++();
   1.441 +
   1.442 +    JSAbstractFramePtr abstractFramePtr() const;
   1.443 +    jsbytecode *pc() const;
   1.444 +
   1.445 +    bool isConstructing() const;
   1.446 +};
   1.447 +
   1.448 +/*
   1.449 + * This hook captures high level script execution and function calls (JS or
   1.450 + * native).  It is used by JS_SetExecuteHook to hook top level scripts and by
   1.451 + * JS_SetCallHook to hook function calls.  It will get called twice per script
   1.452 + * or function call: just before execution begins and just after it finishes.
   1.453 + * In both cases the 'current' frame is that of the executing code.
   1.454 + *
   1.455 + * The 'before' param is true for the hook invocation before the execution
   1.456 + * and false for the invocation after the code has run.
   1.457 + *
   1.458 + * The 'ok' param is significant only on the post execution invocation to
   1.459 + * signify whether or not the code completed 'normally'.
   1.460 + *
   1.461 + * The 'closure' param is as passed to JS_SetExecuteHook or JS_SetCallHook
   1.462 + * for the 'before'invocation, but is whatever value is returned from that
   1.463 + * invocation for the 'after' invocation. Thus, the hook implementor *could*
   1.464 + * allocate a structure in the 'before' invocation and return a pointer to that
   1.465 + * structure. The pointer would then be handed to the hook for the 'after'
   1.466 + * invocation. Alternately, the 'before' could just return the same value as
   1.467 + * in 'closure' to cause the 'after' invocation to be called with the same
   1.468 + * 'closure' value as the 'before'.
   1.469 + *
   1.470 + * Returning nullptr in the 'before' hook will cause the 'after' hook *not* to
   1.471 + * be called.
   1.472 + */
   1.473 +typedef void *
   1.474 +(* JSInterpreterHook)(JSContext *cx, JSAbstractFramePtr frame, bool isConstructing,
   1.475 +                      bool before, bool *ok, void *closure);
   1.476 +
   1.477 +typedef bool
   1.478 +(* JSDebugErrorHook)(JSContext *cx, const char *message, JSErrorReport *report,
   1.479 +                     void *closure);
   1.480 +
   1.481 +typedef struct JSDebugHooks {
   1.482 +    JSInterruptHook     interruptHook;
   1.483 +    void                *interruptHookData;
   1.484 +    JSNewScriptHook     newScriptHook;
   1.485 +    void                *newScriptHookData;
   1.486 +    JSDestroyScriptHook destroyScriptHook;
   1.487 +    void                *destroyScriptHookData;
   1.488 +    JSDebuggerHandler   debuggerHandler;
   1.489 +    void                *debuggerHandlerData;
   1.490 +    JSSourceHandler     sourceHandler;
   1.491 +    void                *sourceHandlerData;
   1.492 +    JSInterpreterHook   executeHook;
   1.493 +    void                *executeHookData;
   1.494 +    JSInterpreterHook   callHook;
   1.495 +    void                *callHookData;
   1.496 +    JSThrowHook         throwHook;
   1.497 +    void                *throwHookData;
   1.498 +    JSDebugErrorHook    debugErrorHook;
   1.499 +    void                *debugErrorHookData;
   1.500 +} JSDebugHooks;
   1.501 +
   1.502 +/************************************************************************/
   1.503 +
   1.504 +extern JS_PUBLIC_API(bool)
   1.505 +JS_SetDebuggerHandler(JSRuntime *rt, JSDebuggerHandler hook, void *closure);
   1.506 +
   1.507 +extern JS_PUBLIC_API(bool)
   1.508 +JS_SetSourceHandler(JSRuntime *rt, JSSourceHandler handler, void *closure);
   1.509 +
   1.510 +extern JS_PUBLIC_API(bool)
   1.511 +JS_SetExecuteHook(JSRuntime *rt, JSInterpreterHook hook, void *closure);
   1.512 +
   1.513 +extern JS_PUBLIC_API(bool)
   1.514 +JS_SetCallHook(JSRuntime *rt, JSInterpreterHook hook, void *closure);
   1.515 +
   1.516 +extern JS_PUBLIC_API(bool)
   1.517 +JS_SetThrowHook(JSRuntime *rt, JSThrowHook hook, void *closure);
   1.518 +
   1.519 +extern JS_PUBLIC_API(bool)
   1.520 +JS_SetDebugErrorHook(JSRuntime *rt, JSDebugErrorHook hook, void *closure);
   1.521 +
   1.522 +/************************************************************************/
   1.523 +
   1.524 +extern JS_PUBLIC_API(const JSDebugHooks *)
   1.525 +JS_GetGlobalDebugHooks(JSRuntime *rt);
   1.526 +
   1.527 +/**
   1.528 + * Add various profiling-related functions as properties of the given object.
   1.529 + */
   1.530 +extern JS_PUBLIC_API(bool)
   1.531 +JS_DefineProfilingFunctions(JSContext *cx, JSObject *obj);
   1.532 +
   1.533 +/* Defined in vm/Debugger.cpp. */
   1.534 +extern JS_PUBLIC_API(bool)
   1.535 +JS_DefineDebuggerObject(JSContext *cx, JS::HandleObject obj);
   1.536 +
   1.537 +extern JS_PUBLIC_API(void)
   1.538 +JS_DumpPCCounts(JSContext *cx, JS::HandleScript script);
   1.539 +
   1.540 +extern JS_PUBLIC_API(void)
   1.541 +JS_DumpCompartmentPCCounts(JSContext *cx);
   1.542 +
   1.543 +namespace js {
   1.544 +extern JS_FRIEND_API(bool)
   1.545 +CanCallContextDebugHandler(JSContext *cx);
   1.546 +}
   1.547 +
   1.548 +/* Call the context debug handler on the topmost scripted frame. */
   1.549 +extern JS_FRIEND_API(bool)
   1.550 +js_CallContextDebugHandler(JSContext *cx);
   1.551 +
   1.552 +#endif /* js_OldDebugAPI_h */

mercurial