ChakraDebug.h 46 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041
  1. //-------------------------------------------------------------------------------------------------------
  2. // Copyright (C) Microsoft. All rights reserved.
  3. // Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
  4. //-------------------------------------------------------------------------------------------------------
  5. /// \mainpage Chakra Hosting Debugging API Reference
  6. ///
  7. /// Chakra is Microsoft's JavaScript engine. It is an integral part of Internet Explorer but can
  8. /// also be hosted independently by other applications. This reference describes the APIs available
  9. /// to applications to debug JavaScript.
  10. /// \file
  11. /// \brief The Chakra hosting debugging API.
  12. ///
  13. /// This file contains a flat C API layer. This is the API exported by ChakraCore.dll.
  14. #ifdef _MSC_VER
  15. #pragma once
  16. #endif // _MSC_VER
  17. #ifndef _CHAKRADEBUG_H_
  18. #define _CHAKRADEBUG_H_
  19. #ifdef _WIN32
  20. //Other platforms already include <stdint.h> and have this defined automatically
  21. typedef __int64 int64_t;
  22. typedef unsigned __int32 uint32_t;
  23. #endif
  24. /// <summary>
  25. /// Debug events reported from ChakraCore engine.
  26. /// </summary>
  27. typedef enum _JsDiagDebugEvent
  28. {
  29. /// <summary>
  30. /// Indicates a new script being compiled, this includes script, eval, new function.
  31. /// </summary>
  32. JsDiagDebugEventSourceCompile = 0,
  33. /// <summary>
  34. /// Indicates compile error for a script.
  35. /// </summary>
  36. JsDiagDebugEventCompileError = 1,
  37. /// <summary>
  38. /// Indicates a break due to a breakpoint.
  39. /// </summary>
  40. JsDiagDebugEventBreakpoint = 2,
  41. /// <summary>
  42. /// Indicates a break after completion of step action.
  43. /// </summary>
  44. JsDiagDebugEventStepComplete = 3,
  45. /// <summary>
  46. /// Indicates a break due to debugger statement.
  47. /// </summary>
  48. JsDiagDebugEventDebuggerStatement = 4,
  49. /// <summary>
  50. /// Indicates a break due to async break.
  51. /// </summary>
  52. JsDiagDebugEventAsyncBreak = 5,
  53. /// <summary>
  54. /// Indicates a break due to a runtime script exception.
  55. /// </summary>
  56. JsDiagDebugEventRuntimeException = 6
  57. } JsDiagDebugEvent;
  58. /// <summary>
  59. /// Break on Exception attributes.
  60. /// </summary>
  61. typedef enum _JsDiagBreakOnExceptionAttributes
  62. {
  63. /// <summary>
  64. /// Don't break on any exception.
  65. /// </summary>
  66. JsDiagBreakOnExceptionAttributeNone = 0x0,
  67. /// <summary>
  68. /// Break on uncaught exception.
  69. /// </summary>
  70. JsDiagBreakOnExceptionAttributeUncaught = 0x1,
  71. /// <summary>
  72. /// Break on first chance exception.
  73. /// </summary>
  74. JsDiagBreakOnExceptionAttributeFirstChance = 0x2
  75. } JsDiagBreakOnExceptionAttributes;
  76. /// <summary>
  77. /// Stepping types.
  78. /// </summary>
  79. typedef enum _JsDiagStepType
  80. {
  81. /// <summary>
  82. /// Perform a step operation to next statement.
  83. /// </summary>
  84. JsDiagStepTypeStepIn = 0,
  85. /// <summary>
  86. /// Perform a step out from the current function.
  87. /// </summary>
  88. JsDiagStepTypeStepOut = 1,
  89. /// <summary>
  90. /// Perform a single step over after a debug break if the next statement is a function call, else behaves as a stepin.
  91. /// </summary>
  92. JsDiagStepTypeStepOver = 2,
  93. /// <summary>
  94. /// Perform a single step back to the previous statement (only applicable in TTD mode).
  95. /// </summary>
  96. JsDiagStepTypeStepBack = 3,
  97. /// <summary>
  98. /// Perform a reverse continue operation (only applicable in TTD mode).
  99. /// </summary>
  100. JsDiagStepTypeReverseContinue = 4,
  101. /// <summary>
  102. /// Perform a forward continue operation. Clears any existing step value.
  103. /// </summary>
  104. JsDiagStepTypeContinue = 5
  105. } JsDiagStepType;
  106. /// <summary>
  107. /// User implemented callback routine for debug events.
  108. /// </summary>
  109. /// <remarks>
  110. /// Use <c>JsDiagStartDebugging</c> to register the callback.
  111. /// </remarks>
  112. /// <param name="debugEvent">The type of JsDiagDebugEvent event.</param>
  113. /// <param name="eventData">Additional data related to the debug event.</param>
  114. /// <param name="callbackState">The state passed to <c>JsDiagStartDebugging</c>.</param>
  115. typedef void (CHAKRA_CALLBACK * JsDiagDebugEventCallback)(_In_ JsDiagDebugEvent debugEvent, _In_ JsValueRef eventData, _In_opt_ void* callbackState);
  116. /// <summary>
  117. /// Starts debugging in the given runtime.
  118. /// </summary>
  119. /// <param name="runtimeHandle">Runtime to put into debug mode.</param>
  120. /// <param name="debugEventCallback">Registers a callback to be called on every JsDiagDebugEvent.</param>
  121. /// <param name="callbackState">User provided state that will be passed back to the callback.</param>
  122. /// <returns>
  123. /// The code <c>JsNoError</c> if the operation succeeded, a failure code otherwise.
  124. /// </returns>
  125. /// <remarks>
  126. /// The runtime should be active on the current thread and should not be in debug state.
  127. /// </remarks>
  128. CHAKRA_API
  129. JsDiagStartDebugging(
  130. _In_ JsRuntimeHandle runtimeHandle,
  131. _In_ JsDiagDebugEventCallback debugEventCallback,
  132. _In_opt_ void* callbackState);
  133. /// <summary>
  134. /// Stops debugging in the given runtime.
  135. /// </summary>
  136. /// <param name="runtimeHandle">Runtime to stop debugging.</param>
  137. /// <param name="callbackState">User provided state that was passed in JsDiagStartDebugging.</param>
  138. /// <returns>
  139. /// The code <c>JsNoError</c> if the operation succeeded, a failure code otherwise.
  140. /// </returns>
  141. /// <remarks>
  142. /// The runtime should be active on the current thread and in debug state.
  143. /// </remarks>
  144. CHAKRA_API
  145. JsDiagStopDebugging(
  146. _In_ JsRuntimeHandle runtimeHandle,
  147. _Out_opt_ void** callbackState);
  148. /// <summary>
  149. /// Request the runtime to break on next JavaScript statement.
  150. /// </summary>
  151. /// <param name="runtimeHandle">Runtime to request break.</param>
  152. /// <returns>
  153. /// The code <c>JsNoError</c> if the operation succeeded, a failure code otherwise.
  154. /// </returns>
  155. /// <remarks>
  156. /// The runtime should be in debug state. This API can be called from another runtime.
  157. /// </remarks>
  158. CHAKRA_API
  159. JsDiagRequestAsyncBreak(
  160. _In_ JsRuntimeHandle runtimeHandle);
  161. /// <summary>
  162. /// List all breakpoints in the current runtime.
  163. /// </summary>
  164. /// <param name="breakpoints">Array of breakpoints.</param>
  165. /// <remarks>
  166. /// <para>
  167. /// [{
  168. /// "breakpointId" : 1,
  169. /// "scriptId" : 1,
  170. /// "line" : 0,
  171. /// "column" : 62
  172. /// }]
  173. /// </para>
  174. /// </remarks>
  175. /// <returns>
  176. /// The code <c>JsNoError</c> if the operation succeeded, a failure code otherwise.
  177. /// </returns>
  178. /// <remarks>
  179. /// The current runtime should be in debug state. This API can be called when runtime is at a break or running.
  180. /// </remarks>
  181. CHAKRA_API
  182. JsDiagGetBreakpoints(
  183. _Out_ JsValueRef *breakpoints);
  184. /// <summary>
  185. /// Sets breakpoint in the specified script at give location.
  186. /// </summary>
  187. /// <param name="scriptId">Id of script from JsDiagGetScripts or JsDiagGetSource to put breakpoint.</param>
  188. /// <param name="lineNumber">0 based line number to put breakpoint.</param>
  189. /// <param name="columnNumber">0 based column number to put breakpoint.</param>
  190. /// <param name="breakpoint">Breakpoint object with id, line and column if success.</param>
  191. /// <remarks>
  192. /// <para>
  193. /// {
  194. /// "breakpointId" : 1,
  195. /// "line" : 2,
  196. /// "column" : 4
  197. /// }
  198. /// </para>
  199. /// </remarks>
  200. /// <returns>
  201. /// The code <c>JsNoError</c> if the operation succeeded, a failure code otherwise.
  202. /// </returns>
  203. /// <remarks>
  204. /// The current runtime should be in debug state. This API can be called when runtime is at a break or running.
  205. /// </remarks>
  206. CHAKRA_API
  207. JsDiagSetBreakpoint(
  208. _In_ unsigned int scriptId,
  209. _In_ unsigned int lineNumber,
  210. _In_ unsigned int columnNumber,
  211. _Out_ JsValueRef *breakpoint);
  212. /// <summary>
  213. /// Remove a breakpoint.
  214. /// </summary>
  215. /// <param name="breakpointId">Breakpoint id returned from JsDiagSetBreakpoint.</param>
  216. /// <returns>
  217. /// The code <c>JsNoError</c> if the operation succeeded, a failure code otherwise.
  218. /// </returns>
  219. /// <remarks>
  220. /// The current runtime should be in debug state. This API can be called when runtime is at a break or running.
  221. /// </remarks>
  222. CHAKRA_API
  223. JsDiagRemoveBreakpoint(
  224. _In_ unsigned int breakpointId);
  225. /// <summary>
  226. /// Sets break on exception handling.
  227. /// </summary>
  228. /// <param name="runtimeHandle">Runtime to set break on exception attributes.</param>
  229. /// <param name="exceptionAttributes">Mask of JsDiagBreakOnExceptionAttributes to set.</param>
  230. /// <remarks>
  231. /// <para>
  232. /// If this API is not called the default value is set to JsDiagBreakOnExceptionAttributeUncaught in the runtime.
  233. /// </para>
  234. /// </remarks>
  235. /// <returns>
  236. /// The code <c>JsNoError</c> if the operation succeeded, a failure code otherwise.
  237. /// </returns>
  238. /// <remarks>
  239. /// The runtime should be in debug state. This API can be called from another runtime.
  240. /// </remarks>
  241. CHAKRA_API
  242. JsDiagSetBreakOnException(
  243. _In_ JsRuntimeHandle runtimeHandle,
  244. _In_ JsDiagBreakOnExceptionAttributes exceptionAttributes);
  245. /// <summary>
  246. /// Gets break on exception setting.
  247. /// </summary>
  248. /// <param name="runtimeHandle">Runtime from which to get break on exception attributes, should be in debug mode.</param>
  249. /// <param name="exceptionAttributes">Mask of JsDiagBreakOnExceptionAttributes.</param>
  250. /// <returns>
  251. /// The code <c>JsNoError</c> if the operation succeeded, a failure code otherwise.
  252. /// </returns>
  253. /// <remarks>
  254. /// The runtime should be in debug state. This API can be called from another runtime.
  255. /// </remarks>
  256. CHAKRA_API
  257. JsDiagGetBreakOnException(
  258. _In_ JsRuntimeHandle runtimeHandle,
  259. _Out_ JsDiagBreakOnExceptionAttributes* exceptionAttributes);
  260. /// <summary>
  261. /// Sets the step type in the runtime after a debug break.
  262. /// </summary>
  263. /// <remarks>
  264. /// Requires to be at a debug break.
  265. /// </remarks>
  266. /// <param name="resumeType">Type of JsDiagStepType.</param>
  267. /// <returns>
  268. /// The code <c>JsNoError</c> if the operation succeeded, a failure code otherwise.
  269. /// </returns>
  270. /// <remarks>
  271. /// The current runtime should be in debug state. This API can only be called when runtime is at a break.
  272. /// </remarks>
  273. CHAKRA_API
  274. JsDiagSetStepType(
  275. _In_ JsDiagStepType stepType);
  276. /// <summary>
  277. /// Gets list of scripts.
  278. /// </summary>
  279. /// <param name="scriptsArray">Array of script objects.</param>
  280. /// <remarks>
  281. /// <para>
  282. /// [{
  283. /// "scriptId" : 2,
  284. /// "fileName" : "c:\\Test\\Test.js",
  285. /// "lineCount" : 4,
  286. /// "sourceLength" : 111
  287. /// }, {
  288. /// "scriptId" : 3,
  289. /// "parentScriptId" : 2,
  290. /// "scriptType" : "eval code",
  291. /// "lineCount" : 1,
  292. /// "sourceLength" : 12
  293. /// }]
  294. /// </para>
  295. /// </remarks>
  296. /// <returns>
  297. /// The code <c>JsNoError</c> if the operation succeeded, a failure code otherwise.
  298. /// </returns>
  299. /// <remarks>
  300. /// The current runtime should be in debug state. This API can be called when runtime is at a break or running.
  301. /// </remarks>
  302. CHAKRA_API
  303. JsDiagGetScripts(
  304. _Out_ JsValueRef *scriptsArray);
  305. /// <summary>
  306. /// Gets source for a specific script identified by scriptId from JsDiagGetScripts.
  307. /// </summary>
  308. /// <param name="scriptId">Id of the script.</param>
  309. /// <param name="source">Source object.</param>
  310. /// <remarks>
  311. /// <para>
  312. /// {
  313. /// "scriptId" : 1,
  314. /// "fileName" : "c:\\Test\\Test.js",
  315. /// "lineCount" : 12,
  316. /// "sourceLength" : 15154,
  317. /// "source" : "var x = 1;"
  318. /// }
  319. /// </para>
  320. /// </remarks>
  321. /// <returns>
  322. /// The code <c>JsNoError</c> if the operation succeeded, a failure code otherwise.
  323. /// </returns>
  324. /// <remarks>
  325. /// The current runtime should be in debug state. This API can be called when runtime is at a break or running.
  326. /// </remarks>
  327. CHAKRA_API
  328. JsDiagGetSource(
  329. _In_ unsigned int scriptId,
  330. _Out_ JsValueRef *source);
  331. /// <summary>
  332. /// Gets the source information for a function object.
  333. /// </summary>
  334. /// <param name="function">JavaScript function.</param>
  335. /// <param name="functionPosition">Function position - scriptId, start line, start column, line number of first statement, column number of first statement.</param>
  336. /// <remarks>
  337. /// <para>
  338. /// {
  339. /// "scriptId" : 1,
  340. /// "fileName" : "c:\\Test\\Test.js",
  341. /// "line" : 1,
  342. /// "column" : 2,
  343. /// "firstStatementLine" : 6,
  344. /// "firstStatementColumn" : 0
  345. /// }
  346. /// </para>
  347. /// </remarks>
  348. /// <returns>
  349. /// The code <c>JsNoError</c> if the operation succeeded, a failure code otherwise.
  350. /// </returns>
  351. /// <remarks>
  352. /// This API can be called when runtime is at a break or running.
  353. /// </remarks>
  354. CHAKRA_API
  355. JsDiagGetFunctionPosition(
  356. _In_ JsValueRef function,
  357. _Out_ JsValueRef *functionPosition);
  358. /// <summary>
  359. /// Gets the stack trace information.
  360. /// </summary>
  361. /// <param name="stackTrace">Stack trace information.</param>
  362. /// <remarks>
  363. /// <para>
  364. /// [{
  365. /// "index" : 0,
  366. /// "scriptId" : 2,
  367. /// "line" : 3,
  368. /// "column" : 0,
  369. /// "sourceLength" : 9,
  370. /// "sourceText" : "var x = 1",
  371. /// "functionHandle" : 1
  372. /// }]
  373. /// </para>
  374. /// </remarks>
  375. /// <returns>
  376. /// The code <c>JsNoError</c> if the operation succeeded, a failure code otherwise.
  377. /// </returns>
  378. /// <remarks>
  379. /// The current runtime should be in debug state. This API can only be called when runtime is at a break.
  380. /// </remarks>
  381. CHAKRA_API
  382. JsDiagGetStackTrace(
  383. _Out_ JsValueRef *stackTrace);
  384. /// <summary>
  385. /// Gets the list of properties corresponding to the frame.
  386. /// </summary>
  387. /// <param name="stackFrameIndex">Index of stack frame from JsDiagGetStackTrace.</param>
  388. /// <param name="properties">Object of properties array (properties, scopes and globals).</param>
  389. /// <remarks>
  390. /// <para>
  391. /// propertyAttributes is a bit mask of
  392. /// NONE = 0x1,
  393. /// HAVE_CHILDRENS = 0x2,
  394. /// READ_ONLY_VALUE = 0x4,
  395. /// IN_TDZ = 0x8,
  396. /// </para>
  397. /// <para>
  398. /// {
  399. /// "thisObject": {
  400. /// "name": "this",
  401. /// "type" : "object",
  402. /// "className" : "Object",
  403. /// "display" : "{...}",
  404. /// "propertyAttributes" : 1,
  405. /// "handle" : 306
  406. /// },
  407. /// "exception" : {
  408. /// "name" : "{exception}",
  409. /// "type" : "object",
  410. /// "display" : "'a' is undefined",
  411. /// "className" : "Error",
  412. /// "propertyAttributes" : 1,
  413. /// "handle" : 307
  414. /// }
  415. /// "arguments" : {
  416. /// "name" : "arguments",
  417. /// "type" : "object",
  418. /// "display" : "{...}",
  419. /// "className" : "Object",
  420. /// "propertyAttributes" : 1,
  421. /// "handle" : 190
  422. /// },
  423. /// "returnValue" : {
  424. /// "name" : "[Return value]",
  425. /// "type" : "undefined",
  426. /// "propertyAttributes" : 0,
  427. /// "handle" : 192
  428. /// },
  429. /// "functionCallsReturn" : [{
  430. /// "name" : "[foo1 returned]",
  431. /// "type" : "number",
  432. /// "value" : 1,
  433. /// "propertyAttributes" : 2,
  434. /// "handle" : 191
  435. /// }
  436. /// ],
  437. /// "locals" : [],
  438. /// "scopes" : [{
  439. /// "index" : 0,
  440. /// "handle" : 193
  441. /// }
  442. /// ],
  443. /// "globals" : {
  444. /// "handle" : 194
  445. /// }
  446. /// }
  447. /// </para>
  448. /// </remarks>
  449. /// <returns>
  450. /// The code <c>JsNoError</c> if the operation succeeded, a failure code otherwise.
  451. /// </returns>
  452. /// <remarks>
  453. /// The current runtime should be in debug state. This API can only be called when runtime is at a break.
  454. /// </remarks>
  455. CHAKRA_API
  456. JsDiagGetStackProperties(
  457. _In_ unsigned int stackFrameIndex,
  458. _Out_ JsValueRef *properties);
  459. /// <summary>
  460. /// Gets the list of children of a handle.
  461. /// </summary>
  462. /// <param name="objectHandle">Handle of object.</param>
  463. /// <param name="fromCount">0-based from count of properties, usually 0.</param>
  464. /// <param name="totalCount">Number of properties to return.</param>
  465. /// <param name="propertiesObject">Array of properties.</param>
  466. /// <remarks>Handle should be from objects returned from call to JsDiagGetStackProperties.</remarks>
  467. /// <remarks>For scenarios where object have large number of properties totalCount can be used to control how many properties are given.</remarks>
  468. /// <remarks>
  469. /// <para>
  470. /// {
  471. /// "totalPropertiesOfObject": 10,
  472. /// "properties" : [{
  473. /// "name" : "__proto__",
  474. /// "type" : "object",
  475. /// "display" : "{...}",
  476. /// "className" : "Object",
  477. /// "propertyAttributes" : 1,
  478. /// "handle" : 156
  479. /// }
  480. /// ],
  481. /// "debuggerOnlyProperties" : [{
  482. /// "name" : "[Map]",
  483. /// "type" : "string",
  484. /// "value" : "size = 0",
  485. /// "propertyAttributes" : 2,
  486. /// "handle" : 157
  487. /// }
  488. /// ]
  489. /// }
  490. /// </para>
  491. /// </remarks>
  492. /// <returns>
  493. /// The code <c>JsNoError</c> if the operation succeeded, a failure code otherwise.
  494. /// </returns>
  495. /// <remarks>
  496. /// The current runtime should be in debug state. This API can only be called when runtime is at a break.
  497. /// </remarks>
  498. CHAKRA_API
  499. JsDiagGetProperties(
  500. _In_ unsigned int objectHandle,
  501. _In_ unsigned int fromCount,
  502. _In_ unsigned int totalCount,
  503. _Out_ JsValueRef *propertiesObject);
  504. /// <summary>
  505. /// Gets the object corresponding to handle.
  506. /// </summary>
  507. /// <param name="objectHandle">Handle of object.</param>
  508. /// <param name="handleObject">Object corresponding to the handle.</param>
  509. /// <remarks>
  510. /// <para>
  511. /// {
  512. /// "scriptId" : 24,
  513. /// "line" : 1,
  514. /// "column" : 63,
  515. /// "name" : "foo",
  516. /// "type" : "function",
  517. /// "handle" : 2
  518. /// }
  519. /// </para>
  520. /// </remarks>
  521. /// <returns>
  522. /// The code <c>JsNoError</c> if the operation succeeded, a failure code otherwise.
  523. /// </returns>
  524. /// <remarks>
  525. /// The current runtime should be in debug state. This API can only be called when runtime is at a break.
  526. /// </remarks>
  527. CHAKRA_API
  528. JsDiagGetObjectFromHandle(
  529. _In_ unsigned int objectHandle,
  530. _Out_ JsValueRef *handleObject);
  531. /// <summary>
  532. /// Evaluates an expression on given frame.
  533. /// </summary>
  534. /// <param name="expression">
  535. /// Javascript String or ArrayBuffer (incl. ExternalArrayBuffer).
  536. /// </param>
  537. /// <param name="stackFrameIndex">Index of stack frame on which to evaluate the expression.</param>
  538. /// <param name="parseAttributes">
  539. /// Defines how `expression` (JsValueRef) should be parsed.
  540. /// - `JsParseScriptAttributeNone` when `expression` is a Utf8 encoded ArrayBuffer and/or a Javascript String (encoding independent)
  541. /// - `JsParseScriptAttributeArrayBufferIsUtf16Encoded` when `expression` is Utf16 Encoded ArrayBuffer
  542. /// - `JsParseScriptAttributeLibraryCode` has no use for this function and has similar effect with `JsParseScriptAttributeNone`
  543. /// </param>
  544. /// <param name="forceSetValueProp">Forces the result to contain the raw value of the expression result.</param>
  545. /// <param name="evalResult">Result of evaluation.</param>
  546. /// <remarks>
  547. /// <para>
  548. /// evalResult when evaluating 'this' and return is JsNoError
  549. /// {
  550. /// "name" : "this",
  551. /// "type" : "object",
  552. /// "className" : "Object",
  553. /// "display" : "{...}",
  554. /// "propertyAttributes" : 1,
  555. /// "handle" : 18
  556. /// }
  557. ///
  558. /// evalResult when evaluating a script which throws JavaScript error and return is JsErrorScriptException
  559. /// {
  560. /// "name" : "a.b.c",
  561. /// "type" : "object",
  562. /// "className" : "Error",
  563. /// "display" : "'a' is undefined",
  564. /// "propertyAttributes" : 1,
  565. /// "handle" : 18
  566. /// }
  567. /// </para>
  568. /// </remarks>
  569. /// <returns>
  570. /// The code <c>JsNoError</c> if the operation succeeded, evalResult will contain the result
  571. /// The code <c>JsErrorScriptException</c> if evaluate generated a JavaScript exception, evalResult will contain the error details
  572. /// Other error code for invalid parameters or API was not called at break
  573. /// </returns>
  574. /// <remarks>
  575. /// The current runtime should be in debug state. This API can only be called when runtime is at a break.
  576. /// </remarks>
  577. CHAKRA_API
  578. JsDiagEvaluate(
  579. _In_ JsValueRef expression,
  580. _In_ unsigned int stackFrameIndex,
  581. _In_ JsParseScriptAttributes parseAttributes,
  582. _In_ bool forceSetValueProp,
  583. _Out_ JsValueRef *evalResult);
  584. /////////////////////
  585. /// <summary>
  586. /// TimeTravel move options as bit flag enum.
  587. /// </summary>
  588. typedef enum _JsTTDMoveModes
  589. {
  590. /// <summary>
  591. /// Indicates no special actions needed for move.
  592. /// </summary>
  593. JsTTDMoveNone = 0x0,
  594. /// <summary>
  595. /// Indicates that we want to move to the first event.
  596. /// </summary>
  597. JsTTDMoveFirstEvent = 0x1,
  598. /// <summary>
  599. /// Indicates that we want to move to the last event.
  600. /// </summary>
  601. JsTTDMoveLastEvent = 0x2,
  602. /// <summary>
  603. /// Indicates that we want to move to the kth event -- top 32 bits are event count.
  604. /// </summary>
  605. JsTTDMoveKthEvent = 0x4,
  606. /// <summary>
  607. /// Indicates if we are doing the scan for a continue operation
  608. /// </summary>
  609. JsTTDMoveScanIntervalForContinue = 0x10,
  610. /// <summary>
  611. /// Indicates if we are doing the scan for a continue operation and are in the time-segment where the active breakpoint was
  612. /// </summary>
  613. JsTTDMoveScanIntervalForContinueInActiveBreakpointSegment = 0x20,
  614. /// <summary>
  615. /// Indicates if we want to set break on entry or just run and let something else trigger breakpoints.
  616. /// </summary>
  617. JsTTDMoveBreakOnEntry = 0x100
  618. } JsTTDMoveMode;
  619. /// <summary>
  620. /// A handle for URI's that TTD information is written to/read from.
  621. /// </summary>
  622. typedef void* JsTTDStreamHandle;
  623. /// <summary>
  624. /// TTD API -- may change in future versions:
  625. /// Construct a JsTTDStreamHandle that will be used to read/write the event log portion of the TTD data based on the uri
  626. /// provided by JsTTDInitializeUriCallback.
  627. /// </summary>
  628. /// <remarks>
  629. /// <para>Exactly one of read or write will be set to true.</para>
  630. /// </remarks>
  631. /// <param name="uriLength">The length of the uri array that the host passed in for storing log info.</param>
  632. /// <param name="uri">The URI that the host passed in for storing log info.</param>
  633. /// <param name="asciiNameLength">The length of the ascii name array that the host passed in for storing log info.</param>
  634. /// <param name="asciiResourceName">An optional ascii string giving a unique name to the resource that the JsTTDStreamHandle will be created for.</param>
  635. /// <param name="read">If the handle should be opened for reading.</param>
  636. /// <param name="write">If the handle should be opened for writing.</param>
  637. /// <returns>A JsTTDStreamHandle opened in read/write mode as specified.</returns>
  638. typedef JsTTDStreamHandle (CHAKRA_CALLBACK *TTDOpenResourceStreamCallback)(_In_ size_t uriLength, _In_reads_(uriLength) const char* uri, _In_ size_t asciiNameLength, _In_reads_(asciiNameLength) const char* asciiResourceName, _In_ bool read, _In_ bool write);
  639. /// <summary>
  640. /// TTD API -- may change in future versions:
  641. /// A callback for reading data from a handle.
  642. /// </summary>
  643. /// <param name="handle">The JsTTDStreamHandle to read the data from.</param>
  644. /// <param name="buff">The buffer to place the data into.</param>
  645. /// <param name="size">The max number of bytes that should be read.</param>
  646. /// <param name="readCount">The actual number of bytes read and placed in the buffer.</param>
  647. /// <returns>true if the read was successful false otherwise.</returns>
  648. typedef bool (CHAKRA_CALLBACK *JsTTDReadBytesFromStreamCallback)(_In_ JsTTDStreamHandle handle, _Out_writes_(size) byte* buff, _In_ size_t size, _Out_ size_t* readCount);
  649. /// <summary>
  650. /// TTD API -- may change in future versions:
  651. /// A callback for writing data to a handle.
  652. /// </summary>
  653. /// <param name="handle">The JsTTDStreamHandle to write the data to.</param>
  654. /// <param name="buff">The buffer to copy the data from.</param>
  655. /// <param name="size">The max number of bytes that should be written.</param>
  656. /// <param name="readCount">The actual number of bytes written to the HANDLE.</param>
  657. /// <returns>true if the write was successful false otherwise.</returns>
  658. typedef bool (CHAKRA_CALLBACK *JsTTDWriteBytesToStreamCallback)(_In_ JsTTDStreamHandle handle, _In_reads_(size) const byte* buff, _In_ size_t size, _Out_ size_t* writtenCount);
  659. /// <summary>
  660. /// TTD API -- may change in future versions:
  661. /// Flush and close the stream represented by the HANDLE as needed.
  662. /// </summary>
  663. /// <remarks>
  664. /// <para>Exactly one of read or write will be set to true.</para>
  665. /// </remarks>
  666. /// <param name="handle">The JsTTDStreamHandle to close.</param>
  667. /// <param name="read">If the handle was opened for reading.</param>
  668. /// <param name="write">If the handle was opened for writing.</param>
  669. typedef void (CHAKRA_CALLBACK *JsTTDFlushAndCloseStreamCallback)(_In_ JsTTDStreamHandle handle, _In_ bool read, _In_ bool write);
  670. /// <summary>
  671. /// TTD API -- may change in future versions:
  672. /// Creates a new runtime in Record Mode.
  673. /// </summary>
  674. /// <param name="attributes">The attributes of the runtime to be created.</param>
  675. /// <param name="enableDebugging">A flag to enable debugging during record.</param>
  676. /// <param name="snapInterval">The interval to wait between snapshots (measured in millis).</param>
  677. /// <param name="snapHistoryLength">The amount of history to maintain before discarding -- measured in number of snapshots and controls how far back in time a trace can be reversed.</param>
  678. /// <param name="openResourceStream">The <c>TTDOpenResourceStreamCallback</c> function for generating a JsTTDStreamHandle to read/write serialized data.</param>
  679. /// <param name="writeBytesToStream">The <c>JsTTDWriteBytesToStreamCallback</c> function for writing bytes to a JsTTDStreamHandle.</param>
  680. /// <param name="flushAndCloseStream">The <c>JsTTDFlushAndCloseStreamCallback</c> function for flushing and closing a JsTTDStreamHandle as needed.</param>
  681. /// <param name="threadService">The thread service for the runtime. Can be null.</param>
  682. /// <param name="runtime">The runtime created.</param>
  683. /// <remarks>
  684. /// <para>See <c>JsCreateRuntime</c> for additional information.</para>
  685. /// </remarks>
  686. /// <returns>
  687. /// The code <c>JsNoError</c> if the operation succeeded, a failure code otherwise.
  688. /// </returns>
  689. CHAKRA_API
  690. JsTTDCreateRecordRuntime(
  691. _In_ JsRuntimeAttributes attributes,
  692. _In_ bool enableDebugging,
  693. _In_ size_t snapInterval,
  694. _In_ size_t snapHistoryLength,
  695. _In_ TTDOpenResourceStreamCallback openResourceStream,
  696. _In_ JsTTDWriteBytesToStreamCallback writeBytesToStream,
  697. _In_ JsTTDFlushAndCloseStreamCallback flushAndCloseStream,
  698. _In_opt_ JsThreadServiceCallback threadService,
  699. _Out_ JsRuntimeHandle *runtime);
  700. /// <summary>
  701. /// TTD API -- may change in future versions:
  702. /// Creates a new runtime in Debug Mode.
  703. /// </summary>
  704. /// <param name="attributes">The attributes of the runtime to be created.</param>
  705. /// <param name="infoUri">The uri where the recorded Time-Travel data should be loaded from.</param>
  706. /// <param name="enableDebugging">A flag to enable additional debugging operation support during replay.</param>
  707. /// <param name="openResourceStream">The <c>TTDOpenResourceStreamCallback</c> function for generating a JsTTDStreamHandle to read/write serialized data.</param>
  708. /// <param name="readBytesFromStream">The <c>JsTTDReadBytesFromStreamCallback</c> function for reading bytes from a JsTTDStreamHandle.</param>
  709. /// <param name="flushAndCloseStream">The <c>JsTTDFlushAndCloseStreamCallback</c> function for flushing and closing a JsTTDStreamHandle as needed.</param>
  710. /// <param name="threadService">The thread service for the runtime. Can be null.</param>
  711. /// <param name="runtime">The runtime created.</param>
  712. /// <remarks>
  713. /// <para>See <c>JsCreateRuntime</c> for additional information.</para>
  714. /// </remarks>
  715. /// <returns>
  716. /// The code <c>JsNoError</c> if the operation succeeded, a failure code otherwise.
  717. /// </returns>
  718. CHAKRA_API
  719. JsTTDCreateReplayRuntime(
  720. _In_ JsRuntimeAttributes attributes,
  721. _In_reads_(infoUriCount) const char* infoUri,
  722. _In_ size_t infoUriCount,
  723. _In_ bool enableDebugging,
  724. _In_ TTDOpenResourceStreamCallback openResourceStream,
  725. _In_ JsTTDReadBytesFromStreamCallback readBytesFromStream,
  726. _In_ JsTTDFlushAndCloseStreamCallback flushAndCloseStream,
  727. _In_opt_ JsThreadServiceCallback threadService,
  728. _Out_ JsRuntimeHandle *runtime);
  729. /// <summary>
  730. /// TTD API -- may change in future versions:
  731. /// Creates a script context that takes the TTD mode from the log or explicitly is not in TTD mode (regular takes mode from currently active script).
  732. /// </summary>
  733. /// <param name="runtime">The runtime the script context is being created in.</param>
  734. /// <param name="useRuntimeTTDMode">Set to true to use runtime TTD mode false to explicitly be non-TTD context.</param>
  735. /// <param name="newContext">The created script context.</param>
  736. /// <returns>
  737. /// The code <c>JsNoError</c> if the operation succeeded, a failure code otherwise.
  738. /// </returns>
  739. CHAKRA_API JsTTDCreateContext(
  740. _In_ JsRuntimeHandle runtimeHandle,
  741. _In_ bool useRuntimeTTDMode,
  742. _Out_ JsContextRef *newContext);
  743. /// <summary>
  744. /// TTD API -- may change in future versions:
  745. /// Notify the time-travel system that a context has been identified as dead by the gc (and is being de-allocated).
  746. /// </summary>
  747. /// <param name="context">The script context that is now dead.</param>
  748. /// <returns>
  749. /// The code <c>JsNoError</c> if the operation succeeded, a failure code otherwise.
  750. /// </returns>
  751. CHAKRA_API JsTTDNotifyContextDestroy(
  752. _In_ JsContextRef context);
  753. /// <summary>
  754. /// TTD API -- may change in future versions:
  755. /// Start Time-Travel record or replay at next turn of event loop.
  756. /// </summary>
  757. /// <returns>The code <c>JsNoError</c> if the operation succeeded, a failure code otherwise.</returns>
  758. CHAKRA_API
  759. JsTTDStart();
  760. /// <summary>
  761. /// TTD API -- may change in future versions:
  762. /// Stop Time-Travel record or replay.
  763. /// </summary>
  764. /// <returns>The code <c>JsNoError</c> if the operation succeeded, a failure code otherwise.</returns>
  765. CHAKRA_API
  766. JsTTDStop();
  767. /// <summary>
  768. /// TTD API -- may change in future versions:
  769. /// Pause Time-Travel recording before executing code on behalf of debugger or other diagnostic/telemetry.
  770. /// </summary>
  771. /// <returns>The code <c>JsNoError</c> if the operation succeeded, a failure code otherwise.</returns>
  772. CHAKRA_API
  773. JsTTDPauseTimeTravelBeforeRuntimeOperation();
  774. /// <summary>
  775. /// TTD API -- may change in future versions:
  776. /// ReStart Time-Travel recording after executing code on behalf of debugger or other diagnostic/telemetry.
  777. /// </summary>
  778. /// <returns>The code <c>JsNoError</c> if the operation succeeded, a failure code otherwise.</returns>
  779. CHAKRA_API
  780. JsTTDReStartTimeTravelAfterRuntimeOperation();
  781. /// <summary>
  782. /// TTD API -- may change in future versions:
  783. /// Notify the Js runtime we are at a safe yield point in the event loop (i.e. no locals on the stack and we can process as desired).
  784. /// </summary>
  785. /// <returns>The code <c>JsNoError</c> if the operation succeeded, a failure code otherwise.</returns>
  786. CHAKRA_API
  787. JsTTDNotifyYield();
  788. /// <summary>
  789. /// TTD API -- may change in future versions:
  790. /// Notify the TTD runtime that we are doing a weak add on a reference (we may use this in external API calls and the release will happen in a GC callback).
  791. /// </summary>
  792. /// <param name="value">The value we are adding the ref to.</param>
  793. /// <returns>The code <c>JsNoError</c> if the operation succeeded, a failure code otherwise.</returns>
  794. CHAKRA_API
  795. JsTTDNotifyLongLivedReferenceAdd(_In_ JsValueRef value);
  796. /// <summary>
  797. /// TTD API -- may change in future versions:
  798. /// Notify the Js runtime the host is aborting the process and what the status code is.
  799. /// </summary>
  800. /// <param name="statusCode">The exit status code.</param>
  801. /// <returns>The code <c>JsNoError</c> if the operation succeeded, a failure code otherwise.</returns>
  802. CHAKRA_API
  803. JsTTDHostExit(_In_ int statusCode);
  804. /// <summary>
  805. /// TTD API -- may change in future versions:
  806. /// Notify the event log that the contents of one buffer have been copied to a second buffer.
  807. /// </summary>
  808. /// <param name="dst">The buffer that was written into.</param>
  809. /// <param name="dstIndex">The first index modified.</param>
  810. /// <param name="src">The buffer that was copied from.</param>
  811. /// <param name="srcIndex">The first index copied.</param>
  812. /// <param name="count">The number of bytes copied.</param>
  813. /// <returns>The code <c>JsNoError</c> if the operation succeeded, a failure code otherwise.</returns>
  814. CHAKRA_API
  815. JsTTDRawBufferCopySyncIndirect(
  816. _In_ JsValueRef dst,
  817. _In_ size_t dstIndex,
  818. _In_ JsValueRef src,
  819. _In_ size_t srcIndex,
  820. _In_ size_t count);
  821. /// <summary>
  822. /// TTD API -- may change in future versions:
  823. /// Notify the event log that the contents of a naked byte* buffer passed to the host have been modified synchronously.
  824. /// </summary>
  825. /// <param name="buffer">The buffer that was modified.</param>
  826. /// <param name="index">The first index modified.</param>
  827. /// <param name="count">The number of bytes written.</param>
  828. /// <returns>The code <c>JsNoError</c> if the operation succeeded, a failure code otherwise.</returns>
  829. CHAKRA_API
  830. JsTTDRawBufferModifySyncIndirect(
  831. _In_ JsValueRef buffer,
  832. _In_ size_t index,
  833. _In_ size_t count);
  834. /// <summary>
  835. /// TTD API -- may change in future versions:
  836. /// Get info for notifying the TTD system that a raw buffer it shares with the host has been modified.
  837. /// </summary>
  838. /// <param name="instance">The array buffer we want to monitor for contents modification.</param>
  839. /// <param name="initialModPos">The first position in the buffer that may be modified.</param>
  840. /// <returns>The code <c>JsNoError</c> if the operation succeeded, a failure code otherwise.</returns>
  841. CHAKRA_API
  842. JsTTDRawBufferAsyncModificationRegister(
  843. _In_ JsValueRef instance,
  844. _In_ byte* initialModPos);
  845. /// <summary>
  846. /// TTD API -- may change in future versions:
  847. /// Notify the event log that the contents of a naked byte* buffer passed to the host have been modified asynchronously.
  848. /// </summary>
  849. /// <param name="finalModPos">One past the last modified position in the buffer.</param>
  850. /// <returns>The code <c>JsNoError</c> if the operation succeeded, a failure code otherwise.</returns>
  851. CHAKRA_API
  852. JsTTDRawBufferAsyncModifyComplete(
  853. _In_ byte* finalModPos);
  854. /// <summary>
  855. /// TTD API -- may change in future versions:
  856. /// A check for unimplemented TTD actions in the host.
  857. /// This API is a TEMPORARY API while we complete the implementation of TTD support in the Node host and will be deleted once that is complete.
  858. /// </summary>
  859. /// <param name="msg">The message to print if we should be catching this as a TTD operation.</param>
  860. /// <returns>The code <c>JsNoError</c> if the operation succeeded, a failure code otherwise.</returns>
  861. CHAKRA_API
  862. JsTTDCheckAndAssertIfTTDRunning(
  863. _In_ const char* msg);
  864. /// <summary>
  865. /// TTD API -- may change in future versions:
  866. /// Before calling JsTTDMoveToTopLevelEvent (which inflates a snapshot and replays) check to see if we want to reset the script context.
  867. /// We reset the script context if the move will require inflating from a different snapshot that the last one.
  868. /// </summary>
  869. /// <param name="runtimeHandle">The runtime handle that the script is executing in.</param>
  870. /// <param name="moveMode">Flags controlling the way the move it performed and how other parameters are interpreted.</param>
  871. /// <param name="kthEvent">When <c>moveMode == JsTTDMoveKthEvent</c> indicates which event, otherwise this parameter is ignored.</param>
  872. /// <param name="targetEventTime">The event time we want to move to or -1 if not relevant.</param>
  873. /// <param name="targetStartSnapTime">Out parameter with the event time of the snapshot that we should inflate from.</param>
  874. /// <param name="targetEndSnapTime">Optional Out parameter with the snapshot time following the event.</param>
  875. /// <returns>The code <c>JsNoError</c> if the operation succeeded, a failure code otherwise.</returns>
  876. CHAKRA_API JsTTDGetSnapTimeTopLevelEventMove(
  877. _In_ JsRuntimeHandle runtimeHandle,
  878. _In_ JsTTDMoveMode moveMode,
  879. _In_opt_ uint32_t kthEvent,
  880. _Inout_ int64_t* targetEventTime,
  881. _Out_ int64_t* targetStartSnapTime,
  882. _Out_opt_ int64_t* targetEndSnapTime);
  883. /// <summary>
  884. /// TTD API -- may change in future versions:
  885. /// Get the snapshot interval that bounds the target event time.
  886. /// </summary>
  887. /// <param name="runtimeHandle">The runtime handle that the script is executing in.</param>
  888. /// <param name="targetEventTime">The event time we want to get the interval for.</param>
  889. /// <param name="startSnapTime">The snapshot time that comes before the desired event.</param>
  890. /// <param name="endSnapTime">The snapshot time that comes after the desired event (-1 if the leg ends before a snapshot appears).</param>
  891. /// <returns>The code <c>JsNoError</c> if the operation succeeded, a failure code otherwise.</returns>
  892. CHAKRA_API JsTTDGetSnapShotBoundInterval(
  893. _In_ JsRuntimeHandle runtimeHandle,
  894. _In_ int64_t targetEventTime,
  895. _Out_ int64_t* startSnapTime,
  896. _Out_ int64_t* endSnapTime);
  897. /// <summary>
  898. /// TTD API -- may change in future versions:
  899. /// Get the snapshot interval that precedes the one given by currentSnapStartTime (or -1 if there is no such interval).
  900. /// </summary>
  901. /// <param name="runtimeHandle">The runtime handle that the script is executing in.</param>
  902. /// <param name="currentSnapStartTime">The current snapshot interval start time.</param>
  903. /// <param name="previousSnapTime">The resulting previous snapshot interval start time or -1 if no such time.</param>
  904. /// <returns>The code <c>JsNoError</c> if the operation succeeded, a failure code otherwise.</returns>
  905. CHAKRA_API JsTTDGetPreviousSnapshotInterval(
  906. _In_ JsRuntimeHandle runtimeHandle,
  907. _In_ int64_t currentSnapStartTime,
  908. _Out_ int64_t* previousSnapTime);
  909. /// <summary>
  910. /// TTD API -- may change in future versions:
  911. /// During debug operations some additional information is populated during replay. This runs the code between the given
  912. /// snapshots to populate this information which may be needed by the debugger to determine time-travel jump targets.
  913. /// </summary>
  914. /// <param name="runtimeHandle">The runtime handle that the script is executing in.</param>
  915. ///<param name = "startSnapTime">The snapshot time that we will start executing from.< / param>
  916. ///<param name = "endSnapTime">The snapshot time that we will stop at (or -1 if we want to run to the end).< / param>
  917. /// <param name="moveMode">Additional flags for controling how the move is done.</param>
  918. /// <param name="newTargetEventTime">The updated target event time set according to the moveMode (-1 if not found).</param>
  919. /// <returns>The code <c>JsNoError</c> if the operation succeeded, a failure code otherwise.</returns>
  920. CHAKRA_API JsTTDPreExecuteSnapShotInterval(
  921. _In_ JsRuntimeHandle runtimeHandle,
  922. _In_ int64_t startSnapTime,
  923. _In_ int64_t endSnapTime,
  924. _In_ JsTTDMoveMode moveMode,
  925. _Out_ int64_t* newTargetEventTime);
  926. /// <summary>
  927. /// TTD API -- may change in future versions:
  928. /// Move to the given top-level call event time (assuming JsTTDPrepContextsForTopLevelEventMove) was called previously to reset any script contexts.
  929. /// This also computes the ready-to-run snapshot if needed.
  930. /// </summary>
  931. /// <param name="runtimeHandle">The runtime handle that the script is executing in.</param>
  932. /// <param name="moveMode">Additional flags for controling how the move is done.</param>
  933. /// <param name="snapshotTime">The event time that we will start executing from to move to the given target time.</param>
  934. /// <param name="eventTime">The event that we want to move to.</param>
  935. /// <returns>The code <c>JsNoError</c> if the operation succeeded, a failure code otherwise.</returns>
  936. CHAKRA_API
  937. JsTTDMoveToTopLevelEvent(
  938. _In_ JsRuntimeHandle runtimeHandle,
  939. _In_ JsTTDMoveMode moveMode,
  940. _In_ int64_t snapshotTime,
  941. _In_ int64_t eventTime);
  942. /// <summary>
  943. /// TTD API -- may change in future versions:
  944. /// Execute from the current point in the log to the end returning the error code.
  945. /// </summary>
  946. /// <param name="moveMode">Additional flags for controling how the move is done.</param>
  947. /// <param name="rootEventTime">The event time that we should move to next or notification (-1) that replay has ended.</param>
  948. /// <returns>
  949. /// If the debugger requested an abort the code is JsNoError -- rootEventTime is the target event time we need to move to and re - execute from.
  950. /// If we aborted at the end of the replay log the code is JsNoError -- rootEventTime is -1.
  951. /// If there was an unhandled script exception the code is JsErrorCategoryScript.
  952. /// </returns>
  953. CHAKRA_API
  954. JsTTDReplayExecution(
  955. _Inout_ JsTTDMoveMode* moveMode,
  956. _Out_ int64_t* rootEventTime);
  957. /// <summary>
  958. /// TTD API -- may change in future versions:
  959. /// Enable or disable autotrace ability from JsRT.
  960. /// </summary>
  961. /// <param name="status">True to enable autotracing false to disable it.</param>
  962. /// <returns>The code <c>JsNoError</c> if the operation succeeded, a failure code otherwise.</returns>
  963. CHAKRA_API
  964. JsTTDDiagSetAutoTraceStatus(
  965. _In_ bool status
  966. );
  967. /// <summary>
  968. /// TTD API -- may change in future versions:
  969. /// A way for the debugger to programatically write a trace when it is at a breakpoint.
  970. /// </summary>
  971. /// <param name="uri">The URI that the log should be written into.</param>
  972. /// <param name="uriLength">The length of the uri array that the host passed in for storing log info.</param>
  973. /// <returns>The code <c>JsNoError</c> if the operation succeeded, a failure code otherwise.</returns>
  974. CHAKRA_API
  975. JsTTDDiagWriteLog(
  976. _In_reads_(uriLength) const char* uri,
  977. _In_ size_t uriLength
  978. );
  979. #endif // _CHAKRADEBUG_H_