roku-debug 0.9.4 → 0.10.2
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.
- package/CHANGELOG.md +28 -1
- package/LICENSE +21 -0
- package/README.md +6 -6
- package/dist/adapters/DebugProtocolAdapter.d.ts +18 -8
- package/dist/adapters/DebugProtocolAdapter.js +147 -103
- package/dist/adapters/DebugProtocolAdapter.js.map +1 -1
- package/dist/adapters/TelnetAdapter.d.ts +6 -1
- package/dist/adapters/TelnetAdapter.js +8 -1
- package/dist/adapters/TelnetAdapter.js.map +1 -1
- package/dist/debugProtocol/Constants.d.ts +57 -52
- package/dist/debugProtocol/Constants.js +74 -50
- package/dist/debugProtocol/Constants.js.map +1 -1
- package/dist/debugProtocol/Debugger.d.ts +11 -7
- package/dist/debugProtocol/Debugger.js +160 -116
- package/dist/debugProtocol/Debugger.js.map +1 -1
- package/dist/debugProtocol/responses/ConnectIOPortResponse.d.ts +2 -2
- package/dist/debugProtocol/responses/ConnectIOPortResponse.js +5 -3
- package/dist/debugProtocol/responses/ConnectIOPortResponse.js.map +1 -1
- package/dist/debugProtocol/responses/ExecuteResponseV3.d.ts +23 -0
- package/dist/debugProtocol/responses/ExecuteResponseV3.js +54 -0
- package/dist/debugProtocol/responses/ExecuteResponseV3.js.map +1 -0
- package/dist/debugProtocol/responses/HandshakeResponse.d.ts +2 -0
- package/dist/debugProtocol/responses/HandshakeResponse.js +8 -0
- package/dist/debugProtocol/responses/HandshakeResponse.js.map +1 -1
- package/dist/debugProtocol/responses/HandshakeResponseV3.d.ts +14 -0
- package/dist/debugProtocol/responses/HandshakeResponseV3.js +47 -0
- package/dist/debugProtocol/responses/HandshakeResponseV3.js.map +1 -0
- package/dist/debugProtocol/responses/{Response.d.ts → ProtocolEvent.d.ts} +4 -2
- package/dist/debugProtocol/responses/{Response.js → ProtocolEvent.js} +13 -7
- package/dist/debugProtocol/responses/ProtocolEvent.js.map +1 -0
- package/dist/debugProtocol/responses/ProtocolEventV3.d.ts +11 -0
- package/dist/debugProtocol/responses/ProtocolEventV3.js +42 -0
- package/dist/debugProtocol/responses/ProtocolEventV3.js.map +1 -0
- package/dist/debugProtocol/responses/StackTraceResponse.d.ts +1 -1
- package/dist/debugProtocol/responses/StackTraceResponse.js +2 -2
- package/dist/debugProtocol/responses/StackTraceResponse.js.map +1 -1
- package/dist/debugProtocol/responses/StackTraceResponseV3.d.ts +18 -0
- package/dist/debugProtocol/responses/StackTraceResponseV3.js +58 -0
- package/dist/debugProtocol/responses/StackTraceResponseV3.js.map +1 -0
- package/dist/debugProtocol/responses/ThreadsResponse.d.ts +1 -1
- package/dist/debugProtocol/responses/ThreadsResponse.js +2 -1
- package/dist/debugProtocol/responses/ThreadsResponse.js.map +1 -1
- package/dist/debugProtocol/responses/UndefinedResponse.d.ts +2 -2
- package/dist/debugProtocol/responses/UndefinedResponse.js +5 -3
- package/dist/debugProtocol/responses/UndefinedResponse.js.map +1 -1
- package/dist/debugProtocol/responses/UpdateThreadsResponse.d.ts +2 -2
- package/dist/debugProtocol/responses/UpdateThreadsResponse.js +26 -6
- package/dist/debugProtocol/responses/UpdateThreadsResponse.js.map +1 -1
- package/dist/debugProtocol/responses/VariableResponse.d.ts +2 -2
- package/dist/debugProtocol/responses/VariableResponse.js +16 -8
- package/dist/debugProtocol/responses/VariableResponse.js.map +1 -1
- package/dist/debugProtocol/responses/index.d.ts +4 -1
- package/dist/debugProtocol/responses/index.js +4 -1
- package/dist/debugProtocol/responses/index.js.map +1 -1
- package/dist/debugSession/BrightScriptDebugSession.d.ts +8 -2
- package/dist/debugSession/BrightScriptDebugSession.js +89 -62
- package/dist/debugSession/BrightScriptDebugSession.js.map +1 -1
- package/dist/interfaces.d.ts +4 -0
- package/dist/util.d.ts +11 -7
- package/dist/util.js +82 -0
- package/dist/util.js.map +1 -1
- package/package.json +6 -5
- package/roku-debug-0.10.2.tgz +0 -0
- package/dist/debugProtocol/responses/Response.js.map +0 -1
- package/roku-debug-0.9.4.tgz +0 -0
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
export declare class HandshakeResponse {
|
|
3
3
|
constructor(buffer: Buffer);
|
|
4
|
+
watchPacketLength: boolean;
|
|
4
5
|
success: boolean;
|
|
5
6
|
readOffset: number;
|
|
7
|
+
requestId: number;
|
|
6
8
|
magic: string;
|
|
7
9
|
majorVersion: number;
|
|
8
10
|
minorVersion: number;
|
|
@@ -2,11 +2,14 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.HandshakeResponse = void 0;
|
|
4
4
|
const smart_buffer_1 = require("smart-buffer");
|
|
5
|
+
const semver = require("semver");
|
|
5
6
|
const util_1 = require("../../util");
|
|
6
7
|
class HandshakeResponse {
|
|
7
8
|
constructor(buffer) {
|
|
9
|
+
this.watchPacketLength = false; // this will always be false for older protocol versions
|
|
8
10
|
this.success = false;
|
|
9
11
|
this.readOffset = 0;
|
|
12
|
+
this.requestId = 0;
|
|
10
13
|
this.majorVersion = -1;
|
|
11
14
|
this.minorVersion = -1;
|
|
12
15
|
this.patchVersion = -1;
|
|
@@ -19,6 +22,11 @@ class HandshakeResponse {
|
|
|
19
22
|
this.minorVersion = bufferReader.readInt32LE(); // protocol_minor_version
|
|
20
23
|
this.patchVersion = bufferReader.readInt32LE(); // protocol_patch_version
|
|
21
24
|
this.readOffset = bufferReader.readOffset;
|
|
25
|
+
const versionString = [this.majorVersion, this.minorVersion, this.patchVersion].join('.');
|
|
26
|
+
// We only support version prior to v3 with this handshake
|
|
27
|
+
if (!semver.satisfies(versionString, '<3.0.0')) {
|
|
28
|
+
throw new Error(`unsupported version ${versionString}`);
|
|
29
|
+
}
|
|
22
30
|
this.success = true;
|
|
23
31
|
}
|
|
24
32
|
catch (error) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HandshakeResponse.js","sourceRoot":"","sources":["../../../src/debugProtocol/responses/HandshakeResponse.ts"],"names":[],"mappings":";;;AAAA,+CAA2C;AAC3C,qCAAkC;AAElC,MAAa,iBAAiB;IAE1B,YAAY,MAAc;
|
|
1
|
+
{"version":3,"file":"HandshakeResponse.js","sourceRoot":"","sources":["../../../src/debugProtocol/responses/HandshakeResponse.ts"],"names":[],"mappings":";;;AAAA,+CAA2C;AAC3C,iCAAiC;AACjC,qCAAkC;AAElC,MAAa,iBAAiB;IAE1B,YAAY,MAAc;QAwBnB,sBAAiB,GAAG,KAAK,CAAC,CAAC,wDAAwD;QACnF,YAAO,GAAG,KAAK,CAAC;QAChB,eAAU,GAAG,CAAC,CAAC;QACf,cAAS,GAAG,CAAC,CAAC;QAId,iBAAY,GAAG,CAAC,CAAC,CAAC;QAClB,iBAAY,GAAG,CAAC,CAAC,CAAC;QAClB,iBAAY,GAAG,CAAC,CAAC,CAAC;QAhCrB,iCAAiC;QACjC,IAAI,MAAM,CAAC,UAAU,IAAI,EAAE,EAAE;YACzB,IAAI;gBACA,IAAI,YAAY,GAAG,0BAAW,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;gBAClD,IAAI,CAAC,KAAK,GAAG,WAAI,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC,CAAC,eAAe;gBAC7D,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC,WAAW,EAAE,CAAC,CAAC,yBAAyB;gBACzE,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC,WAAW,EAAE,CAAC,CAAC,yBAAyB;gBACzE,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC,WAAW,EAAE,CAAC,CAAC,yBAAyB;gBACzE,IAAI,CAAC,UAAU,GAAG,YAAY,CAAC,UAAU,CAAC;gBAE1C,MAAM,aAAa,GAAG,CAAC,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;gBAE1F,0DAA0D;gBAC1D,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,aAAa,EAAE,QAAQ,CAAC,EAAE;oBAC5C,MAAM,IAAI,KAAK,CAAC,uBAAuB,aAAa,EAAE,CAAC,CAAC;iBAC3D;gBACD,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;aACvB;YAAC,OAAO,KAAK,EAAE;gBACZ,kBAAkB;aACrB;SACJ;IACL,CAAC;CAYJ;AApCD,8CAoCC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
export declare class HandshakeResponseV3 {
|
|
3
|
+
constructor(buffer: Buffer);
|
|
4
|
+
watchPacketLength: boolean;
|
|
5
|
+
success: boolean;
|
|
6
|
+
readOffset: number;
|
|
7
|
+
requestId: number;
|
|
8
|
+
magic: string;
|
|
9
|
+
majorVersion: number;
|
|
10
|
+
minorVersion: number;
|
|
11
|
+
patchVersion: number;
|
|
12
|
+
remainingPacketLength: number;
|
|
13
|
+
revisionTimeStamp: Date;
|
|
14
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.HandshakeResponseV3 = void 0;
|
|
4
|
+
const smart_buffer_1 = require("smart-buffer");
|
|
5
|
+
const semver = require("semver");
|
|
6
|
+
const util_1 = require("../../util");
|
|
7
|
+
class HandshakeResponseV3 {
|
|
8
|
+
constructor(buffer) {
|
|
9
|
+
this.watchPacketLength = true; // this will always be false for the new protocol versions
|
|
10
|
+
this.success = false;
|
|
11
|
+
this.readOffset = 0;
|
|
12
|
+
this.requestId = 0;
|
|
13
|
+
this.majorVersion = -1;
|
|
14
|
+
this.minorVersion = -1;
|
|
15
|
+
this.patchVersion = -1;
|
|
16
|
+
this.remainingPacketLength = -1;
|
|
17
|
+
// Required size of the handshake
|
|
18
|
+
if (buffer.byteLength >= 20) {
|
|
19
|
+
try {
|
|
20
|
+
let bufferReader = smart_buffer_1.SmartBuffer.fromBuffer(buffer);
|
|
21
|
+
this.magic = util_1.util.readStringNT(bufferReader); // magic_number
|
|
22
|
+
this.majorVersion = bufferReader.readInt32LE(); // protocol_major_version
|
|
23
|
+
this.minorVersion = bufferReader.readInt32LE(); // protocol_minor_version
|
|
24
|
+
this.patchVersion = bufferReader.readInt32LE(); // protocol_patch_version
|
|
25
|
+
const legacyReadSize = bufferReader.readOffset;
|
|
26
|
+
this.remainingPacketLength = bufferReader.readInt32LE(); // remaining_packet_length
|
|
27
|
+
const requiredBufferSize = this.remainingPacketLength + legacyReadSize;
|
|
28
|
+
this.revisionTimeStamp = new Date(Number(bufferReader.readBigUInt64LE())); // platform_revision_timestamp
|
|
29
|
+
if (bufferReader.length < requiredBufferSize) {
|
|
30
|
+
throw new Error(`Missing buffer data according to the remaining packet length: ${bufferReader.length}/${requiredBufferSize}`);
|
|
31
|
+
}
|
|
32
|
+
this.readOffset = requiredBufferSize;
|
|
33
|
+
const versionString = [this.majorVersion, this.minorVersion, this.patchVersion].join('.');
|
|
34
|
+
// We only support v3 or above with this handshake
|
|
35
|
+
if (!semver.satisfies(versionString, '>=3.0.0')) {
|
|
36
|
+
throw new Error(`unsupported version ${versionString}`);
|
|
37
|
+
}
|
|
38
|
+
this.success = true;
|
|
39
|
+
}
|
|
40
|
+
catch (error) {
|
|
41
|
+
// Could not parse
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
exports.HandshakeResponseV3 = HandshakeResponseV3;
|
|
47
|
+
//# sourceMappingURL=HandshakeResponseV3.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HandshakeResponseV3.js","sourceRoot":"","sources":["../../../src/debugProtocol/responses/HandshakeResponseV3.ts"],"names":[],"mappings":";;;AAAA,+CAA2C;AAC3C,iCAAiC;AACjC,qCAAkC;AAElC,MAAa,mBAAmB;IAE5B,YAAY,MAAc;QAkCnB,sBAAiB,GAAG,IAAI,CAAC,CAAC,0DAA0D;QACpF,YAAO,GAAG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AAC,YAAY,EAAE,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;gBAE1F,kDAAkD;gBAClD,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,aAAa,EAAE,SAAS,CAAC,EAAE;oBAC7C,MAAM,IAAI,KAAK,CAAC,uBAAuB,aAAa,EAAE,CAAC,CAAC;iBAC3D;gBACD,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;aACvB;YAAC,OAAO,KAAK,EAAE;gBACZ,kBAAkB;aACrB;SACJ;IACL,CAAC;CAcJ;AAhDD,kDAgDC"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
export declare class
|
|
2
|
+
export declare class ProtocolEvent {
|
|
3
3
|
constructor(buffer: Buffer);
|
|
4
4
|
success: boolean;
|
|
5
5
|
readOffset: number;
|
|
6
|
+
packetLength: number;
|
|
6
7
|
requestId: number;
|
|
7
|
-
|
|
8
|
+
updateType: number;
|
|
9
|
+
errorCode: number;
|
|
8
10
|
data: number;
|
|
9
11
|
}
|
|
@@ -1,26 +1,32 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.ProtocolEvent = void 0;
|
|
4
4
|
const smart_buffer_1 = require("smart-buffer");
|
|
5
|
-
|
|
6
|
-
class Response {
|
|
5
|
+
class ProtocolEvent {
|
|
7
6
|
constructor(buffer) {
|
|
8
7
|
this.success = false;
|
|
9
8
|
this.readOffset = 0;
|
|
10
9
|
// response fields
|
|
10
|
+
this.packetLength = 0;
|
|
11
11
|
this.requestId = -1;
|
|
12
|
+
this.updateType = -1;
|
|
13
|
+
this.errorCode = -1;
|
|
12
14
|
this.data = -1;
|
|
13
15
|
// The smallest a request response can be
|
|
14
16
|
if (buffer.byteLength >= 8) {
|
|
15
17
|
try {
|
|
16
18
|
let bufferReader = smart_buffer_1.SmartBuffer.fromBuffer(buffer);
|
|
17
19
|
this.requestId = bufferReader.readUInt32LE(); // request_id
|
|
20
|
+
this.errorCode = bufferReader.readUInt32LE(); // error_code
|
|
18
21
|
// Any request id less then one is an update and we should not process it here
|
|
19
22
|
if (this.requestId > 0) {
|
|
20
|
-
this.errorCode = Constants_1.ERROR_CODES[bufferReader.readUInt32LE()]; // error_code
|
|
21
23
|
this.readOffset = bufferReader.readOffset;
|
|
22
|
-
this.success = true;
|
|
23
24
|
}
|
|
25
|
+
else if (this.requestId === 0) {
|
|
26
|
+
this.updateType = bufferReader.readUInt32LE();
|
|
27
|
+
}
|
|
28
|
+
this.readOffset = bufferReader.readOffset;
|
|
29
|
+
this.success = true;
|
|
24
30
|
}
|
|
25
31
|
catch (error) {
|
|
26
32
|
// Could not parse
|
|
@@ -28,5 +34,5 @@ class Response {
|
|
|
28
34
|
}
|
|
29
35
|
}
|
|
30
36
|
}
|
|
31
|
-
exports.
|
|
32
|
-
//# sourceMappingURL=
|
|
37
|
+
exports.ProtocolEvent = ProtocolEvent;
|
|
38
|
+
//# sourceMappingURL=ProtocolEvent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProtocolEvent.js","sourceRoot":"","sources":["../../../src/debugProtocol/responses/ProtocolEvent.ts"],"names":[],"mappings":";;;AAAA,+CAA2C;AAE3C,MAAa,aAAa;IACtB,YAAY,MAAc;QAsBnB,YAAO,GAAG,KAAK,CAAC;QAChB,eAAU,GAAG,CAAC,CAAC;QAEtB,kBAAkB;QACX,iBAAY,GAAG,CAAC,CAAC;QACjB,cAAS,GAAG,CAAC,CAAC,CAAC;QACf,eAAU,GAAG,CAAC,CAAC,CAAC;QAChB,cAAS,GAAG,CAAC,CAAC,CAAC;QACf,SAAI,GAAG,CAAC,CAAC,CAAC;QA7Bb,yCAAyC;QACzC,IAAI,MAAM,CAAC,UAAU,IAAI,CAAC,EAAE;YACxB,IAAI;gBACA,IAAI,YAAY,GAAG,0BAAW,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;gBAClD,IAAI,CAAC,SAAS,GAAG,YAAY,CAAC,YAAY,EAAE,CAAC,CAAC,aAAa;gBAC3D,IAAI,CAAC,SAAS,GAAG,YAAY,CAAC,YAAY,EAAE,CAAC,CAAC,aAAa;gBAE3D,8EAA8E;gBAC9E,IAAI,IAAI,CAAC,SAAS,GAAG,CAAC,EAAE;oBACpB,IAAI,CAAC,UAAU,GAAG,YAAY,CAAC,UAAU,CAAC;iBAC7C;qBAAM,IAAI,IAAI,CAAC,SAAS,KAAK,CAAC,EAAE;oBAC7B,IAAI,CAAC,UAAU,GAAG,YAAY,CAAC,YAAY,EAAE,CAAC;iBACjD;gBACD,IAAI,CAAC,UAAU,GAAG,YAAY,CAAC,UAAU,CAAC;gBAC1C,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;aACvB;YAAC,OAAO,KAAK,EAAE;gBACZ,kBAAkB;aACrB;SACJ;IACL,CAAC;CAWJ;AAhCD,sCAgCC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ProtocolEventV3 = void 0;
|
|
4
|
+
const smart_buffer_1 = require("smart-buffer");
|
|
5
|
+
class ProtocolEventV3 {
|
|
6
|
+
constructor(buffer) {
|
|
7
|
+
this.success = false;
|
|
8
|
+
this.readOffset = 0;
|
|
9
|
+
// response fields
|
|
10
|
+
this.packetLength = 0;
|
|
11
|
+
this.requestId = -1;
|
|
12
|
+
this.updateType = -1;
|
|
13
|
+
this.errorCode = -1;
|
|
14
|
+
this.data = -1;
|
|
15
|
+
// The smallest a request response can be
|
|
16
|
+
if (buffer.byteLength >= 12) {
|
|
17
|
+
try {
|
|
18
|
+
let bufferReader = smart_buffer_1.SmartBuffer.fromBuffer(buffer);
|
|
19
|
+
this.packetLength = bufferReader.readUInt32LE(); // packet_length
|
|
20
|
+
this.requestId = bufferReader.readUInt32LE(); // request_id
|
|
21
|
+
this.errorCode = bufferReader.readUInt32LE(); // error_code
|
|
22
|
+
if (bufferReader.length < this.packetLength) {
|
|
23
|
+
throw new Error(`Incomplete packet. Bytes received: ${bufferReader.length}/${this.packetLength}`);
|
|
24
|
+
}
|
|
25
|
+
// Any request id less then one is an update and we should not process it here
|
|
26
|
+
if (this.requestId > 0) {
|
|
27
|
+
this.readOffset = bufferReader.readOffset;
|
|
28
|
+
}
|
|
29
|
+
else if (this.requestId === 0) {
|
|
30
|
+
this.updateType = bufferReader.readUInt32LE();
|
|
31
|
+
}
|
|
32
|
+
this.readOffset = bufferReader.readOffset;
|
|
33
|
+
this.success = true;
|
|
34
|
+
}
|
|
35
|
+
catch (error) {
|
|
36
|
+
// Could not parse
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
exports.ProtocolEventV3 = ProtocolEventV3;
|
|
42
|
+
//# sourceMappingURL=ProtocolEventV3.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProtocolEventV3.js","sourceRoot":"","sources":["../../../src/debugProtocol/responses/ProtocolEventV3.ts"],"names":[],"mappings":";;;AAAA,+CAA2C;AAE3C,MAAa,eAAe;IACxB,YAAY,MAAc;QA0BnB,YAAO,GAAG,KAAK,CAAC;QAChB,eAAU,GAAG,CAAC,CAAC;QAEtB,kBAAkB;QACX,iBAAY,GAAG,CAAC,CAAC;QACjB,cAAS,GAAG,CAAC,CAAC,CAAC;QACf,eAAU,GAAG,CAAC,CAAC,CAAC;QAChB,cAAS,GAAG,CAAC,CAAC,CAAC;QACf,SAAI,GAAG,CAAC,CAAC,CAAC;QAjCb,yCAAyC;QACzC,IAAI,MAAM,CAAC,UAAU,IAAI,EAAE,EAAE;YACzB,IAAI;gBACA,IAAI,YAAY,GAAG,0BAAW,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;gBAClD,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC,YAAY,EAAE,CAAC,CAAC,gBAAgB;gBACjE,IAAI,CAAC,SAAS,GAAG,YAAY,CAAC,YAAY,EAAE,CAAC,CAAC,aAAa;gBAC3D,IAAI,CAAC,SAAS,GAAG,YAAY,CAAC,YAAY,EAAE,CAAC,CAAC,aAAa;gBAE3D,IAAI,YAAY,CAAC,MAAM,GAAG,IAAI,CAAC,YAAY,EAAE;oBACzC,MAAM,IAAI,KAAK,CAAC,sCAAsC,YAAY,CAAC,MAAM,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC,CAAC;iBACrG;gBAED,8EAA8E;gBAC9E,IAAI,IAAI,CAAC,SAAS,GAAG,CAAC,EAAE;oBACpB,IAAI,CAAC,UAAU,GAAG,YAAY,CAAC,UAAU,CAAC;iBAC7C;qBAAM,IAAI,IAAI,CAAC,SAAS,KAAK,CAAC,EAAE;oBAC7B,IAAI,CAAC,UAAU,GAAG,YAAY,CAAC,YAAY,EAAE,CAAC;iBACjD;gBACD,IAAI,CAAC,UAAU,GAAG,YAAY,CAAC,UAAU,CAAC;gBAC1C,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;aACvB;YAAC,OAAO,KAAK,EAAE;gBACZ,kBAAkB;aACrB;SACJ;IACL,CAAC;CAUJ;AApCD,0CAoCC"}
|
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.StackEntry = exports.StackTraceResponse = void 0;
|
|
4
4
|
const path = require("path");
|
|
5
5
|
const smart_buffer_1 = require("smart-buffer");
|
|
6
|
-
const Constants_1 = require("../Constants");
|
|
7
6
|
const util_1 = require("../../util");
|
|
8
7
|
class StackTraceResponse {
|
|
9
8
|
constructor(buffer) {
|
|
@@ -11,6 +10,7 @@ class StackTraceResponse {
|
|
|
11
10
|
this.readOffset = 0;
|
|
12
11
|
// response fields
|
|
13
12
|
this.requestId = -1;
|
|
13
|
+
this.errorCode = -1;
|
|
14
14
|
this.stackSize = -1;
|
|
15
15
|
this.entries = [];
|
|
16
16
|
// The smallest a stacktrace request response can be
|
|
@@ -20,7 +20,7 @@ class StackTraceResponse {
|
|
|
20
20
|
this.requestId = bufferReader.readUInt32LE();
|
|
21
21
|
// Any request id less then one is an update and we should not process it here
|
|
22
22
|
if (this.requestId > 0) {
|
|
23
|
-
this.errorCode =
|
|
23
|
+
this.errorCode = bufferReader.readUInt32LE();
|
|
24
24
|
this.stackSize = bufferReader.readUInt32LE();
|
|
25
25
|
for (let i = 0; i < this.stackSize; i++) {
|
|
26
26
|
let stackEntry = new StackEntry(bufferReader);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StackTraceResponse.js","sourceRoot":"","sources":["../../../src/debugProtocol/responses/StackTraceResponse.ts"],"names":[],"mappings":";;;AAAA,6BAA6B;AAC7B,+CAA2C;AAC3C,
|
|
1
|
+
{"version":3,"file":"StackTraceResponse.js","sourceRoot":"","sources":["../../../src/debugProtocol/responses/StackTraceResponse.ts"],"names":[],"mappings":";;;AAAA,6BAA6B;AAC7B,+CAA2C;AAC3C,qCAAkC;AAElC,MAAa,kBAAkB;IAE3B,YAAY,MAAc;QA4BnB,YAAO,GAAG,KAAK,CAAC;QAChB,eAAU,GAAG,CAAC,CAAC;QAEtB,kBAAkB;QACX,cAAS,GAAG,CAAC,CAAC,CAAC;QACf,cAAS,GAAG,CAAC,CAAC,CAAC;QACf,cAAS,GAAG,CAAC,CAAC,CAAC;QACf,YAAO,GAAG,EAAE,CAAC;QAlChB,oDAAoD;QACpD,IAAI,MAAM,CAAC,UAAU,IAAI,CAAC,EAAE;YACxB,IAAI;gBACA,IAAI,YAAY,GAAG,0BAAW,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;gBAClD,IAAI,CAAC,SAAS,GAAG,YAAY,CAAC,YAAY,EAAE,CAAC;gBAE7C,8EAA8E;gBAC9E,IAAI,IAAI,CAAC,SAAS,GAAG,CAAC,EAAE;oBACpB,IAAI,CAAC,SAAS,GAAG,YAAY,CAAC,Y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AlBD,gCAkBC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { SmartBuffer } from 'smart-buffer';
|
|
3
|
+
export declare class StackTraceResponseV3 {
|
|
4
|
+
constructor(buffer: Buffer);
|
|
5
|
+
success: boolean;
|
|
6
|
+
readOffset: number;
|
|
7
|
+
requestId: number;
|
|
8
|
+
errorCode: number;
|
|
9
|
+
stackSize: number;
|
|
10
|
+
entries: any[];
|
|
11
|
+
}
|
|
12
|
+
export declare class StackEntryV3 {
|
|
13
|
+
constructor(bufferReader: SmartBuffer);
|
|
14
|
+
success: boolean;
|
|
15
|
+
lineNumber: number;
|
|
16
|
+
functionName: string;
|
|
17
|
+
fileName: string;
|
|
18
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.StackEntryV3 = exports.StackTraceResponseV3 = void 0;
|
|
4
|
+
const path = require("path");
|
|
5
|
+
const smart_buffer_1 = require("smart-buffer");
|
|
6
|
+
const util_1 = require("../../util");
|
|
7
|
+
class StackTraceResponseV3 {
|
|
8
|
+
constructor(buffer) {
|
|
9
|
+
this.success = false;
|
|
10
|
+
this.readOffset = 0;
|
|
11
|
+
// response fields
|
|
12
|
+
this.requestId = -1;
|
|
13
|
+
this.errorCode = -1;
|
|
14
|
+
this.stackSize = -1;
|
|
15
|
+
this.entries = [];
|
|
16
|
+
// The smallest a stacktrace request response can be
|
|
17
|
+
if (buffer.byteLength >= 8) {
|
|
18
|
+
try {
|
|
19
|
+
let bufferReader = smart_buffer_1.SmartBuffer.fromBuffer(buffer);
|
|
20
|
+
this.requestId = bufferReader.readUInt32LE();
|
|
21
|
+
// Any request id less then one is an update and we should not process it here
|
|
22
|
+
if (this.requestId > 0) {
|
|
23
|
+
this.errorCode = bufferReader.readUInt32LE();
|
|
24
|
+
this.stackSize = bufferReader.readUInt32LE();
|
|
25
|
+
for (let i = 0; i < this.stackSize; i++) {
|
|
26
|
+
let stackEntry = new StackEntryV3(bufferReader);
|
|
27
|
+
if (stackEntry.success) {
|
|
28
|
+
// All the necessary stack entry data was present. Push to the entries array.
|
|
29
|
+
this.entries.push(stackEntry);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
this.readOffset = bufferReader.readOffset;
|
|
33
|
+
this.success = (this.entries.length === this.stackSize);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
catch (error) {
|
|
37
|
+
// Could not parse
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
exports.StackTraceResponseV3 = StackTraceResponseV3;
|
|
43
|
+
class StackEntryV3 {
|
|
44
|
+
constructor(bufferReader) {
|
|
45
|
+
this.success = false;
|
|
46
|
+
// response fields
|
|
47
|
+
this.lineNumber = -1;
|
|
48
|
+
this.lineNumber = bufferReader.readUInt32LE();
|
|
49
|
+
// NOTE: this is documented as being function name then file name but it is being returned by the device backwards.
|
|
50
|
+
this.functionName = util_1.util.readStringNT(bufferReader);
|
|
51
|
+
this.fileName = util_1.util.readStringNT(bufferReader);
|
|
52
|
+
let fileExtension = path.extname(this.fileName).toLowerCase();
|
|
53
|
+
// NOTE:Make sure we have a full valid path (?? can be valid because the device might not know the file).
|
|
54
|
+
this.success = (fileExtension === '.brs' || fileExtension === '.xml' || this.fileName === '??');
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
exports.StackEntryV3 = StackEntryV3;
|
|
58
|
+
//# sourceMappingURL=StackTraceResponseV3.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StackTraceResponseV3.js","sourceRoot":"","sources":["../../../src/debugProtocol/responses/StackTraceResponseV3.ts"],"names":[],"mappings":";;;AAAA,6BAA6B;AAC7B,+CAA2C;AAC3C,qCAAkC;AAElC,MAAa,oBAAoB;IAE7B,YAAY,MAAc;QA4BnB,YAAO,GAAG,KAAK,CA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CAAC,CAAC;QAZnB,IAAI,CAAC,UAAU,GAAG,YAAY,CAAC,YAAY,EAAE,CAAC;QAC9C,mHAAmH;QACnH,IAAI,CAAC,YAAY,GAAG,WAAI,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC;QACpD,IAAI,CAAC,QAAQ,GAAG,WAAI,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC;QAEhD,IAAI,aAAa,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,WAAW,EAAE,CAAC;QAC9D,yGAAyG;QACzG,IAAI,CAAC,OAAO,GAAG,CAAC,aAAa,KAAK,MAAM,IAAI,aAAa,KAAK,MAAM,IAAI,IAAI,CAAC,QAAQ,KAAK,IAAI,CAAC,CAAC;IACpG,CAAC;CAOJ;AAlBD,oCAkBC"}
|
|
@@ -11,6 +11,7 @@ class ThreadsResponse {
|
|
|
11
11
|
this.readOffset = 0;
|
|
12
12
|
// response fields
|
|
13
13
|
this.requestId = -1;
|
|
14
|
+
this.errorCode = -1;
|
|
14
15
|
this.threadsCount = -1;
|
|
15
16
|
this.threads = [];
|
|
16
17
|
// The smallest a threads request response can be
|
|
@@ -20,7 +21,7 @@ class ThreadsResponse {
|
|
|
20
21
|
this.requestId = bufferReader.readUInt32LE();
|
|
21
22
|
// Any request id less then one is an update and we should not process it here
|
|
22
23
|
if (this.requestId > 0) {
|
|
23
|
-
this.errorCode =
|
|
24
|
+
this.errorCode = bufferReader.readUInt32LE();
|
|
24
25
|
this.threadsCount = bufferReader.readUInt32LE();
|
|
25
26
|
for (let i = 0; i < this.threadsCount; i++) {
|
|
26
27
|
let stackEntry = new ThreadInfo(bufferReader);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThreadsResponse.js","sourceRoot":"","sources":["../../../src/debugProtocol/responses/ThreadsResponse.ts"],"names":[],"mappings":";;;AAAA,6BAA6B;AAC7B,+CAA2C;AAC3C,
|
|
1
|
+
{"version":3,"file":"Thread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
+
this.updateType = -1;
|
|
12
14
|
this.data = -1;
|
|
13
15
|
// The minimum size of a undefined response
|
|
14
16
|
if (buffer.byteLength >= 12) {
|
|
@@ -17,10 +19,10 @@ class UndefinedResponse {
|
|
|
17
19
|
this.requestId = bufferReader.readUInt32LE();
|
|
18
20
|
// Updates will always have an id of zero because we didn't ask for this information
|
|
19
21
|
if (this.requestId === 0) {
|
|
20
|
-
this.errorCode =
|
|
21
|
-
this.updateType =
|
|
22
|
+
this.errorCode = bufferReader.readUInt32LE();
|
|
23
|
+
this.updateType = bufferReader.readUInt32LE();
|
|
22
24
|
// Only handle undefined events in this class
|
|
23
|
-
if (this.updateType ===
|
|
25
|
+
if (this.updateType === Constants_1.UPDATE_TYPES.UNDEF) {
|
|
24
26
|
this.data = bufferReader.readUInt8();
|
|
25
27
|
this.readOffset = bufferReader.readOffset;
|
|
26
28
|
this.success = true;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UndefinedResponse.js","sourceRoot":"","sources":["../../../src/debugProtocol/responses/UndefinedResponse.ts"],"names":[],"mappings":";;;AAAA,+CAA2C;AAC3C,
|
|
1
|
+
{"version":3,"file":"UndefinedResponse.js","sourceRoot":"","sources":["../../../src/debugProtocol/responses/UndefinedResponse.ts"],"names":[],"mappings":";;;AAAA,+CAA2C;AAC3C,4CAA4C;AAE5C,MAAa,iBAAiB;IAE1B,YAAY,MAAc;QAwBnB,YAAO,GAAG,KAAK,CAAC;QAChB,eAAU,GAAG,CAAC,CAAC;QAEtB,kBAAkB;QACX,cAAS,GAAG,CAAC,CAAC,CAAC;QACf,cAAS,GAAG,CAAC,CAAC,CAAC;QACf,eAAU,GAAG,CAAC,CAAC,CAAC;QAChB,SAAI,GAAG,CAAC,CAAC,CAAC;QA9Bb,2CAA2C;QAC3C,IAAI,MAAM,CAAC,UAAU,IAAI,EAAE,EAAE;YACzB,IAAI;gBACA,IAAI,YAAY,GAAG,0BAAW,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;gBAClD,IAAI,CAAC,SAAS,GAAG,YAAY,CAAC,YAAY,EAAE,CAAC;gBAE7C,oFAAoF;gBACpF,IAAI,IAAI,CAAC,SAAS,KAAK,CAAC,EAAE;oBACtB,IAAI,CAAC,SAAS,GAAG,YAAY,CAAC,YAAY,EAAE,CAAC;oBAC7C,IAAI,CAAC,UAAU,GAAG,YAAY,CAAC,YAAY,EAAE,CAAC;oBAE9C,6CAA6C;oBAC7C,IAAI,IAAI,CAAC,UAAU,KAAK,wBAAY,CAAC,KAAK,EAAE;wBACxC,IAAI,CAAC,IAAI,GAAG,YAAY,CAAC,SAAS,EAAE,CAAC;wBACrC,IAAI,CAAC,UAAU,GAAG,YAAY,CAAC,UAAU,CAAC;wBAC1C,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;qBACvB;iBACJ;aACJ;YAAC,OAAO,KAAK,EAAE;gBACZ,oBAAoB;aACvB;SACJ;IACL,CAAC;CASJ;AAlCD,8CAkCC"}
|
|
@@ -5,8 +5,8 @@ export declare class UpdateThreadsResponse {
|
|
|
5
5
|
success: boolean;
|
|
6
6
|
readOffset: number;
|
|
7
7
|
requestId: number;
|
|
8
|
-
errorCode:
|
|
9
|
-
updateType:
|
|
8
|
+
errorCode: number;
|
|
9
|
+
updateType: number;
|
|
10
10
|
data: ThreadAttached | ThreadsStopped;
|
|
11
11
|
}
|
|
12
12
|
export declare class ThreadsStopped {
|
|
@@ -10,18 +10,20 @@ class UpdateThreadsResponse {
|
|
|
10
10
|
this.readOffset = 0;
|
|
11
11
|
// response fields
|
|
12
12
|
this.requestId = -1;
|
|
13
|
+
this.errorCode = -1;
|
|
14
|
+
this.updateType = -1;
|
|
13
15
|
if (buffer.byteLength >= 12) {
|
|
14
16
|
try {
|
|
15
17
|
let bufferReader = smart_buffer_1.SmartBuffer.fromBuffer(buffer);
|
|
16
18
|
this.requestId = bufferReader.readUInt32LE();
|
|
17
19
|
if (this.requestId === 0) {
|
|
18
|
-
this.errorCode =
|
|
19
|
-
this.updateType =
|
|
20
|
+
this.errorCode = bufferReader.readUInt32LE();
|
|
21
|
+
this.updateType = bufferReader.readUInt32LE();
|
|
20
22
|
let threadsUpdate;
|
|
21
|
-
if (this.updateType ===
|
|
23
|
+
if (this.updateType === Constants_1.UPDATE_TYPES.ALL_THREADS_STOPPED) {
|
|
22
24
|
threadsUpdate = new ThreadsStopped(bufferReader);
|
|
23
25
|
}
|
|
24
|
-
else if (this.updateType ===
|
|
26
|
+
else if (this.updateType === Constants_1.UPDATE_TYPES.THREAD_ATTACHED) {
|
|
25
27
|
threadsUpdate = new ThreadAttached(bufferReader);
|
|
26
28
|
}
|
|
27
29
|
if (threadsUpdate === null || threadsUpdate === void 0 ? void 0 : threadsUpdate.success) {
|
|
@@ -46,7 +48,7 @@ class ThreadsStopped {
|
|
|
46
48
|
this.stopReason = -1;
|
|
47
49
|
if (bufferReader.length >= bufferReader.readOffset + 6) {
|
|
48
50
|
this.primaryThreadIndex = bufferReader.readInt32LE();
|
|
49
|
-
this.stopReason =
|
|
51
|
+
this.stopReason = getStopReason(bufferReader.readUInt8());
|
|
50
52
|
this.stopReasonDetail = util_1.util.readStringNT(bufferReader);
|
|
51
53
|
this.success = true;
|
|
52
54
|
}
|
|
@@ -61,11 +63,29 @@ class ThreadAttached {
|
|
|
61
63
|
this.stopReason = -1;
|
|
62
64
|
if (bufferReader.length >= bufferReader.readOffset + 6) {
|
|
63
65
|
this.threadIndex = bufferReader.readInt32LE();
|
|
64
|
-
this.stopReason =
|
|
66
|
+
this.stopReason = getStopReason(bufferReader.readUInt8());
|
|
65
67
|
this.stopReasonDetail = util_1.util.readStringNT(bufferReader);
|
|
66
68
|
this.success = true;
|
|
67
69
|
}
|
|
68
70
|
}
|
|
69
71
|
}
|
|
70
72
|
exports.ThreadAttached = ThreadAttached;
|
|
73
|
+
function getStopReason(value) {
|
|
74
|
+
switch (value) {
|
|
75
|
+
case Constants_1.STOP_REASONS.BREAK:
|
|
76
|
+
return Constants_1.STOP_REASONS.BREAK;
|
|
77
|
+
case Constants_1.STOP_REASONS.NORMAL_EXIT:
|
|
78
|
+
return Constants_1.STOP_REASONS.NORMAL_EXIT;
|
|
79
|
+
case Constants_1.STOP_REASONS.NOT_STOPPED:
|
|
80
|
+
return Constants_1.STOP_REASONS.NOT_STOPPED;
|
|
81
|
+
case Constants_1.STOP_REASONS.RUNTIME_ERROR:
|
|
82
|
+
return Constants_1.STOP_REASONS.RUNTIME_ERROR;
|
|
83
|
+
case Constants_1.STOP_REASONS.STOP_STATEMENT:
|
|
84
|
+
return Constants_1.STOP_REASONS.STOP_STATEMENT;
|
|
85
|
+
case Constants_1.STOP_REASONS.UNDEFINED:
|
|
86
|
+
return Constants_1.STOP_REASONS.UNDEFINED;
|
|
87
|
+
default:
|
|
88
|
+
return Constants_1.STOP_REASONS.UNDEFINED;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
71
91
|
//# sourceMappingURL=UpdateThreadsResponse.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UpdateThreadsResponse.js","sourceRoot":"","sources":["../../../src/debugProtocol/responses/UpdateThreadsResponse.ts"],"names":[],"mappings":";;;AAAA,+CAA2C;AAC3C,
|
|
1
|
+
{"version":3,"file":"UpdateThreadsResponse.js","sourceRoot":"","sources":["../../../src/debugProtocol/responses/UpdateThreadsResponse.ts"],"names":[],"mappings":";;;AAAA,+CAA2C;AAC3C,4CAA0D;AAC1D,qCAAkC;AAElC,MAAa,qBAAqB;IAE9B,YAAY,MAAc;QA2BnB,YAAO,GAAG,KAAK,CAAC;QAChB,eAAU,GAAG,CAAC,CAAC;QAEtB,kBAAkB;QACX,cAAS,GAAG,CAAC,CAAC,CAAC;QACf,cAAS,GAAG,CAAC,CAAC,CAAC;QACf,eAAU,GAAG,CAAC,CAAC,CAAC;QAhCnB,IAAI,MAAM,CAAC,UAAU,IAAI,EAAE,EAAE;YACzB,IAAI;gBACA,IAAI,YAAY,GAAG,0BAAW,CAAC,UAAU,CAA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ariableResponse {
|
|
|
5
5
|
success: boolean;
|
|
6
6
|
readOffset: number;
|
|
7
7
|
requestId: number;
|
|
8
|
-
errorCode:
|
|
8
|
+
errorCode: number;
|
|
9
9
|
numVariables: number;
|
|
10
10
|
variables: VariableInfo[];
|
|
11
11
|
}
|
|
@@ -23,5 +23,5 @@ export declare class VariableInfo {
|
|
|
23
23
|
refCount: number;
|
|
24
24
|
keyType: string;
|
|
25
25
|
elementCount: number;
|
|
26
|
-
value:
|
|
26
|
+
value: number | string | boolean | bigint | null;
|
|
27
27
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.VariableInfo = exports.VariableResponse = void 0;
|
|
4
|
+
/* eslint-disable no-bitwise */
|
|
4
5
|
const smart_buffer_1 = require("smart-buffer");
|
|
5
6
|
const Constants_1 = require("../Constants");
|
|
6
7
|
const util_1 = require("../../util");
|
|
@@ -10,6 +11,7 @@ class VariableResponse {
|
|
|
10
11
|
this.readOffset = 0;
|
|
11
12
|
// response fields
|
|
12
13
|
this.requestId = -1;
|
|
14
|
+
this.errorCode = -1;
|
|
13
15
|
this.numVariables = -1;
|
|
14
16
|
this.variables = [];
|
|
15
17
|
// Minimum variable request response size
|
|
@@ -19,7 +21,7 @@ class VariableResponse {
|
|
|
19
21
|
this.requestId = bufferReader.readUInt32LE();
|
|
20
22
|
// Any request id less then one is an update and we should not process it here
|
|
21
23
|
if (this.requestId > 0) {
|
|
22
|
-
this.errorCode =
|
|
24
|
+
this.errorCode = bufferReader.readUInt32LE();
|
|
23
25
|
this.numVariables = bufferReader.readUInt32LE();
|
|
24
26
|
// iterate over each variable in the buffer data and create a Variable Info object
|
|
25
27
|
for (let i = 0; i < this.numVariables; i++) {
|
|
@@ -46,12 +48,14 @@ class VariableInfo {
|
|
|
46
48
|
this.refCount = -1;
|
|
47
49
|
this.elementCount = -1;
|
|
48
50
|
if (bufferReader.length >= 13) {
|
|
49
|
-
// Determine the different variable properties
|
|
50
51
|
let bitwiseMask = bufferReader.readUInt8();
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
// Determine the different variable properties
|
|
53
|
+
this.isChildKey = (bitwiseMask & Constants_1.VARIABLE_FLAGS.isChildKey) > 0;
|
|
54
|
+
this.isConst = (bitwiseMask & Constants_1.VARIABLE_FLAGS.isConst) > 0;
|
|
55
|
+
this.isContainer = (bitwiseMask & Constants_1.VARIABLE_FLAGS.isContainer) > 0;
|
|
56
|
+
this.isNameHere = (bitwiseMask & Constants_1.VARIABLE_FLAGS.isNameHere) > 0;
|
|
57
|
+
this.isRefCounted = (bitwiseMask & Constants_1.VARIABLE_FLAGS.isRefCounted) > 0;
|
|
58
|
+
this.isValueHere = (bitwiseMask & Constants_1.VARIABLE_FLAGS.isValueHere) > 0;
|
|
55
59
|
this.variableType = Constants_1.VARIABLE_TYPES[bufferReader.readUInt8()];
|
|
56
60
|
if (this.isNameHere) {
|
|
57
61
|
// YAY we have a name. Pull it out of the buffer.
|
|
@@ -69,7 +73,6 @@ class VariableInfo {
|
|
|
69
73
|
this.elementCount = bufferReader.readUInt32LE();
|
|
70
74
|
}
|
|
71
75
|
// Pull out the variable data based on the type if that type returns a value
|
|
72
|
-
let value;
|
|
73
76
|
switch (this.variableType) {
|
|
74
77
|
case 'Interface':
|
|
75
78
|
case 'Object':
|
|
@@ -117,9 +120,14 @@ class VariableInfo {
|
|
|
117
120
|
this.value = 'Unknown';
|
|
118
121
|
this.success = true;
|
|
119
122
|
break;
|
|
120
|
-
|
|
123
|
+
case 'AA':
|
|
124
|
+
case 'Array':
|
|
121
125
|
this.value = null;
|
|
122
126
|
this.success = true;
|
|
127
|
+
break;
|
|
128
|
+
default:
|
|
129
|
+
this.value = null;
|
|
130
|
+
this.success = false;
|
|
123
131
|
}
|
|
124
132
|
}
|
|
125
133
|
}
|