roku-debug 0.23.11 → 0.23.12

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.
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ThreadsRequest = void 0;
3
+ exports.ThreadRequestFlags = exports.ThreadsRequest = 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 ProtocolUtil_1 = require("../../ProtocolUtil");
@@ -12,29 +13,50 @@ class ThreadsRequest {
12
13
  */
13
14
  this.readOffset = undefined;
14
15
  this.data = {
15
- //common props
16
16
  packetLength: undefined,
17
17
  requestId: undefined,
18
18
  command: Constants_1.Command.Threads
19
19
  };
20
20
  }
21
21
  static fromJson(data) {
22
+ var _a;
23
+ var _b;
22
24
  const request = new ThreadsRequest();
23
25
  ProtocolUtil_1.protocolUtil.loadJson(request, data);
26
+ //default any missing value to false
27
+ (_a = (_b = request.data).includeIdentityInfo) !== null && _a !== void 0 ? _a : (_b.includeIdentityInfo = false);
24
28
  return request;
25
29
  }
26
30
  static fromBuffer(buffer) {
27
31
  const request = new ThreadsRequest();
28
32
  ProtocolUtil_1.protocolUtil.bufferLoaderHelper(request, buffer, 12, (smartBuffer) => {
29
33
  ProtocolUtil_1.protocolUtil.loadCommonRequestFields(request, smartBuffer);
34
+ //the flags field is only present on firmware that supports it; older firmware omits it entirely
35
+ if (smartBuffer.remaining() >= 4) {
36
+ const threadsRequestFlags = smartBuffer.readUInt32LE(); // threads_request_flags
37
+ request.data.includeIdentityInfo = !!(threadsRequestFlags & ThreadRequestFlags.includeIdentityInfo);
38
+ }
39
+ else {
40
+ request.data.includeIdentityInfo = false;
41
+ }
30
42
  });
31
43
  return request;
32
44
  }
33
45
  toBuffer() {
34
46
  const smartBuffer = new smart_buffer_1.SmartBuffer();
47
+ //older firmware doesn't expect the flags field at all, so we only include it when configured.
48
+ if (this.data.includeIdentityInfo) {
49
+ let threadsRequestFlags = 0;
50
+ threadsRequestFlags |= this.data.includeIdentityInfo ? ThreadRequestFlags.includeIdentityInfo : 0;
51
+ smartBuffer.writeUInt32LE(threadsRequestFlags); // threads_request_flags
52
+ }
35
53
  ProtocolUtil_1.protocolUtil.insertCommonRequestFields(this, smartBuffer);
36
54
  return smartBuffer.toBuffer();
37
55
  }
38
56
  }
39
57
  exports.ThreadsRequest = ThreadsRequest;
58
+ var ThreadRequestFlags;
59
+ (function (ThreadRequestFlags) {
60
+ ThreadRequestFlags[ThreadRequestFlags["includeIdentityInfo"] = 1] = "includeIdentityInfo";
61
+ })(ThreadRequestFlags = exports.ThreadRequestFlags || (exports.ThreadRequestFlags = {}));
40
62
  //# sourceMappingURL=ThreadsRequest.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ThreadsRequest.js","sourceRoot":"","sources":["../../../../src/debugProtocol/events/requests/ThreadsRequest.ts"],"names":[],"mappings":";;;AAAA,+CAA2C;AAC3C,+CAA0C;AAC1C,qDAAkD;AAGlD,MAAa,cAAc;IAA3B;QAsBW,YAAO,GAAG,KAAK,CAAC;QACvB;;WAEG;QACI,eAAU,GAAW,SAAS,CAAC;QAE/B,SAAI,GAAG;YACV,cAAc;YACd,YAAY,EAAE,SAAmB;YACjC,SAAS,EAAE,SAAmB;YAC9B,OAAO,EAAE,mBAAO,CAAC,OAAO;SAC3B,CAAC;IACN,CAAC;IAhCU,MAAM,CAAC,QAAQ,CAAC,IAA2B;QAC9C,MAAM,OAAO,GAAG,IAAI,cAAc,EAAE,CAAC;QACrC,2BAAY,CAAC,QAAQ,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QACrC,OAAO,OAAO,CAAC;IACnB,CAAC;IAEM,MAAM,CAAC,UAAU,CAAC,MAAc;QACnC,MAAM,OAAO,GAAG,IAAI,cAAc,EAAE,CAAC;QACrC,2BAAY,CAAC,kBAAkB,CAAC,OAAO,EAAE,MAAM,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2BAAY,CAAC,uBAAuB,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;YAC3D,gGAAgG;YAChG,IAAI,WAAW,CAAC,SAAS,EAAE,IAAI,CAAC,EAAE;gBAC9B,MAAM,mBAAmB,GAAG,WAAW,CAAC,YAAY,EAAE,CAAC,CAAC,wBAAwB;gBAChF,OAAO,CAAC,IAAI,CAAC,mBAAmB,GAAG,CAAC,CAAC,CAAC,mBAAmB,GAAG,kBAAkB,CAAC,mBAAmB,CAAC,CAAC;aACvG;iBAAM;gBACH,OAAO,CAAC,IAAI,CAAC,mBAAmB,GAAG,KAAK,CAAC;aAC5C;QACL,CAAC,CAAC,CAAC;QACH,OAAO,OAAO,CAAC;IACnB,CAAC;IAEM,QAAQ;QACX,MAAM,WAAW,GAAG,IAAI,0BAAW,EAAE,CAAC;QACtC,8FAA8F;QAC9F,IAAI,IAAI,CAAC,IAAI,CAAC,mBAAmB,EAAE;YAC/B,IAAI,mBAAmB,GAAG,CAAC,CAAC;YAC5B,mBAAmB,IAAI,IAAI,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC,CAAC,kBAAkB,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,CAAC;YAClG,WAAW,CAAC,aAAa,CAAC,mBAAmB,CAAC,CAAC,CAAC,wBAAwB;SAC3E;QACD,2BAAY,CAAC,yBAAyB,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;QAC1D,OAAO,WAAW,CAAC,QAAQ,EAAE,CAAC;IAClC,CAAC;CAsBJ;AAzDD,wCAyDC;AAED,IAAY,kBAEX;AAFD,WAAY,kBAAkB;IAC1B,yFAA4B,CAAA;AAChC,CAAC,EAFW,kBAAkB,GAAlB,0BAAkB,KAAlB,0BAAkB,QAE7B"}
@@ -56,4 +56,16 @@ export interface ThreadInfo {
56
56
  * The code causing the stop or failure.
57
57
  */
58
58
  codeSnippet: string;
59
+ /**
60
+ * The ID of the thread (optional for debug protocol version ).
61
+ */
62
+ osThreadId?: string;
63
+ /**
64
+ * The name of the thread (optional).
65
+ */
66
+ name?: string;
67
+ /**
68
+ * The type of the thread (optional).
69
+ */
70
+ type?: string;
59
71
  }
@@ -42,25 +42,33 @@ class ThreadsResponse {
42
42
  const flags = smartBuffer.readUInt8();
43
43
  thread.isPrimary = (flags & ThreadInfoFlags.isPrimary) > 0;
44
44
  thread.isDetached = (flags & ThreadInfoFlags.isDetached) > 0;
45
+ const includesIdentityInfo = (flags & ThreadInfoFlags.includesIdentityInfo) > 0;
45
46
  thread.stopReason = Constants_1.StopReasonCode[smartBuffer.readUInt32LE()]; // stop_reason
46
47
  thread.stopReasonDetail = ProtocolUtil_1.protocolUtil.readStringNT(smartBuffer); // stop_reason_detail
47
48
  thread.lineNumber = smartBuffer.readUInt32LE(); // line_number
48
49
  thread.functionName = ProtocolUtil_1.protocolUtil.readStringNT(smartBuffer); // function_name
49
50
  thread.filePath = ProtocolUtil_1.protocolUtil.readStringNT(smartBuffer); // file_path
50
51
  thread.codeSnippet = ProtocolUtil_1.protocolUtil.readStringNT(smartBuffer); // code_snippet
52
+ if (includesIdentityInfo) {
53
+ thread.osThreadId = ProtocolUtil_1.protocolUtil.readStringNT(smartBuffer); // id
54
+ thread.name = ProtocolUtil_1.protocolUtil.readStringNT(smartBuffer); // name
55
+ thread.type = ProtocolUtil_1.protocolUtil.readStringNT(smartBuffer); // type
56
+ }
51
57
  response.data.threads.push(thread);
52
58
  }
53
59
  });
54
60
  return response;
55
61
  }
56
62
  toBuffer() {
57
- var _a, _b, _c;
63
+ var _a, _b, _c, _d, _e, _f, _g, _h;
58
64
  const smartBuffer = new smart_buffer_1.SmartBuffer();
59
65
  smartBuffer.writeUInt32LE((_b = (_a = this.data.threads) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0); // threads_count
60
- for (const thread of (_c = this.data.threads) !== null && _c !== void 0 ? _c : []) {
66
+ const includesIdentityInfo = (_d = (_c = this.data.threads) === null || _c === void 0 ? void 0 : _c.some(t => t.osThreadId || t.name || t.type)) !== null && _d !== void 0 ? _d : false;
67
+ for (const thread of (_e = this.data.threads) !== null && _e !== void 0 ? _e : []) {
61
68
  let flags = 0;
62
- flags |= thread.isPrimary ? 1 : 0;
63
- flags |= thread.isDetached ? 2 : 0;
69
+ flags |= thread.isPrimary ? ThreadInfoFlags.isPrimary : 0;
70
+ flags |= thread.isDetached ? ThreadInfoFlags.isDetached : 0;
71
+ flags |= includesIdentityInfo ? ThreadInfoFlags.includesIdentityInfo : 0;
64
72
  smartBuffer.writeUInt8(flags); //flags
65
73
  //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
66
74
  smartBuffer.writeUInt32LE(Constants_1.StopReasonCode[thread.stopReason]); // stop_reason
@@ -69,6 +77,11 @@ class ThreadsResponse {
69
77
  smartBuffer.writeStringNT(thread.functionName); // function_name
70
78
  smartBuffer.writeStringNT(thread.filePath); // file_path
71
79
  smartBuffer.writeStringNT(thread.codeSnippet); // code_snippet
80
+ if (includesIdentityInfo) {
81
+ smartBuffer.writeStringNT((_f = thread.osThreadId) !== null && _f !== void 0 ? _f : '');
82
+ smartBuffer.writeStringNT((_g = thread.name) !== null && _g !== void 0 ? _g : '');
83
+ smartBuffer.writeStringNT((_h = thread.type) !== null && _h !== void 0 ? _h : '');
84
+ }
72
85
  }
73
86
  ProtocolUtil_1.protocolUtil.insertCommonResponseFields(this, smartBuffer);
74
87
  return smartBuffer.toBuffer();
@@ -79,5 +92,9 @@ var ThreadInfoFlags;
79
92
  (function (ThreadInfoFlags) {
80
93
  ThreadInfoFlags[ThreadInfoFlags["isPrimary"] = 1] = "isPrimary";
81
94
  ThreadInfoFlags[ThreadInfoFlags["isDetached"] = 2] = "isDetached";
95
+ /**
96
+ * Does the response include the optional identity info fields (id, name, type)?
97
+ */
98
+ ThreadInfoFlags[ThreadInfoFlags["includesIdentityInfo"] = 4] = "includesIdentityInfo";
82
99
  })(ThreadInfoFlags || (ThreadInfoFlags = {}));
83
100
  //# sourceMappingURL=ThreadsResponse.js.map
@@ -1 +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;QA2DW,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;IA3EU,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,EAAE,EAAE,CAAC,WAAwB,EAAE,EAAE;YAC/E,2BAAY,CAAC,wBAAwB,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;YAE7D,MAAM,YAAY,GAAG,WAAW,CAAC,YAAY,EAAE,CAAC,CAAC,gBAAgB;YAEjE,QAAQ,CAAC,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC;YAE3B,4BAA4B;YAC5B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,YAAY,EAAE,CAAC,EAAE,EAAE;gBACnC,MAAM,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AAM,CAAC,UAAU,mCAAI,EAAE,CAAC,CAAC;gBACnD,WAAW,CAAC,aAAa,CAAC,MAAA,MAAM,CAAC,IAAI,mCAAI,EAAE,CAAC,CAAC;gBAC7C,WAAW,CAAC,aAAa,CAAC,MAAA,MAAM,CAAC,IAAI,mCAAI,EAAE,CAAC,CAAC;aAChD;SACJ;QACD,2BAAY,CAAC,0BAA0B,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;QAC3D,OAAO,WAAW,CAAC,QAAQ,EAAE,CAAC;IAClC,CAAC;CAmBJ;AA5FD,0CA4FC;AAiDD,IAAK,eAOJ;AAPD,WAAK,eAAe;IAChB,+DAAgB,CAAA;IAChB,iEAAiB,CAAA;IACjB;;OAEG;IACH,qFAA2B,CAAA;AAC/B,CAAC,EAPI,eAAe,KAAf,eAAe,QAOnB"}
@@ -178,6 +178,13 @@ export declare class BrightScriptDebugSession extends LoggingDebugSession {
178
178
  setBreakPointsRequest(response: DebugProtocol.SetBreakpointsResponse, args: DebugProtocol.SetBreakpointsArguments): Promise<void>;
179
179
  protected exceptionInfoRequest(response: DebugProtocol.ExceptionInfoResponse, args: DebugProtocol.ExceptionInfoArguments): void;
180
180
  protected threadsRequest(response: DebugProtocol.ThreadsResponse): Promise<void>;
181
+ /**
182
+ * Get the thread name to display in the UI based on the thread info we have.
183
+ * This is what displays in the `call stack` region in vscode
184
+ * @param thread
185
+ * @returns
186
+ */
187
+ private getThreadName;
181
188
  protected stackTraceRequest(response: DebugProtocol.StackTraceResponse, args: DebugProtocol.StackTraceArguments): Promise<void>;
182
189
  protected scopesRequest(response: DebugProtocol.ScopesResponse, args: DebugProtocol.ScopesArguments): Promise<void>;
183
190
  protected continueRequest(response: DebugProtocol.ContinueResponse, args: DebugProtocol.ContinueArguments): Promise<void>;
@@ -680,7 +680,7 @@ class BrightScriptDebugSession extends debugadapter_1.LoggingDebugSession {
680
680
  * Activate all required functionality for profiling
681
681
  */
682
682
  async initializeProfiling() {
683
- var _a, _b, _c, _d, _e;
683
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
684
684
  // Initialize PerfettoManager
685
685
  this.perfettoManager = new PerfettoManager_1.PerfettoManager({
686
686
  host: this.launchConfiguration.host,
@@ -724,6 +724,13 @@ class BrightScriptDebugSession extends debugadapter_1.LoggingDebugSession {
724
724
  else if (((_e = (_d = this.launchConfiguration.profiling) === null || _d === void 0 ? void 0 : _d.tracing) === null || _e === void 0 ? void 0 : _e.enable) === false && this.supportsPerfettoTracing) {
725
725
  this.logger.info('Disabling perfetto tracing because it is disabled in the launch configuration');
726
726
  //TODO implement a way to disable perfetto tracing on the device
727
+ //tracing was requested but the device firmware does not meet the minimum requirement
728
+ }
729
+ else if (((_g = (_f = this.launchConfiguration.profiling) === null || _f === void 0 ? void 0 : _f.tracing) === null || _g === void 0 ? void 0 : _g.enable) && !this.supportsPerfettoTracing) {
730
+ const firmwareVersion = (_j = (_h = this.deviceInfo) === null || _h === void 0 ? void 0 : _h.softwareVersion) !== null && _j !== void 0 ? _j : 'unknown';
731
+ const message = `Perfetto profiling is not available: device firmware ${firmwareVersion} is below the minimum required version (15.2). The Perfetto profiling buttons will not be available during this session.`;
732
+ this.logger.warn(message);
733
+ this.showPopupMessage(message, 'warn').catch(e => this.logger.error('Failed to show Perfetto unavailable notification', e));
727
734
  //profiling.tracing.enabled is set to `undefined`, which means we should do nothing
728
735
  }
729
736
  else {
@@ -734,7 +741,7 @@ class BrightScriptDebugSession extends debugadapter_1.LoggingDebugSession {
734
741
  * If profiling was marked "connectOnStart", try connecting right away
735
742
  */
736
743
  async tryProfilingConnectOnStart() {
737
- var _a, _b;
744
+ var _a, _b, _c, _d, _e, _f;
738
745
  if (((_b = (_a = this.launchConfiguration.profiling) === null || _a === void 0 ? void 0 : _a.tracing) === null || _b === void 0 ? void 0 : _b.connectOnStart) && this.supportsPerfettoTracing) {
739
746
  try {
740
747
  await this.perfettoManager.startTracing();
@@ -743,6 +750,12 @@ class BrightScriptDebugSession extends debugadapter_1.LoggingDebugSession {
743
750
  this.logger.error('Failed to start perfetto tracing on start', e);
744
751
  }
745
752
  }
753
+ else if (((_d = (_c = this.launchConfiguration.profiling) === null || _c === void 0 ? void 0 : _c.tracing) === null || _d === void 0 ? void 0 : _d.connectOnStart) && !this.supportsPerfettoTracing) {
754
+ const firmwareVersion = (_f = (_e = this.deviceInfo) === null || _e === void 0 ? void 0 : _e.softwareVersion) !== null && _f !== void 0 ? _f : 'unknown';
755
+ const message = `Perfetto profiling is not available: device firmware ${firmwareVersion} is below the minimum required version (15.2). Tracing will not start automatically.`;
756
+ this.logger.warn(message);
757
+ this.showPopupMessage(message, 'warn').catch(e => this.logger.error('Failed to show Perfetto unavailable notification', e));
758
+ }
746
759
  }
747
760
  /**
748
761
  * Clear certain properties that need reset whenever a debug session is restarted (via vscode or launched from the Roku home screen)
@@ -1302,9 +1315,7 @@ class BrightScriptDebugSession extends debugadapter_1.LoggingDebugSession {
1302
1315
  if (this.rokuAdapter.isAtDebuggerPrompt) {
1303
1316
  let rokuThreads = await this.rokuAdapter.getThreads();
1304
1317
  for (let thread of rokuThreads) {
1305
- const threadName = thread.isDetached
1306
- ? `Thread ${thread.threadId} [detached]`
1307
- : `Thread ${thread.threadId}`;
1318
+ const threadName = this.getThreadName(thread);
1308
1319
  threads.push(new debugadapter_1.Thread(thread.threadId, threadName));
1309
1320
  }
1310
1321
  if (threads.length === 0) {
@@ -1324,6 +1335,40 @@ class BrightScriptDebugSession extends debugadapter_1.LoggingDebugSession {
1324
1335
  };
1325
1336
  this.sendResponse(response);
1326
1337
  }
1338
+ /**
1339
+ * Get the thread name to display in the UI based on the thread info we have.
1340
+ * This is what displays in the `call stack` region in vscode
1341
+ * @param thread
1342
+ * @returns
1343
+ */
1344
+ getThreadName(thread) {
1345
+ let threadName = '';
1346
+ if (thread.type || thread.name || thread.osThreadId) {
1347
+ //build the name from only the parts that are present, so missing values don't leak into the name
1348
+ const parts = [];
1349
+ if (thread.type) {
1350
+ parts.push(`[${thread.type}]`);
1351
+ }
1352
+ if (thread.name) {
1353
+ parts.push(thread.name);
1354
+ }
1355
+ if (thread.osThreadId) {
1356
+ parts.push(thread.osThreadId);
1357
+ }
1358
+ threadName = parts.join(' ');
1359
+ }
1360
+ //remove any extraneous whitespace to deal with missing values
1361
+ threadName = threadName.replace(/\s+/g, ' ').trim();
1362
+ if (threadName === '') {
1363
+ threadName = `Thread ${thread.threadId}`;
1364
+ }
1365
+ if (thread.isDetached) {
1366
+ threadName += ' [detached]';
1367
+ }
1368
+ //remove any extraneous whitespace to deal with missing values
1369
+ threadName = threadName.replace(/\s+/g, ' ').trim();
1370
+ return threadName;
1371
+ }
1327
1372
  async stackTraceRequest(response, args) {
1328
1373
  var _a, _b;
1329
1374
  try {