roku-debug 0.20.6 → 0.20.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (211) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/CompileErrorProcessor.d.ts +7 -2
  3. package/dist/CompileErrorProcessor.js +64 -69
  4. package/dist/CompileErrorProcessor.js.map +1 -1
  5. package/dist/DeviceInfo.d.ts +1 -0
  6. package/dist/adapters/DebugProtocolAdapter.d.ts +64 -17
  7. package/dist/adapters/DebugProtocolAdapter.js +264 -157
  8. package/dist/adapters/DebugProtocolAdapter.js.map +1 -1
  9. package/dist/adapters/TelnetAdapter.d.ts +8 -3
  10. package/dist/adapters/TelnetAdapter.js +14 -6
  11. package/dist/adapters/TelnetAdapter.js.map +1 -1
  12. package/dist/debugProtocol/Constants.d.ts +171 -81
  13. package/dist/debugProtocol/Constants.js +206 -126
  14. package/dist/debugProtocol/Constants.js.map +1 -1
  15. package/dist/debugProtocol/DebugProtocolClientReplaySession.d.ts +46 -0
  16. package/dist/debugProtocol/DebugProtocolClientReplaySession.js +278 -0
  17. package/dist/debugProtocol/DebugProtocolClientReplaySession.js.map +1 -0
  18. package/dist/debugProtocol/PluginInterface.d.ts +38 -0
  19. package/dist/debugProtocol/PluginInterface.js +86 -0
  20. package/dist/debugProtocol/PluginInterface.js.map +1 -0
  21. package/dist/debugProtocol/ProtocolUtil.d.ts +56 -0
  22. package/dist/debugProtocol/ProtocolUtil.js +164 -0
  23. package/dist/debugProtocol/ProtocolUtil.js.map +1 -0
  24. package/dist/debugProtocol/client/DebugProtocolClient.d.ts +310 -0
  25. package/dist/debugProtocol/client/DebugProtocolClient.js +1079 -0
  26. package/dist/debugProtocol/client/DebugProtocolClient.js.map +1 -0
  27. package/dist/debugProtocol/client/DebugProtocolClientPlugin.d.ts +44 -0
  28. package/dist/debugProtocol/client/DebugProtocolClientPlugin.js +3 -0
  29. package/dist/debugProtocol/client/DebugProtocolClientPlugin.js.map +1 -0
  30. package/dist/debugProtocol/events/ProtocolEvent.d.ts +66 -0
  31. package/dist/debugProtocol/events/ProtocolEvent.js +3 -0
  32. package/dist/debugProtocol/events/ProtocolEvent.js.map +1 -0
  33. package/dist/debugProtocol/events/requests/AddBreakpointsRequest.d.ts +30 -0
  34. package/dist/debugProtocol/events/requests/AddBreakpointsRequest.js +63 -0
  35. package/dist/debugProtocol/events/requests/AddBreakpointsRequest.js.map +1 -0
  36. package/dist/debugProtocol/events/requests/AddConditionalBreakpointsRequest.d.ts +48 -0
  37. package/dist/debugProtocol/events/requests/AddConditionalBreakpointsRequest.js +69 -0
  38. package/dist/debugProtocol/events/requests/AddConditionalBreakpointsRequest.js.map +1 -0
  39. package/dist/debugProtocol/events/requests/ContinueRequest.d.ts +20 -0
  40. package/dist/debugProtocol/events/requests/ContinueRequest.js +40 -0
  41. package/dist/debugProtocol/events/requests/ContinueRequest.js.map +1 -0
  42. package/dist/debugProtocol/events/requests/ExecuteRequest.d.ts +26 -0
  43. package/dist/debugProtocol/events/requests/ExecuteRequest.js +49 -0
  44. package/dist/debugProtocol/events/requests/ExecuteRequest.js.map +1 -0
  45. package/dist/debugProtocol/events/requests/ExitChannelRequest.d.ts +20 -0
  46. package/dist/debugProtocol/events/requests/ExitChannelRequest.js +40 -0
  47. package/dist/debugProtocol/events/requests/ExitChannelRequest.js.map +1 -0
  48. package/dist/debugProtocol/events/requests/HandshakeRequest.d.ts +26 -0
  49. package/dist/debugProtocol/events/requests/HandshakeRequest.js +47 -0
  50. package/dist/debugProtocol/events/requests/HandshakeRequest.js.map +1 -0
  51. package/dist/debugProtocol/events/requests/ListBreakpointsRequest.d.ts +20 -0
  52. package/dist/debugProtocol/events/requests/ListBreakpointsRequest.js +40 -0
  53. package/dist/debugProtocol/events/requests/ListBreakpointsRequest.js.map +1 -0
  54. package/dist/debugProtocol/events/requests/RemoveBreakpointsRequest.d.ts +29 -0
  55. package/dist/debugProtocol/events/requests/RemoveBreakpointsRequest.js +60 -0
  56. package/dist/debugProtocol/events/requests/RemoveBreakpointsRequest.js.map +1 -0
  57. package/dist/debugProtocol/events/requests/StackTraceRequest.d.ts +22 -0
  58. package/dist/debugProtocol/events/requests/StackTraceRequest.js +43 -0
  59. package/dist/debugProtocol/events/requests/StackTraceRequest.js.map +1 -0
  60. package/dist/debugProtocol/events/requests/StepRequest.d.ts +25 -0
  61. package/dist/debugProtocol/events/requests/StepRequest.js +46 -0
  62. package/dist/debugProtocol/events/requests/StepRequest.js.map +1 -0
  63. package/dist/debugProtocol/events/requests/StopRequest.d.ts +20 -0
  64. package/dist/debugProtocol/events/requests/StopRequest.js +39 -0
  65. package/dist/debugProtocol/events/requests/StopRequest.js.map +1 -0
  66. package/dist/debugProtocol/events/requests/ThreadsRequest.d.ts +20 -0
  67. package/dist/debugProtocol/events/requests/ThreadsRequest.js +40 -0
  68. package/dist/debugProtocol/events/requests/ThreadsRequest.js.map +1 -0
  69. package/dist/debugProtocol/events/requests/VariablesRequest.d.ts +59 -0
  70. package/dist/debugProtocol/events/requests/VariablesRequest.js +123 -0
  71. package/dist/debugProtocol/events/requests/VariablesRequest.js.map +1 -0
  72. package/dist/debugProtocol/events/responses/AddBreakpointsResponse.js.map +1 -0
  73. package/dist/debugProtocol/events/responses/AddConditionalBreakpointsResponse.d.ts +3 -0
  74. package/dist/debugProtocol/events/responses/AddConditionalBreakpointsResponse.js +9 -0
  75. package/dist/debugProtocol/events/responses/AddConditionalBreakpointsResponse.js.map +1 -0
  76. package/dist/debugProtocol/events/responses/ExecuteV3Response.d.ts +42 -0
  77. package/dist/debugProtocol/events/responses/ExecuteV3Response.js +94 -0
  78. package/dist/debugProtocol/events/responses/ExecuteV3Response.js.map +1 -0
  79. package/dist/debugProtocol/events/responses/GenericResponse.d.ts +17 -0
  80. package/dist/debugProtocol/events/responses/GenericResponse.js +40 -0
  81. package/dist/debugProtocol/events/responses/GenericResponse.js.map +1 -0
  82. package/dist/debugProtocol/events/responses/GenericV3Response.d.ts +15 -0
  83. package/dist/debugProtocol/events/responses/GenericV3Response.js +38 -0
  84. package/dist/debugProtocol/events/responses/GenericV3Response.js.map +1 -0
  85. package/dist/debugProtocol/events/responses/HandshakeResponse.d.ts +28 -0
  86. package/dist/debugProtocol/events/responses/HandshakeResponse.js +69 -0
  87. package/dist/debugProtocol/events/responses/HandshakeResponse.js.map +1 -0
  88. package/dist/debugProtocol/events/responses/HandshakeV3Response.d.ts +42 -0
  89. package/dist/debugProtocol/events/responses/HandshakeV3Response.js +98 -0
  90. package/dist/debugProtocol/events/responses/HandshakeV3Response.js.map +1 -0
  91. package/dist/debugProtocol/events/responses/ListBreakpointsResponse.d.ts +35 -0
  92. package/dist/debugProtocol/events/responses/ListBreakpointsResponse.js +68 -0
  93. package/dist/debugProtocol/events/responses/ListBreakpointsResponse.js.map +1 -0
  94. package/dist/debugProtocol/events/responses/RemoveBreakpointsResponse.js.map +1 -0
  95. package/dist/debugProtocol/events/responses/StackTraceResponse.d.ts +24 -0
  96. package/dist/debugProtocol/events/responses/StackTraceResponse.js +72 -0
  97. package/dist/debugProtocol/events/responses/StackTraceResponse.js.map +1 -0
  98. package/dist/debugProtocol/events/responses/StackTraceV3Response.d.ts +37 -0
  99. package/dist/debugProtocol/events/responses/StackTraceV3Response.js +67 -0
  100. package/dist/debugProtocol/events/responses/StackTraceV3Response.js.map +1 -0
  101. package/dist/debugProtocol/events/responses/ThreadsResponse.d.ts +54 -0
  102. package/dist/debugProtocol/events/responses/ThreadsResponse.js +80 -0
  103. package/dist/debugProtocol/events/responses/ThreadsResponse.js.map +1 -0
  104. package/dist/debugProtocol/events/responses/VariablesResponse.d.ts +117 -0
  105. package/dist/debugProtocol/events/responses/VariablesResponse.js +335 -0
  106. package/dist/debugProtocol/events/responses/VariablesResponse.js.map +1 -0
  107. package/dist/debugProtocol/events/updates/AllThreadsStoppedUpdate.d.ts +35 -0
  108. package/dist/debugProtocol/events/updates/AllThreadsStoppedUpdate.js +58 -0
  109. package/dist/debugProtocol/events/updates/AllThreadsStoppedUpdate.js.map +1 -0
  110. package/dist/debugProtocol/events/updates/BreakpointErrorUpdate.d.ts +42 -0
  111. package/dist/debugProtocol/events/updates/BreakpointErrorUpdate.js +97 -0
  112. package/dist/debugProtocol/events/updates/BreakpointErrorUpdate.js.map +1 -0
  113. package/dist/debugProtocol/events/updates/BreakpointVerifiedUpdate.d.ts +41 -0
  114. package/dist/debugProtocol/events/updates/BreakpointVerifiedUpdate.js +74 -0
  115. package/dist/debugProtocol/events/updates/BreakpointVerifiedUpdate.js.map +1 -0
  116. package/dist/debugProtocol/events/updates/CompileErrorUpdate.d.ts +60 -0
  117. package/dist/debugProtocol/events/updates/CompileErrorUpdate.js +89 -0
  118. package/dist/debugProtocol/events/updates/CompileErrorUpdate.js.map +1 -0
  119. package/dist/debugProtocol/events/updates/IOPortOpenedUpdate.d.ts +23 -0
  120. package/dist/debugProtocol/events/updates/IOPortOpenedUpdate.js +49 -0
  121. package/dist/debugProtocol/events/updates/IOPortOpenedUpdate.js.map +1 -0
  122. package/dist/debugProtocol/events/updates/ThreadAttachedUpdate.d.ts +26 -0
  123. package/dist/debugProtocol/events/updates/ThreadAttachedUpdate.js +50 -0
  124. package/dist/debugProtocol/events/updates/ThreadAttachedUpdate.js.map +1 -0
  125. package/dist/debugProtocol/server/DebugProtocolServer.d.ts +110 -0
  126. package/dist/debugProtocol/server/DebugProtocolServer.js +306 -0
  127. package/dist/debugProtocol/server/DebugProtocolServer.js.map +1 -0
  128. package/dist/debugProtocol/server/DebugProtocolServerPlugin.d.ts +41 -0
  129. package/dist/debugProtocol/server/DebugProtocolServerPlugin.js +3 -0
  130. package/dist/debugProtocol/server/DebugProtocolServerPlugin.js.map +1 -0
  131. package/dist/debugSession/BrightScriptDebugSession.d.ts +9 -1
  132. package/dist/debugSession/BrightScriptDebugSession.js +178 -89
  133. package/dist/debugSession/BrightScriptDebugSession.js.map +1 -1
  134. package/dist/index.d.ts +2 -3
  135. package/dist/index.js +2 -3
  136. package/dist/index.js.map +1 -1
  137. package/dist/logging.d.ts +1 -0
  138. package/dist/logging.js +4 -2
  139. package/dist/logging.js.map +1 -1
  140. package/dist/managers/ActionQueue.d.ts +7 -1
  141. package/dist/managers/ActionQueue.js +27 -5
  142. package/dist/managers/ActionQueue.js.map +1 -1
  143. package/dist/managers/BreakpointManager.d.ts +82 -27
  144. package/dist/managers/BreakpointManager.js +168 -63
  145. package/dist/managers/BreakpointManager.js.map +1 -1
  146. package/dist/managers/ProjectManager.d.ts +3 -0
  147. package/dist/managers/ProjectManager.js +42 -36
  148. package/dist/managers/ProjectManager.js.map +1 -1
  149. package/dist/util.d.ts +8 -6
  150. package/dist/util.js +36 -19
  151. package/dist/util.js.map +1 -1
  152. package/package.json +14 -5
  153. package/roku-debug-0.20.7.tgz +0 -0
  154. package/dist/debugProtocol/Debugger.d.ts +0 -161
  155. package/dist/debugProtocol/Debugger.js +0 -635
  156. package/dist/debugProtocol/Debugger.js.map +0 -1
  157. package/dist/debugProtocol/responses/AddBreakpointsResponse.js.map +0 -1
  158. package/dist/debugProtocol/responses/BreakpointErrorUpdateResponse.d.ts +0 -32
  159. package/dist/debugProtocol/responses/BreakpointErrorUpdateResponse.js +0 -67
  160. package/dist/debugProtocol/responses/BreakpointErrorUpdateResponse.js.map +0 -1
  161. package/dist/debugProtocol/responses/BreakpointVerifiedUpdateResponse.d.ts +0 -32
  162. package/dist/debugProtocol/responses/BreakpointVerifiedUpdateResponse.js +0 -56
  163. package/dist/debugProtocol/responses/BreakpointVerifiedUpdateResponse.js.map +0 -1
  164. package/dist/debugProtocol/responses/ConnectIOPortResponse.d.ts +0 -10
  165. package/dist/debugProtocol/responses/ConnectIOPortResponse.js +0 -39
  166. package/dist/debugProtocol/responses/ConnectIOPortResponse.js.map +0 -1
  167. package/dist/debugProtocol/responses/ExecuteResponseV3.d.ts +0 -23
  168. package/dist/debugProtocol/responses/ExecuteResponseV3.js +0 -54
  169. package/dist/debugProtocol/responses/ExecuteResponseV3.js.map +0 -1
  170. package/dist/debugProtocol/responses/HandshakeResponse.d.ts +0 -12
  171. package/dist/debugProtocol/responses/HandshakeResponse.js +0 -39
  172. package/dist/debugProtocol/responses/HandshakeResponse.js.map +0 -1
  173. package/dist/debugProtocol/responses/HandshakeResponseV3.d.ts +0 -14
  174. package/dist/debugProtocol/responses/HandshakeResponseV3.js +0 -47
  175. package/dist/debugProtocol/responses/HandshakeResponseV3.js.map +0 -1
  176. package/dist/debugProtocol/responses/ListBreakpointsResponse.d.ts +0 -25
  177. package/dist/debugProtocol/responses/ListBreakpointsResponse.js +0 -65
  178. package/dist/debugProtocol/responses/ListBreakpointsResponse.js.map +0 -1
  179. package/dist/debugProtocol/responses/ProtocolEvent.d.ts +0 -11
  180. package/dist/debugProtocol/responses/ProtocolEvent.js +0 -38
  181. package/dist/debugProtocol/responses/ProtocolEvent.js.map +0 -1
  182. package/dist/debugProtocol/responses/ProtocolEventV3.d.ts +0 -11
  183. package/dist/debugProtocol/responses/ProtocolEventV3.js +0 -42
  184. package/dist/debugProtocol/responses/ProtocolEventV3.js.map +0 -1
  185. package/dist/debugProtocol/responses/RemoveBreakpointsResponse.js.map +0 -1
  186. package/dist/debugProtocol/responses/StackTraceResponse.d.ts +0 -18
  187. package/dist/debugProtocol/responses/StackTraceResponse.js +0 -58
  188. package/dist/debugProtocol/responses/StackTraceResponse.js.map +0 -1
  189. package/dist/debugProtocol/responses/StackTraceResponseV3.d.ts +0 -18
  190. package/dist/debugProtocol/responses/StackTraceResponseV3.js +0 -58
  191. package/dist/debugProtocol/responses/StackTraceResponseV3.js.map +0 -1
  192. package/dist/debugProtocol/responses/ThreadsResponse.d.ts +0 -22
  193. package/dist/debugProtocol/responses/ThreadsResponse.js +0 -63
  194. package/dist/debugProtocol/responses/ThreadsResponse.js.map +0 -1
  195. package/dist/debugProtocol/responses/UndefinedResponse.d.ts +0 -10
  196. package/dist/debugProtocol/responses/UndefinedResponse.js +0 -39
  197. package/dist/debugProtocol/responses/UndefinedResponse.js.map +0 -1
  198. package/dist/debugProtocol/responses/UpdateThreadsResponse.d.ts +0 -25
  199. package/dist/debugProtocol/responses/UpdateThreadsResponse.js +0 -91
  200. package/dist/debugProtocol/responses/UpdateThreadsResponse.js.map +0 -1
  201. package/dist/debugProtocol/responses/VariableResponse.d.ts +0 -27
  202. package/dist/debugProtocol/responses/VariableResponse.js +0 -141
  203. package/dist/debugProtocol/responses/VariableResponse.js.map +0 -1
  204. package/dist/debugProtocol/responses/index.d.ts +0 -11
  205. package/dist/debugProtocol/responses/index.js +0 -24
  206. package/dist/debugProtocol/responses/index.js.map +0 -1
  207. package/roku-debug-0.20.6.tgz +0 -0
  208. /package/dist/debugProtocol/{responses → events/responses}/AddBreakpointsResponse.d.ts +0 -0
  209. /package/dist/debugProtocol/{responses → events/responses}/AddBreakpointsResponse.js +0 -0
  210. /package/dist/debugProtocol/{responses → events/responses}/RemoveBreakpointsResponse.d.ts +0 -0
  211. /package/dist/debugProtocol/{responses → events/responses}/RemoveBreakpointsResponse.js +0 -0
@@ -0,0 +1,98 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HandshakeV3Response = void 0;
4
+ const smart_buffer_1 = require("smart-buffer");
5
+ const semver = require("semver");
6
+ const ProtocolUtil_1 = require("../../ProtocolUtil");
7
+ const Constants_1 = require("../../Constants");
8
+ const HandshakeRequest_1 = require("../requests/HandshakeRequest");
9
+ class HandshakeV3Response {
10
+ constructor() {
11
+ this.success = false;
12
+ this.readOffset = 0;
13
+ this.data = {
14
+ /**
15
+ * The Roku Brightscript debug protocol identifier, which is the following 64-bit value :0x0067756265647362LU.
16
+ *
17
+ * This is equal to 29120988069524322LU or the following little-endian value: b'bsdebug\0.
18
+ */
19
+ magic: undefined,
20
+ /**
21
+ * A semantic version string (i.e. `2.0.0`)
22
+ */
23
+ protocolVersion: undefined,
24
+ /**
25
+ * A platform-specific implementation timestamp (in milliseconds since epoch [1970-01-01T00:00:00.000Z]).
26
+ *
27
+ * As of BrightScript debug protocol 3.0.0 (Roku OS 11.0), a timestamp is sent to the debugger client in the initial handshake.
28
+ * This timestamp is platform-specific data that is included in the system software of the platform being debugged.
29
+ * It is changed by the platform's vendor when there is any change that affects the behavior of the debugger.
30
+ *
31
+ * The value can be used in manners similar to a build number, and is primarily used to differentiate between pre-release builds of the platform being debugged.
32
+ */
33
+ revisionTimestamp: undefined,
34
+ //The handshake response isn't actually structured like like normal responses, but since they're the only unique response, just add dummy data for those fields
35
+ packetLength: undefined,
36
+ //hardcode the max uint32 integer value. This must be the same value as the HandshakeRequest class
37
+ requestId: HandshakeRequest_1.HandshakeRequest.REQUEST_ID,
38
+ errorCode: Constants_1.ErrorCode.OK
39
+ };
40
+ }
41
+ static fromJson(data) {
42
+ const response = new HandshakeV3Response();
43
+ ProtocolUtil_1.protocolUtil.loadJson(response, data);
44
+ // We only support v3 or above with this handshake
45
+ if (semver.satisfies(response.data.protocolVersion, '<3.0.0')) {
46
+ response.success = false;
47
+ }
48
+ return response;
49
+ }
50
+ static fromBuffer(buffer) {
51
+ const response = new HandshakeV3Response();
52
+ ProtocolUtil_1.protocolUtil.bufferLoaderHelper(response, buffer, 20, (smartBuffer) => {
53
+ response.data.magic = ProtocolUtil_1.protocolUtil.readStringNT(smartBuffer); // magic_number
54
+ response.data.protocolVersion = [
55
+ smartBuffer.readUInt32LE(),
56
+ smartBuffer.readUInt32LE(),
57
+ smartBuffer.readUInt32LE() // protocol_patch_version
58
+ ].join('.');
59
+ const legacyReadSize = smartBuffer.readOffset;
60
+ const remainingPacketLength = smartBuffer.readInt32LE(); // remaining_packet_length
61
+ const requiredBufferSize = remainingPacketLength + legacyReadSize;
62
+ response.data.revisionTimestamp = new Date(Number(smartBuffer.readBigUInt64LE())); // platform_revision_timestamp
63
+ if (smartBuffer.length < requiredBufferSize) {
64
+ throw new Error(`Missing buffer data according to the remaining packet length: ${smartBuffer.length}/${requiredBufferSize}`);
65
+ }
66
+ //set the buffer offset
67
+ smartBuffer.readOffset = requiredBufferSize;
68
+ // We only support v3.0.0 or above with this handshake
69
+ if (semver.satisfies(response.data.protocolVersion, '<3.0.0')) {
70
+ throw new Error(`unsupported version ${response.data.protocolVersion}`);
71
+ }
72
+ });
73
+ return response;
74
+ }
75
+ /**
76
+ * Convert the data into a buffer
77
+ */
78
+ toBuffer() {
79
+ var _a, _b;
80
+ let smartBuffer = new smart_buffer_1.SmartBuffer();
81
+ smartBuffer.writeStringNT(this.data.magic); // magic_number
82
+ const [major, minor, patch] = ((_b = (_a = this.data.protocolVersion) === null || _a === void 0 ? void 0 : _a.split('.')) !== null && _b !== void 0 ? _b : ['0', '0', '0']).map(x => parseInt(x));
83
+ smartBuffer.writeUInt32LE(major); // protocol_major_version
84
+ smartBuffer.writeUInt32LE(minor); // protocol_minor_version
85
+ smartBuffer.writeUInt32LE(patch); // protocol_patch_version
86
+ //As of BrightScript debug protocol 3.0.0 (Roku OS 11.0), all packets from the debugging target include a packet_length.
87
+ //The length is always in bytes, and includes the packet_length field, itself.
88
+ //This field avoids the need for changes to the major version of the protocol because it allows a debugger client to
89
+ //read past data it does not understand and is not critical to debugger operations.
90
+ const remainingDataBuffer = new smart_buffer_1.SmartBuffer();
91
+ remainingDataBuffer.writeBigInt64LE(BigInt(this.data.revisionTimestamp.getTime())); // platform_revision_timestamp
92
+ smartBuffer.writeUInt32LE(remainingDataBuffer.writeOffset + 4); // remaining_packet_length
93
+ smartBuffer.writeBuffer(remainingDataBuffer.toBuffer());
94
+ return smartBuffer.toBuffer();
95
+ }
96
+ }
97
+ exports.HandshakeV3Response = HandshakeV3Response;
98
+ //# sourceMappingURL=HandshakeV3Response.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HandshakeV3Response.js","sourceRoot":"","sources":["../../../../src/debugProtocol/events/responses/HandshakeV3Response.ts"],"names":[],"mappings":";;;AAAA,+CAA2C;AAC3C,iCAAiC;AAEjC,qDAAkD;AAClD,+CAA4C;AAC5C,mEAAgE;AAEhE,MAAa,mBAAmB;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AC,yBAAyB;QAC3D,WAAW,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC,yBAAyB;QAC3D,WAAW,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC,yBAAyB;QAE3D,wHAAwH;QACxH,8EAA8E;QAC9E,oHAAoH;QACpH,mFAAmF;QACnF,MAAM,mBAAmB,GAAG,IAAI,0BAAW,EAAE,CAAC;QAC9C,mBAAmB,CAAC,eAAe,CAAC,MAAM,CACtC,IAAI,CAAC,IAAI,CAAC,iBAAiB,CAAC,OAAO,EAAE,CACxC,CAAC,CAAC,CAAC,8BAA8B;QAElC,WAAW,CAAC,aAAa,CAAC,mBAAmB,CAAC,WAAW,GAAG,CAAC,CAAC,CAAC,CAAC,0BAA0B;QAC1F,WAAW,CAAC,WAAW,CAAC,mBAAmB,CAAC,QAAQ,EAAE,CAAC,CAAC;QAExD,OAAO,WAAW,CAAC,QAAQ,EAAE,CAAC;IAClC,CAAC;CAmCJ;AA1GD,kDA0GC"}
@@ -0,0 +1,35 @@
1
+ /// <reference types="node" />
2
+ import { ErrorCode } from '../../Constants';
3
+ import type { ProtocolResponse } from '../ProtocolEvent';
4
+ export declare class ListBreakpointsResponse implements ProtocolResponse {
5
+ static fromJson(data: {
6
+ requestId: number;
7
+ breakpoints: BreakpointInfo[];
8
+ }): ListBreakpointsResponse;
9
+ static fromBuffer(buffer: Buffer): ListBreakpointsResponse;
10
+ toBuffer(): Buffer;
11
+ success: boolean;
12
+ readOffset: number;
13
+ data: {
14
+ breakpoints: BreakpointInfo[];
15
+ packetLength: number;
16
+ requestId: number;
17
+ errorCode: ErrorCode;
18
+ };
19
+ }
20
+ export interface BreakpointInfo {
21
+ /**
22
+ * The ID assigned to the breakpoint. An ID greater than 0 indicates an active breakpoint. An ID of 0 denotes that the breakpoint has an error.
23
+ */
24
+ id: number;
25
+ /**
26
+ * Indicates whether the breakpoint was successfully returned. This may be one of the following values:
27
+ * - `0` (`'OK'`) - The breakpoint_id is valid.
28
+ * - `5` (`'INVALID_ARGS'`) - The breakpoint could not be returned.
29
+ */
30
+ errorCode: number;
31
+ /**
32
+ * Current state, decreases as breakpoint is executed. This argument is only present if the breakpoint_id is valid.
33
+ */
34
+ ignoreCount: number;
35
+ }
@@ -0,0 +1,68 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ListBreakpointsResponse = void 0;
4
+ const smart_buffer_1 = require("smart-buffer");
5
+ const Constants_1 = require("../../Constants");
6
+ const ProtocolUtil_1 = require("../../ProtocolUtil");
7
+ class ListBreakpointsResponse {
8
+ constructor() {
9
+ this.success = false;
10
+ this.readOffset = 0;
11
+ this.data = {
12
+ breakpoints: [],
13
+ // response fields
14
+ packetLength: undefined,
15
+ requestId: undefined,
16
+ errorCode: Constants_1.ErrorCode.OK
17
+ };
18
+ }
19
+ static fromJson(data) {
20
+ var _a;
21
+ var _b;
22
+ const response = new ListBreakpointsResponse();
23
+ ProtocolUtil_1.protocolUtil.loadJson(response, data);
24
+ (_a = (_b = response.data).breakpoints) !== null && _a !== void 0 ? _a : (_b.breakpoints = []);
25
+ return response;
26
+ }
27
+ static fromBuffer(buffer) {
28
+ const response = new ListBreakpointsResponse();
29
+ ProtocolUtil_1.protocolUtil.bufferLoaderHelper(response, buffer, 12, (smartBuffer) => {
30
+ ProtocolUtil_1.protocolUtil.loadCommonResponseFields(response, smartBuffer);
31
+ const numBreakpoints = smartBuffer.readUInt32LE(); // num_breakpoints
32
+ response.data.breakpoints = [];
33
+ // build the list of BreakpointInfo
34
+ for (let i = 0; i < numBreakpoints; i++) {
35
+ const breakpoint = {};
36
+ // breakpoint_id - The ID assigned to the breakpoint. An ID greater than 0 indicates an active breakpoint. An ID of 0 denotes that the breakpoint has an error.
37
+ breakpoint.id = smartBuffer.readUInt32LE();
38
+ // error_code - Indicates whether the breakpoint was successfully returned.
39
+ breakpoint.errorCode = smartBuffer.readUInt32LE();
40
+ if (breakpoint.id > 0) {
41
+ // This value is only present if the breakpoint_id is valid.
42
+ // ignore_count - Current state, decreases as breakpoint is executed.
43
+ breakpoint.ignoreCount = smartBuffer.readUInt32LE();
44
+ }
45
+ response.data.breakpoints.push(breakpoint);
46
+ }
47
+ return response.data.breakpoints.length === numBreakpoints;
48
+ });
49
+ return response;
50
+ }
51
+ toBuffer() {
52
+ var _a, _b, _c;
53
+ const smartBuffer = new smart_buffer_1.SmartBuffer();
54
+ smartBuffer.writeUInt32LE((_b = (_a = this.data.breakpoints) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0); // num_breakpoints
55
+ for (const breakpoint of (_c = this.data.breakpoints) !== null && _c !== void 0 ? _c : []) {
56
+ smartBuffer.writeUInt32LE(breakpoint.id); // breakpoint_id
57
+ smartBuffer.writeUInt32LE(breakpoint.errorCode); // error_code
58
+ //if this breakpoint has no errors, then write its ignore_count
59
+ if (breakpoint.id > 0) {
60
+ smartBuffer.writeUInt32LE(breakpoint.ignoreCount); // ignore_count
61
+ }
62
+ }
63
+ ProtocolUtil_1.protocolUtil.insertCommonResponseFields(this, smartBuffer);
64
+ return smartBuffer.toBuffer();
65
+ }
66
+ }
67
+ exports.ListBreakpointsResponse = ListBreakpointsResponse;
68
+ //# sourceMappingURL=ListBreakpointsResponse.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ListBreakpointsResponse.js","sourceRoot":"","sources":["../../../../src/debugProtocol/events/responses/ListBreakpointsResponse.ts"],"names":[],"mappings":";;;AAAA,+CAA2C;AAC3C,+CAA4C;AAC5C,qDAAkD;AAGlD,MAAa,uBAAuB;IAApC;QAuDW,YAAO,GAAG,KAAK,CAAC;QAEhB,eAAU,GAAG,CAAC,CAAC;QAEf,SAAI,GAAG;YACV,WAAW,EAAE,EAAsB;YAEnC,kBAAkB;YAClB,YAAY,EAAE,SAAmB;YACjC,SAAS,EAAE,SAAmB;YAC9B,SAAS,EAAE,qBAAS,CAAC,EAAE;SAC1B,CAAC;IACN,CAAC;IAjEU,MAAM,CA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C/D,CAAC,CAAC,CAAC;QACH,OAAO,QAAQ,CAAC;IACpB,CAAC;IAEM,QAAQ;;QACX,MAAM,WAAW,GAAG,IAAI,0BAAW,EAAE,CAAC;QACtC,WAAW,CAAC,aAAa,CAAC,MAAA,MAAA,IAAI,CAAC,IAAI,CAAC,WAAW,0CAAE,MAAM,mCAAI,CAAC,CAAC,CAAC,CAAC,kBAAkB;QACjF,KAAK,MAAM,UAAU,IAAI,MAAA,IAAI,CAAC,IAAI,CAAC,WAAW,mCAAI,EAAE,EAAE;YAClD,WAAW,CAAC,aAAa,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC,CAAC,gBAAgB;YAC1D,WAAW,CAAC,aAAa,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC,aAAa;YAC9D,+DAA+D;YAC/D,IAAI,UAAU,CAAC,EAAE,GAAG,CAAC,EAAE;gBACnB,WAAW,CAAC,aAAa,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,CAAC,eAAe;aACrE;SACJ;QACD,2BAAY,CAAC,0BAA0B,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;QAC3D,OAAO,WAAW,CAAC,QAAQ,EAAE,CAAC;IAClC,CAAC;CAcJ;AAnED,0DAmEC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RemoveBreakpointsResponse.js","sourceRoot":"","sources":["../../../../src/debugProtocol/events/responses/RemoveBreakpointsResponse.ts"],"names":[],"mappings":";;;AAAA,uEAAoE;AAEpE,wFAAwF;AACxF,MAAa,yBAA0B,SAAQ,iDAAuB;CAAI;AAA1E,8DAA0E"}
@@ -0,0 +1,24 @@
1
+ /// <reference types="node" />
2
+ import { ErrorCode } from '../../Constants';
3
+ import type { StackEntry } from './StackTraceV3Response';
4
+ export declare class StackTraceResponse {
5
+ static fromJson(data: {
6
+ requestId: number;
7
+ entries: StackEntry[];
8
+ }): StackTraceResponse;
9
+ static fromBuffer(buffer: Buffer): StackTraceResponse;
10
+ toBuffer(): Buffer;
11
+ success: boolean;
12
+ readOffset: number;
13
+ data: {
14
+ /**
15
+ * An array of StrackEntry structs. entries[0] contains the last function called;
16
+ * entries[stack_size-1] contains the first function called.
17
+ * Debugging clients may reverse the entries to match developer expectations.
18
+ */
19
+ entries: StackEntry[];
20
+ packetLength: number;
21
+ requestId: number;
22
+ errorCode: ErrorCode;
23
+ };
24
+ }
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.StackTraceResponse = void 0;
4
+ const smart_buffer_1 = require("smart-buffer");
5
+ const Constants_1 = require("../../Constants");
6
+ const ProtocolUtil_1 = require("../../ProtocolUtil");
7
+ class StackTraceResponse {
8
+ constructor() {
9
+ this.success = false;
10
+ this.readOffset = 0;
11
+ this.data = {
12
+ /**
13
+ * An array of StrackEntry structs. entries[0] contains the last function called;
14
+ * entries[stack_size-1] contains the first function called.
15
+ * Debugging clients may reverse the entries to match developer expectations.
16
+ */
17
+ entries: undefined,
18
+ // response fields
19
+ packetLength: undefined,
20
+ requestId: undefined,
21
+ errorCode: Constants_1.ErrorCode.OK
22
+ };
23
+ }
24
+ static fromJson(data) {
25
+ var _a;
26
+ var _b;
27
+ const response = new StackTraceResponse();
28
+ ProtocolUtil_1.protocolUtil.loadJson(response, data);
29
+ (_a = (_b = response.data).entries) !== null && _a !== void 0 ? _a : (_b.entries = []);
30
+ return response;
31
+ }
32
+ static fromBuffer(buffer) {
33
+ const response = new StackTraceResponse();
34
+ ProtocolUtil_1.protocolUtil.bufferLoaderHelper(response, buffer, 12, (smartBuffer) => {
35
+ response.data.requestId = smartBuffer.readUInt32LE(); // request_id
36
+ response.data.errorCode = smartBuffer.readUInt32LE(); // error_code
37
+ const stackSize = smartBuffer.readUInt32LE(); // stack_size
38
+ response.data.entries = [];
39
+ // build the list of BreakpointInfo
40
+ for (let i = 0; i < stackSize; i++) {
41
+ const entry = {};
42
+ entry.lineNumber = smartBuffer.readUInt32LE();
43
+ // NOTE: this is documented as being function name then file name but it is being returned by the device backwards.
44
+ entry.filePath = ProtocolUtil_1.protocolUtil.readStringNT(smartBuffer);
45
+ entry.functionName = ProtocolUtil_1.protocolUtil.readStringNT(smartBuffer);
46
+ // TODO do we need this anymore?
47
+ // let fileExtension = path.extname(this.fileName).toLowerCase();
48
+ // // NOTE:Make sure we have a full valid path (?? can be valid because the device might not know the file).
49
+ // entry.success = (fileExtension === '.brs' || fileExtension === '.xml' || this.fileName === '??');
50
+ response.data.entries.push(entry);
51
+ }
52
+ });
53
+ return response;
54
+ }
55
+ toBuffer() {
56
+ var _a, _b, _c;
57
+ const smartBuffer = new smart_buffer_1.SmartBuffer();
58
+ smartBuffer.writeUInt32LE(this.data.requestId); // request_id
59
+ smartBuffer.writeUInt32LE(this.data.errorCode); // error_code
60
+ smartBuffer.writeUInt32LE((_b = (_a = this.data.entries) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0); // stack_size
61
+ for (const entry of (_c = this.data.entries) !== null && _c !== void 0 ? _c : []) {
62
+ smartBuffer.writeUInt32LE(entry.lineNumber); // line_number
63
+ // NOTE: this is documented as being function name then file name but it is being returned by the device backwards.
64
+ smartBuffer.writeStringNT(entry.filePath); // file_path
65
+ smartBuffer.writeStringNT(entry.functionName); // function_name
66
+ }
67
+ this.data.packetLength = smartBuffer.writeOffset;
68
+ return smartBuffer.toBuffer();
69
+ }
70
+ }
71
+ exports.StackTraceResponse = StackTraceResponse;
72
+ //# sourceMappingURL=StackTraceResponse.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StackTraceResponse.js","sourceRoot":"","sources":["../../../../src/debugProtocol/events/responses/StackTraceResponse.ts"],"names":[],"mappings":";;;AAAA,+CAA2C;AAC3C,+CAA4C;AAC5C,qDAAkD;AAGlD,MAAa,kBAAkB;IAA/B;QAyDW,YAAO,GAAG,KAAK,CAAC;QAEhB,eAAU,GAAG,CAAC,CAAC;QAEf,SAAI,GAAG;YACV;;;;eAIG;YACH,OAAO,E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AAY,CAAC,WAAW,CAAC,CAAC;gBAE5D,gCAAgC;gBAChC,iEAAiE;gBACjE,4GAA4G;gBAC5G,oGAAoG;gBACpG,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;aACrC;QACL,CAAC,CAAC,CAAC;QACH,OAAO,QAAQ,CAAC;IACpB,CAAC;IAEM,QAAQ;;QACX,MAAM,WAAW,GAAG,IAAI,0BAAW,EAAE,CAAC;QACtC,WAAW,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,aAAa;QAC7D,WAAW,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,aAAa;QAE7D,WAAW,CAAC,aAAa,CAAC,MAAA,MAAA,IAAI,CAAC,IAAI,CAAC,OAAO,0CAAE,MAAM,mCAAI,CAAC,CAAC,CAAC,CAAC,aAAa;QACxE,KAAK,MAAM,KAAK,IAAI,MAAA,IAAI,CAAC,IAAI,CAAC,OAAO,mCAAI,EAAE,EAAE;YACzC,WAAW,CAAC,aAAa,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,cAAc;YAC3D,mHAAmH;YACnH,WAAW,CAAC,aAAa,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,YAAY;YACvD,WAAW,CAAC,aAAa,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC,gBAAgB;SAClE;QAED,IAAI,CAAC,IAAI,CAAC,YAAY,GAAG,WAAW,CAAC,WAAW,CAAC;QACjD,OAAO,WAAW,CAAC,QAAQ,EAAE,CAAC;IAClC,CAAC;CAoBJ;AA3ED,gDA2EC"}
@@ -0,0 +1,37 @@
1
+ /// <reference types="node" />
2
+ import { ErrorCode } from '../../Constants';
3
+ export declare class StackTraceV3Response {
4
+ static fromJson(data: {
5
+ requestId: number;
6
+ entries: StackEntry[];
7
+ }): StackTraceV3Response;
8
+ static fromBuffer(buffer: Buffer): StackTraceV3Response;
9
+ toBuffer(): Buffer;
10
+ success: boolean;
11
+ readOffset: number;
12
+ data: {
13
+ /**
14
+ * An array of StrackEntry structs. entries[0] contains the last function called;
15
+ * entries[stack_size-1] contains the first function called.
16
+ * Debugging clients may reverse the entries to match developer expectations.
17
+ */
18
+ entries: StackEntry[];
19
+ packetLength: number;
20
+ requestId: number;
21
+ errorCode: ErrorCode;
22
+ };
23
+ }
24
+ export interface StackEntry {
25
+ /**
26
+ * The line number where the stop or failure occurred.
27
+ */
28
+ lineNumber: number;
29
+ /**
30
+ * The function where the stop or failure occurred.
31
+ */
32
+ functionName: string;
33
+ /**
34
+ * The file where the stop or failure occurred.
35
+ */
36
+ filePath: string;
37
+ }
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.StackTraceV3Response = void 0;
4
+ const smart_buffer_1 = require("smart-buffer");
5
+ const Constants_1 = require("../../Constants");
6
+ const ProtocolUtil_1 = require("../../ProtocolUtil");
7
+ class StackTraceV3Response {
8
+ constructor() {
9
+ this.success = false;
10
+ this.readOffset = 0;
11
+ this.data = {
12
+ /**
13
+ * An array of StrackEntry structs. entries[0] contains the last function called;
14
+ * entries[stack_size-1] contains the first function called.
15
+ * Debugging clients may reverse the entries to match developer expectations.
16
+ */
17
+ entries: undefined,
18
+ // response fields
19
+ packetLength: undefined,
20
+ requestId: undefined,
21
+ errorCode: Constants_1.ErrorCode.OK
22
+ };
23
+ }
24
+ static fromJson(data) {
25
+ var _a;
26
+ var _b;
27
+ const response = new StackTraceV3Response();
28
+ ProtocolUtil_1.protocolUtil.loadJson(response, data);
29
+ (_a = (_b = response.data).entries) !== null && _a !== void 0 ? _a : (_b.entries = []);
30
+ return response;
31
+ }
32
+ static fromBuffer(buffer) {
33
+ const response = new StackTraceV3Response();
34
+ ProtocolUtil_1.protocolUtil.bufferLoaderHelper(response, buffer, 16, (smartBuffer) => {
35
+ ProtocolUtil_1.protocolUtil.loadCommonResponseFields(response, smartBuffer);
36
+ const stackSize = smartBuffer.readUInt32LE(); // stack_size
37
+ response.data.entries = [];
38
+ // build the list of BreakpointInfo
39
+ for (let i = 0; i < stackSize; i++) {
40
+ const entry = {};
41
+ entry.lineNumber = smartBuffer.readUInt32LE();
42
+ entry.functionName = ProtocolUtil_1.protocolUtil.readStringNT(smartBuffer);
43
+ entry.filePath = ProtocolUtil_1.protocolUtil.readStringNT(smartBuffer);
44
+ // TODO do we need this anymore?
45
+ // let fileExtension = path.extname(this.fileName).toLowerCase();
46
+ // // NOTE:Make sure we have a full valid path (?? can be valid because the device might not know the file).
47
+ // entry.success = (fileExtension === '.brs' || fileExtension === '.xml' || this.fileName === '??');
48
+ response.data.entries.push(entry);
49
+ }
50
+ });
51
+ return response;
52
+ }
53
+ toBuffer() {
54
+ var _a, _b, _c;
55
+ const smartBuffer = new smart_buffer_1.SmartBuffer();
56
+ smartBuffer.writeUInt32LE((_b = (_a = this.data.entries) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0); // stack_size
57
+ for (const entry of (_c = this.data.entries) !== null && _c !== void 0 ? _c : []) {
58
+ smartBuffer.writeUInt32LE(entry.lineNumber); // line_number
59
+ smartBuffer.writeStringNT(entry.functionName); // function_name
60
+ smartBuffer.writeStringNT(entry.filePath); // file_path
61
+ }
62
+ ProtocolUtil_1.protocolUtil.insertCommonResponseFields(this, smartBuffer);
63
+ return smartBuffer.toBuffer();
64
+ }
65
+ }
66
+ exports.StackTraceV3Response = StackTraceV3Response;
67
+ //# sourceMappingURL=StackTraceV3Response.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StackTraceV3Response.js","sourceRoot":"","sources":["../../../../src/debugProtocol/events/responses/StackTraceV3Response.ts"],"names":[],"mappings":";;;AAAA,+CAA2C;AAC3C,+CAA4C;AAC5C,qDAAkD;AAElD,MAAa,oBAAoB;IAAjC;QAkDW,YAAO,GAAG,KAAK,CAAC;QAEhB,eAAU,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E;gBACjE,4GAA4G;gBAC5G,oGAAoG;gBACpG,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;aACrC;QACL,CAAC,CAAC,CAAC;QACH,OAAO,QAAQ,CAAC;IACpB,CAAC;IAEM,QAAQ;;QACX,MAAM,WAAW,GAAG,IAAI,0BAAW,EAAE,CAAC;QACtC,WAAW,CAAC,aAAa,CAAC,MAAA,MAAA,IAAI,CAAC,IAAI,CAAC,OAAO,0CAAE,MAAM,mCAAI,CAAC,CAAC,CAAC,CAAC,aAAa;QACxE,KAAK,MAAM,KAAK,IAAI,MAAA,IAAI,CAAC,IAAI,CAAC,OAAO,mCAAI,EAAE,EAAE;YACzC,WAAW,CAAC,aAAa,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,cAAc;YAC3D,WAAW,CAAC,aAAa,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC,gBAAgB;YAC/D,WAAW,CAAC,aAAa,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,YAAY;SAC1D;QACD,2BAAY,CAAC,0BAA0B,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;QAC3D,OAAO,WAAW,CAAC,QAAQ,EAAE,CAAC;IAClC,CAAC;CAoBJ;AApED,oDAoEC"}
@@ -0,0 +1,54 @@
1
+ /// <reference types="node" />
2
+ import type { StopReason } from '../../Constants';
3
+ import { ErrorCode } from '../../Constants';
4
+ export declare class ThreadsResponse {
5
+ static fromJson(data: {
6
+ requestId: number;
7
+ threads: ThreadInfo[];
8
+ }): ThreadsResponse;
9
+ static fromBuffer(buffer: Buffer): ThreadsResponse;
10
+ toBuffer(): Buffer;
11
+ success: boolean;
12
+ readOffset: number;
13
+ data: {
14
+ /**
15
+ * An array of StrackEntry structs. entries[0] contains the last function called;
16
+ * entries[stack_size-1] contains the first function called.
17
+ * Debugging clients may reverse the entries to match developer expectations.
18
+ */
19
+ threads: ThreadInfo[];
20
+ packetLength: number;
21
+ requestId: number;
22
+ errorCode: ErrorCode;
23
+ };
24
+ }
25
+ export interface ThreadInfo {
26
+ /**
27
+ * Indicates whether this thread likely caused the stop or failure
28
+ */
29
+ isPrimary: boolean;
30
+ /**
31
+ * An enum describing why the thread was stopped.
32
+ */
33
+ stopReason: StopReason;
34
+ /**
35
+ * Provides extra details about the stop (for example, "Divide by Zero", "STOP", "BREAK")
36
+ */
37
+ stopReasonDetail: string;
38
+ /**
39
+ * The 1-based line number where the stop or failure occurred.
40
+ */
41
+ lineNumber: number;
42
+ /**
43
+ * The function where the stop or failure occurred.
44
+ */
45
+ functionName: string;
46
+ /**
47
+ * The file where the stop or failure occurred.
48
+ */
49
+ filePath: string;
50
+ /**
51
+ * The code causing the stop or failure.
52
+ */
53
+ codeSnippet: string;
54
+ }
@@ -0,0 +1,80 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ThreadsResponse = void 0;
4
+ /* eslint-disable no-bitwise */
5
+ const smart_buffer_1 = require("smart-buffer");
6
+ const Constants_1 = require("../../Constants");
7
+ const ProtocolUtil_1 = require("../../ProtocolUtil");
8
+ class ThreadsResponse {
9
+ constructor() {
10
+ this.success = false;
11
+ this.readOffset = 0;
12
+ this.data = {
13
+ /**
14
+ * An array of StrackEntry structs. entries[0] contains the last function called;
15
+ * entries[stack_size-1] contains the first function called.
16
+ * Debugging clients may reverse the entries to match developer expectations.
17
+ */
18
+ threads: undefined,
19
+ // response fields
20
+ packetLength: undefined,
21
+ requestId: undefined,
22
+ errorCode: Constants_1.ErrorCode.OK
23
+ };
24
+ }
25
+ static fromJson(data) {
26
+ var _a;
27
+ var _b;
28
+ const response = new ThreadsResponse();
29
+ ProtocolUtil_1.protocolUtil.loadJson(response, data);
30
+ (_a = (_b = response.data).threads) !== null && _a !== void 0 ? _a : (_b.threads = []);
31
+ return response;
32
+ }
33
+ static fromBuffer(buffer) {
34
+ const response = new ThreadsResponse();
35
+ ProtocolUtil_1.protocolUtil.bufferLoaderHelper(response, buffer, 16, (smartBuffer) => {
36
+ ProtocolUtil_1.protocolUtil.loadCommonResponseFields(response, smartBuffer);
37
+ const threadsCount = smartBuffer.readUInt32LE(); // threads_count
38
+ response.data.threads = [];
39
+ // build the list of threads
40
+ for (let i = 0; i < threadsCount; i++) {
41
+ const thread = {};
42
+ const flags = smartBuffer.readUInt8();
43
+ thread.isPrimary = (flags & ThreadInfoFlags.isPrimary) > 0;
44
+ thread.stopReason = Constants_1.StopReasonCode[smartBuffer.readUInt32LE()]; // stop_reason
45
+ thread.stopReasonDetail = ProtocolUtil_1.protocolUtil.readStringNT(smartBuffer); // stop_reason_detail
46
+ thread.lineNumber = smartBuffer.readUInt32LE(); // line_number
47
+ thread.functionName = ProtocolUtil_1.protocolUtil.readStringNT(smartBuffer); // function_name
48
+ thread.filePath = ProtocolUtil_1.protocolUtil.readStringNT(smartBuffer); // file_path
49
+ thread.codeSnippet = ProtocolUtil_1.protocolUtil.readStringNT(smartBuffer); // code_snippet
50
+ response.data.threads.push(thread);
51
+ }
52
+ });
53
+ return response;
54
+ }
55
+ toBuffer() {
56
+ var _a, _b, _c;
57
+ const smartBuffer = new smart_buffer_1.SmartBuffer();
58
+ smartBuffer.writeUInt32LE((_b = (_a = this.data.threads) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0); // threads_count
59
+ for (const thread of (_c = this.data.threads) !== null && _c !== void 0 ? _c : []) {
60
+ let flags = 0;
61
+ flags |= thread.isPrimary ? 1 : 0;
62
+ smartBuffer.writeUInt8(flags); //flags
63
+ //stop_reason is an 8-bit value (same as the other locations in this protocol); however, it is sent in this response as a 32bit value for historical purposes
64
+ smartBuffer.writeUInt32LE(Constants_1.StopReasonCode[thread.stopReason]); // stop_reason
65
+ smartBuffer.writeStringNT(thread.stopReasonDetail); // stop_reason_detail
66
+ smartBuffer.writeUInt32LE(thread.lineNumber); // line_number
67
+ smartBuffer.writeStringNT(thread.functionName); // function_name
68
+ smartBuffer.writeStringNT(thread.filePath); // file_path
69
+ smartBuffer.writeStringNT(thread.codeSnippet); // code_snippet
70
+ }
71
+ ProtocolUtil_1.protocolUtil.insertCommonResponseFields(this, smartBuffer);
72
+ return smartBuffer.toBuffer();
73
+ }
74
+ }
75
+ exports.ThreadsResponse = ThreadsResponse;
76
+ var ThreadInfoFlags;
77
+ (function (ThreadInfoFlags) {
78
+ ThreadInfoFlags[ThreadInfoFlags["isPrimary"] = 1] = "isPrimary";
79
+ })(ThreadInfoFlags || (ThreadInfoFlags = {}));
80
+ //# sourceMappingURL=ThreadsResponse.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ThreadsResponse.js","sourceRoot":"","sources":["../../../../src/debugProtocol/events/responses/ThreadsResponse.ts"],"names":[],"mappings":";;;AAAA,+BAA+B;AAC/B,+CAA2C;AAE3C,+CAA4D;AAC5D,qDAAkD;AAElD,MAAa,eAAe;IAA5B;QAyDW,YAAO,GAAG,KAAK,CAAC;QAEhB,eAAU,GAAG,CAAC,CAAC;QAEf,SAAI,GAAG;YACV;;;;eAIG;YACH,OAAO,EAAE,SAAyB;YAElC,kBAAkB;YAClB,YAAY,EAAE,SAAmB;YACjC,SAAS,EAAE,SAAmB;YAC9B,SAAS,EAAE,qBAAS,CAAC,EAAE;SAC1B,CAAC;IACN,CAAC;IAzEU,MAAM,CAAC,QAAQ,CAAC,IAGtB;;;QACG,MAAM,QAAQ,GAAG,IAAI,eAAe,EAAE,CAAC;QACvC,2BAAY,CAAC,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;QACtC,YAAA,QAAQ,CAAC,IAAI,EAAC,OAAO,uCAAP,OAAO,GAAK,EAAE,EAAC;QAC7B,OAAO,QAAQ,CAAC;IACpB,CAAC;IAEM,MAAM,CAAC,UAAU,CAAC,MAAc;QACnC,MAAM,QAAQ,GAAG,IAAI,eAAe,EAAE,CAAC;QACvC,2BAAY,CAAC,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE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