PageRenderTime 60ms CodeModel.GetById 14ms RepoModel.GetById 0ms app.codeStats 1ms

/js/lib/Socket.IO-node/support/expresso/deps/jscoverage/js/jsdbgapi.h

http://github.com/onedayitwillmake/RealtimeMultiplayerNodeJs
C++ Header | 500 lines | 250 code | 117 blank | 133 comment | 0 complexity | 5923722ee3e5d5a4d749fb6595ab22e6 MD5 | raw file
Possible License(s): GPL-2.0, LGPL-2.1, MPL-2.0-no-copyleft-exception, BSD-3-Clause
  1. /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  2. * vim: set ts=8 sw=4 et tw=78:
  3. *
  4. * ***** BEGIN LICENSE BLOCK *****
  5. * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  6. *
  7. * The contents of this file are subject to the Mozilla Public License Version
  8. * 1.1 (the "License"); you may not use this file except in compliance with
  9. * the License. You may obtain a copy of the License at
  10. * http://www.mozilla.org/MPL/
  11. *
  12. * Software distributed under the License is distributed on an "AS IS" basis,
  13. * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  14. * for the specific language governing rights and limitations under the
  15. * License.
  16. *
  17. * The Original Code is Mozilla Communicator client code, released
  18. * March 31, 1998.
  19. *
  20. * The Initial Developer of the Original Code is
  21. * Netscape Communications Corporation.
  22. * Portions created by the Initial Developer are Copyright (C) 1998
  23. * the Initial Developer. All Rights Reserved.
  24. *
  25. * Contributor(s):
  26. *
  27. * Alternatively, the contents of this file may be used under the terms of
  28. * either of the GNU General Public License Version 2 or later (the "GPL"),
  29. * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  30. * in which case the provisions of the GPL or the LGPL are applicable instead
  31. * of those above. If you wish to allow use of your version of this file only
  32. * under the terms of either the GPL or the LGPL, and not to allow others to
  33. * use your version of this file under the terms of the MPL, indicate your
  34. * decision by deleting the provisions above and replace them with the notice
  35. * and other provisions required by the GPL or the LGPL. If you do not delete
  36. * the provisions above, a recipient may use your version of this file under
  37. * the terms of any one of the MPL, the GPL or the LGPL.
  38. *
  39. * ***** END LICENSE BLOCK ***** */
  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. JS_BEGIN_EXTERN_C
  49. /*
  50. * Unexported library-private helper used to unpatch all traps in a script.
  51. * Returns script->code if script has no traps, else a JS_malloc'ed copy of
  52. * script->code which the caller must JS_free, or null on JS_malloc OOM.
  53. */
  54. extern jsbytecode *
  55. js_UntrapScriptCode(JSContext *cx, JSScript *script);
  56. extern JS_PUBLIC_API(JSBool)
  57. JS_SetTrap(JSContext *cx, JSScript *script, jsbytecode *pc,
  58. JSTrapHandler handler, void *closure);
  59. extern JS_PUBLIC_API(JSOp)
  60. JS_GetTrapOpcode(JSContext *cx, JSScript *script, jsbytecode *pc);
  61. extern JS_PUBLIC_API(void)
  62. JS_ClearTrap(JSContext *cx, JSScript *script, jsbytecode *pc,
  63. JSTrapHandler *handlerp, void **closurep);
  64. extern JS_PUBLIC_API(void)
  65. JS_ClearScriptTraps(JSContext *cx, JSScript *script);
  66. extern JS_PUBLIC_API(void)
  67. JS_ClearAllTraps(JSContext *cx);
  68. extern JS_PUBLIC_API(JSTrapStatus)
  69. JS_HandleTrap(JSContext *cx, JSScript *script, jsbytecode *pc, jsval *rval);
  70. extern JS_PUBLIC_API(JSBool)
  71. JS_SetInterrupt(JSRuntime *rt, JSTrapHandler handler, void *closure);
  72. extern JS_PUBLIC_API(JSBool)
  73. JS_ClearInterrupt(JSRuntime *rt, JSTrapHandler *handlerp, void **closurep);
  74. /************************************************************************/
  75. extern JS_PUBLIC_API(JSBool)
  76. JS_SetWatchPoint(JSContext *cx, JSObject *obj, jsval id,
  77. JSWatchPointHandler handler, void *closure);
  78. extern JS_PUBLIC_API(JSBool)
  79. JS_ClearWatchPoint(JSContext *cx, JSObject *obj, jsval id,
  80. JSWatchPointHandler *handlerp, void **closurep);
  81. extern JS_PUBLIC_API(JSBool)
  82. JS_ClearWatchPointsForObject(JSContext *cx, JSObject *obj);
  83. extern JS_PUBLIC_API(JSBool)
  84. JS_ClearAllWatchPoints(JSContext *cx);
  85. #ifdef JS_HAS_OBJ_WATCHPOINT
  86. /*
  87. * Hide these non-API function prototypes by testing whether the internal
  88. * header file "jsversion.h" has been included.
  89. */
  90. extern void
  91. js_TraceWatchPoints(JSTracer *trc, JSObject *obj);
  92. extern void
  93. js_SweepWatchPoints(JSContext *cx);
  94. extern JSScopeProperty *
  95. js_FindWatchPoint(JSRuntime *rt, JSScope *scope, jsid id);
  96. /*
  97. * NB: callers outside of jsdbgapi.c must pass non-null scope.
  98. */
  99. extern JSPropertyOp
  100. js_GetWatchedSetter(JSRuntime *rt, JSScope *scope,
  101. const JSScopeProperty *sprop);
  102. extern JSBool
  103. js_watch_set(JSContext *cx, JSObject *obj, jsval id, jsval *vp);
  104. extern JSBool
  105. js_watch_set_wrapper(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
  106. jsval *rval);
  107. extern JSPropertyOp
  108. js_WrapWatchedSetter(JSContext *cx, jsid id, uintN attrs, JSPropertyOp setter);
  109. #endif /* JS_HAS_OBJ_WATCHPOINT */
  110. /************************************************************************/
  111. extern JS_PUBLIC_API(uintN)
  112. JS_PCToLineNumber(JSContext *cx, JSScript *script, jsbytecode *pc);
  113. extern JS_PUBLIC_API(jsbytecode *)
  114. JS_LineNumberToPC(JSContext *cx, JSScript *script, uintN lineno);
  115. extern JS_PUBLIC_API(JSScript *)
  116. JS_GetFunctionScript(JSContext *cx, JSFunction *fun);
  117. extern JS_PUBLIC_API(JSNative)
  118. JS_GetFunctionNative(JSContext *cx, JSFunction *fun);
  119. extern JS_PUBLIC_API(JSFastNative)
  120. JS_GetFunctionFastNative(JSContext *cx, JSFunction *fun);
  121. extern JS_PUBLIC_API(JSPrincipals *)
  122. JS_GetScriptPrincipals(JSContext *cx, JSScript *script);
  123. /*
  124. * Stack Frame Iterator
  125. *
  126. * Used to iterate through the JS stack frames to extract
  127. * information from the frames.
  128. */
  129. extern JS_PUBLIC_API(JSStackFrame *)
  130. JS_FrameIterator(JSContext *cx, JSStackFrame **iteratorp);
  131. extern JS_PUBLIC_API(JSScript *)
  132. JS_GetFrameScript(JSContext *cx, JSStackFrame *fp);
  133. extern JS_PUBLIC_API(jsbytecode *)
  134. JS_GetFramePC(JSContext *cx, JSStackFrame *fp);
  135. /*
  136. * Get the closest scripted frame below fp. If fp is null, start from cx->fp.
  137. */
  138. extern JS_PUBLIC_API(JSStackFrame *)
  139. JS_GetScriptedCaller(JSContext *cx, JSStackFrame *fp);
  140. /*
  141. * Return a weak reference to fp's principals. A null return does not denote
  142. * an error, it means there are no principals.
  143. */
  144. extern JS_PUBLIC_API(JSPrincipals *)
  145. JS_StackFramePrincipals(JSContext *cx, JSStackFrame *fp);
  146. /*
  147. * This API is like JS_StackFramePrincipals(cx, caller), except that if
  148. * cx->runtime->findObjectPrincipals is non-null, it returns the weaker of
  149. * the caller's principals and the object principals of fp's callee function
  150. * object (fp->argv[-2]), which is eval, Function, or a similar eval-like
  151. * method. The caller parameter should be JS_GetScriptedCaller(cx, fp).
  152. *
  153. * All eval-like methods must use JS_EvalFramePrincipals to acquire a weak
  154. * reference to the correct principals for the eval call to be secure, given
  155. * an embedding that calls JS_SetObjectPrincipalsFinder (see jsapi.h).
  156. */
  157. extern JS_PUBLIC_API(JSPrincipals *)
  158. JS_EvalFramePrincipals(JSContext *cx, JSStackFrame *fp, JSStackFrame *caller);
  159. extern JS_PUBLIC_API(void *)
  160. JS_GetFrameAnnotation(JSContext *cx, JSStackFrame *fp);
  161. extern JS_PUBLIC_API(void)
  162. JS_SetFrameAnnotation(JSContext *cx, JSStackFrame *fp, void *annotation);
  163. extern JS_PUBLIC_API(void *)
  164. JS_GetFramePrincipalArray(JSContext *cx, JSStackFrame *fp);
  165. extern JS_PUBLIC_API(JSBool)
  166. JS_IsNativeFrame(JSContext *cx, JSStackFrame *fp);
  167. /* this is deprecated, use JS_GetFrameScopeChain instead */
  168. extern JS_PUBLIC_API(JSObject *)
  169. JS_GetFrameObject(JSContext *cx, JSStackFrame *fp);
  170. extern JS_PUBLIC_API(JSObject *)
  171. JS_GetFrameScopeChain(JSContext *cx, JSStackFrame *fp);
  172. extern JS_PUBLIC_API(JSObject *)
  173. JS_GetFrameCallObject(JSContext *cx, JSStackFrame *fp);
  174. extern JS_PUBLIC_API(JSObject *)
  175. JS_GetFrameThis(JSContext *cx, JSStackFrame *fp);
  176. extern JS_PUBLIC_API(JSFunction *)
  177. JS_GetFrameFunction(JSContext *cx, JSStackFrame *fp);
  178. extern JS_PUBLIC_API(JSObject *)
  179. JS_GetFrameFunctionObject(JSContext *cx, JSStackFrame *fp);
  180. /* XXXrginda Initially published with typo */
  181. #define JS_IsContructorFrame JS_IsConstructorFrame
  182. extern JS_PUBLIC_API(JSBool)
  183. JS_IsConstructorFrame(JSContext *cx, JSStackFrame *fp);
  184. extern JS_PUBLIC_API(JSBool)
  185. JS_IsDebuggerFrame(JSContext *cx, JSStackFrame *fp);
  186. extern JS_PUBLIC_API(jsval)
  187. JS_GetFrameReturnValue(JSContext *cx, JSStackFrame *fp);
  188. extern JS_PUBLIC_API(void)
  189. JS_SetFrameReturnValue(JSContext *cx, JSStackFrame *fp, jsval rval);
  190. /**
  191. * Return fp's callee function object (fp->callee) if it has one.
  192. */
  193. extern JS_PUBLIC_API(JSObject *)
  194. JS_GetFrameCalleeObject(JSContext *cx, JSStackFrame *fp);
  195. /************************************************************************/
  196. extern JS_PUBLIC_API(const char *)
  197. JS_GetScriptFilename(JSContext *cx, JSScript *script);
  198. extern JS_PUBLIC_API(uintN)
  199. JS_GetScriptBaseLineNumber(JSContext *cx, JSScript *script);
  200. extern JS_PUBLIC_API(uintN)
  201. JS_GetScriptLineExtent(JSContext *cx, JSScript *script);
  202. extern JS_PUBLIC_API(JSVersion)
  203. JS_GetScriptVersion(JSContext *cx, JSScript *script);
  204. /************************************************************************/
  205. /*
  206. * Hook setters for script creation and destruction, see jsprvtd.h for the
  207. * typedefs. These macros provide binary compatibility and newer, shorter
  208. * synonyms.
  209. */
  210. #define JS_SetNewScriptHook JS_SetNewScriptHookProc
  211. #define JS_SetDestroyScriptHook JS_SetDestroyScriptHookProc
  212. extern JS_PUBLIC_API(void)
  213. JS_SetNewScriptHook(JSRuntime *rt, JSNewScriptHook hook, void *callerdata);
  214. extern JS_PUBLIC_API(void)
  215. JS_SetDestroyScriptHook(JSRuntime *rt, JSDestroyScriptHook hook,
  216. void *callerdata);
  217. /************************************************************************/
  218. extern JS_PUBLIC_API(JSBool)
  219. JS_EvaluateUCInStackFrame(JSContext *cx, JSStackFrame *fp,
  220. const jschar *chars, uintN length,
  221. const char *filename, uintN lineno,
  222. jsval *rval);
  223. extern JS_PUBLIC_API(JSBool)
  224. JS_EvaluateInStackFrame(JSContext *cx, JSStackFrame *fp,
  225. const char *bytes, uintN length,
  226. const char *filename, uintN lineno,
  227. jsval *rval);
  228. /************************************************************************/
  229. typedef struct JSPropertyDesc {
  230. jsval id; /* primary id, a string or int */
  231. jsval value; /* property value */
  232. uint8 flags; /* flags, see below */
  233. uint8 spare; /* unused */
  234. uint16 slot; /* argument/variable slot */
  235. jsval alias; /* alias id if JSPD_ALIAS flag */
  236. } JSPropertyDesc;
  237. #define JSPD_ENUMERATE 0x01 /* visible to for/in loop */
  238. #define JSPD_READONLY 0x02 /* assignment is error */
  239. #define JSPD_PERMANENT 0x04 /* property cannot be deleted */
  240. #define JSPD_ALIAS 0x08 /* property has an alias id */
  241. #define JSPD_ARGUMENT 0x10 /* argument to function */
  242. #define JSPD_VARIABLE 0x20 /* local variable in function */
  243. #define JSPD_EXCEPTION 0x40 /* exception occurred fetching the property, */
  244. /* value is exception */
  245. #define JSPD_ERROR 0x80 /* native getter returned JS_FALSE without */
  246. /* throwing an exception */
  247. typedef struct JSPropertyDescArray {
  248. uint32 length; /* number of elements in array */
  249. JSPropertyDesc *array; /* alloc'd by Get, freed by Put */
  250. } JSPropertyDescArray;
  251. extern JS_PUBLIC_API(JSScopeProperty *)
  252. JS_PropertyIterator(JSObject *obj, JSScopeProperty **iteratorp);
  253. extern JS_PUBLIC_API(JSBool)
  254. JS_GetPropertyDesc(JSContext *cx, JSObject *obj, JSScopeProperty *sprop,
  255. JSPropertyDesc *pd);
  256. extern JS_PUBLIC_API(JSBool)
  257. JS_GetPropertyDescArray(JSContext *cx, JSObject *obj, JSPropertyDescArray *pda);
  258. extern JS_PUBLIC_API(void)
  259. JS_PutPropertyDescArray(JSContext *cx, JSPropertyDescArray *pda);
  260. /************************************************************************/
  261. extern JS_PUBLIC_API(JSBool)
  262. JS_SetDebuggerHandler(JSRuntime *rt, JSTrapHandler handler, void *closure);
  263. extern JS_PUBLIC_API(JSBool)
  264. JS_SetSourceHandler(JSRuntime *rt, JSSourceHandler handler, void *closure);
  265. extern JS_PUBLIC_API(JSBool)
  266. JS_SetExecuteHook(JSRuntime *rt, JSInterpreterHook hook, void *closure);
  267. extern JS_PUBLIC_API(JSBool)
  268. JS_SetCallHook(JSRuntime *rt, JSInterpreterHook hook, void *closure);
  269. extern JS_PUBLIC_API(JSBool)
  270. JS_SetObjectHook(JSRuntime *rt, JSObjectHook hook, void *closure);
  271. extern JS_PUBLIC_API(JSBool)
  272. JS_SetThrowHook(JSRuntime *rt, JSTrapHandler hook, void *closure);
  273. extern JS_PUBLIC_API(JSBool)
  274. JS_SetDebugErrorHook(JSRuntime *rt, JSDebugErrorHook hook, void *closure);
  275. /************************************************************************/
  276. extern JS_PUBLIC_API(size_t)
  277. JS_GetObjectTotalSize(JSContext *cx, JSObject *obj);
  278. extern JS_PUBLIC_API(size_t)
  279. JS_GetFunctionTotalSize(JSContext *cx, JSFunction *fun);
  280. extern JS_PUBLIC_API(size_t)
  281. JS_GetScriptTotalSize(JSContext *cx, JSScript *script);
  282. /*
  283. * Get the top-most running script on cx starting from fp, or from the top of
  284. * cx's frame stack if fp is null, and return its script filename flags. If
  285. * the script has a null filename member, return JSFILENAME_NULL.
  286. */
  287. extern JS_PUBLIC_API(uint32)
  288. JS_GetTopScriptFilenameFlags(JSContext *cx, JSStackFrame *fp);
  289. /*
  290. * Get the script filename flags for the script. If the script doesn't have a
  291. * filename, return JSFILENAME_NULL.
  292. */
  293. extern JS_PUBLIC_API(uint32)
  294. JS_GetScriptFilenameFlags(JSScript *script);
  295. /*
  296. * Associate flags with a script filename prefix in rt, so that any subsequent
  297. * script compilation will inherit those flags if the script's filename is the
  298. * same as prefix, or if prefix is a substring of the script's filename.
  299. *
  300. * The API defines only one flag bit, JSFILENAME_SYSTEM, leaving the remaining
  301. * 31 bits up to the API client to define. The union of all 32 bits must not
  302. * be a legal combination, however, in order to preserve JSFILENAME_NULL as a
  303. * unique value. API clients may depend on JSFILENAME_SYSTEM being a set bit
  304. * in JSFILENAME_NULL -- a script with a null filename member is presumed to
  305. * be a "system" script.
  306. */
  307. extern JS_PUBLIC_API(JSBool)
  308. JS_FlagScriptFilenamePrefix(JSRuntime *rt, const char *prefix, uint32 flags);
  309. #define JSFILENAME_NULL 0xffffffff /* null script filename */
  310. #define JSFILENAME_SYSTEM 0x00000001 /* "system" script, see below */
  311. #define JSFILENAME_PROTECTED 0x00000002 /* scripts need protection */
  312. /*
  313. * Return true if obj is a "system" object, that is, one created by
  314. * JS_NewSystemObject with the system flag set and not JS_NewObject.
  315. *
  316. * What "system" means is up to the API client, but it can be used to implement
  317. * access control policies based on script filenames and their prefixes, using
  318. * JS_FlagScriptFilenamePrefix and JS_GetTopScriptFilenameFlags.
  319. */
  320. extern JS_PUBLIC_API(JSBool)
  321. JS_IsSystemObject(JSContext *cx, JSObject *obj);
  322. /*
  323. * Call JS_NewObject(cx, clasp, proto, parent) and, if system is true, mark the
  324. * result as a system object, that is an object for which JS_IsSystemObject
  325. * returns true.
  326. */
  327. extern JS_PUBLIC_API(JSObject *)
  328. JS_NewSystemObject(JSContext *cx, JSClass *clasp, JSObject *proto,
  329. JSObject *parent, JSBool system);
  330. /************************************************************************/
  331. extern JS_PUBLIC_API(JSDebugHooks *)
  332. JS_GetGlobalDebugHooks(JSRuntime *rt);
  333. extern JS_PUBLIC_API(JSDebugHooks *)
  334. JS_SetContextDebugHooks(JSContext *cx, JSDebugHooks *hooks);
  335. #ifdef MOZ_SHARK
  336. extern JS_PUBLIC_API(JSBool)
  337. JS_StartChudRemote();
  338. extern JS_PUBLIC_API(JSBool)
  339. JS_StopChudRemote();
  340. extern JS_PUBLIC_API(JSBool)
  341. JS_ConnectShark();
  342. extern JS_PUBLIC_API(JSBool)
  343. JS_DisconnectShark();
  344. extern JS_FRIEND_API(JSBool)
  345. js_StopShark(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
  346. jsval *rval);
  347. extern JS_FRIEND_API(JSBool)
  348. js_StartShark(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
  349. jsval *rval);
  350. extern JS_FRIEND_API(JSBool)
  351. js_ConnectShark(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
  352. jsval *rval);
  353. extern JS_FRIEND_API(JSBool)
  354. js_DisconnectShark(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
  355. jsval *rval);
  356. #endif /* MOZ_SHARK */
  357. #ifdef MOZ_CALLGRIND
  358. extern JS_FRIEND_API(JSBool)
  359. js_StopCallgrind(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
  360. jsval *rval);
  361. extern JS_FRIEND_API(JSBool)
  362. js_StartCallgrind(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
  363. jsval *rval);
  364. extern JS_FRIEND_API(JSBool)
  365. js_DumpCallgrind(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
  366. jsval *rval);
  367. #endif /* MOZ_CALLGRIND */
  368. #ifdef MOZ_VTUNE
  369. extern JS_FRIEND_API(JSBool)
  370. js_StartVtune(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
  371. jsval *rval);
  372. extern JS_FRIEND_API(JSBool)
  373. js_StopVtune(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
  374. jsval *rval);
  375. extern JS_FRIEND_API(JSBool)
  376. js_PauseVtune(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
  377. jsval *rval);
  378. extern JS_FRIEND_API(JSBool)
  379. js_ResumeVtune(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
  380. jsval *rval);
  381. #endif /* MOZ_VTUNE */
  382. JS_END_EXTERN_C
  383. #endif /* jsdbgapi_h___ */