@theia/memory-inspector 1.34.2 → 1.34.3

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 (103) hide show
  1. package/LICENSE +641 -641
  2. package/README.md +71 -71
  3. package/lib/browser/diff-widget/memory-diff-options-widget.d.ts +36 -36
  4. package/lib/browser/diff-widget/memory-diff-options-widget.js +129 -129
  5. package/lib/browser/diff-widget/memory-diff-select-widget.d.ts +50 -50
  6. package/lib/browser/diff-widget/memory-diff-select-widget.js +137 -137
  7. package/lib/browser/diff-widget/memory-diff-table-widget.d.ts +77 -77
  8. package/lib/browser/diff-widget/memory-diff-table-widget.js +314 -314
  9. package/lib/browser/diff-widget/memory-diff-widget-types.d.ts +41 -41
  10. package/lib/browser/diff-widget/memory-diff-widget-types.js +23 -23
  11. package/lib/browser/editable-widget/memory-editable-table-widget.d.ts +64 -64
  12. package/lib/browser/editable-widget/memory-editable-table-widget.js +329 -329
  13. package/lib/browser/memory-inspector-frontend-contribution.d.ts +46 -46
  14. package/lib/browser/memory-inspector-frontend-contribution.js +291 -291
  15. package/lib/browser/memory-inspector-frontend-module.d.ts +21 -21
  16. package/lib/browser/memory-inspector-frontend-module.js +87 -87
  17. package/lib/browser/memory-provider/cdt-gdb-memory-provider.d.ts +35 -35
  18. package/lib/browser/memory-provider/cdt-gdb-memory-provider.js +136 -136
  19. package/lib/browser/memory-provider/memory-provider-service.d.ts +36 -36
  20. package/lib/browser/memory-provider/memory-provider-service.js +101 -101
  21. package/lib/browser/memory-provider/memory-provider.d.ts +65 -65
  22. package/lib/browser/memory-provider/memory-provider.js +96 -96
  23. package/lib/browser/memory-provider/memory-provider.spec.d.ts +16 -16
  24. package/lib/browser/memory-provider/memory-provider.spec.js +23 -23
  25. package/lib/browser/memory-widget/memory-options-widget.d.ts +136 -136
  26. package/lib/browser/memory-widget/memory-options-widget.js +561 -561
  27. package/lib/browser/memory-widget/memory-table-widget.d.ts +145 -145
  28. package/lib/browser/memory-widget/memory-table-widget.js +484 -484
  29. package/lib/browser/memory-widget/memory-widget.d.ts +32 -32
  30. package/lib/browser/memory-widget/memory-widget.js +109 -109
  31. package/lib/browser/register-widget/register-filter-service.d.ts +42 -42
  32. package/lib/browser/register-widget/register-filter-service.js +82 -82
  33. package/lib/browser/register-widget/register-options-widget.d.ts +81 -81
  34. package/lib/browser/register-widget/register-options-widget.js +343 -343
  35. package/lib/browser/register-widget/register-table-widget.d.ts +77 -77
  36. package/lib/browser/register-widget/register-table-widget.js +236 -236
  37. package/lib/browser/register-widget/register-widget-types.d.ts +29 -29
  38. package/lib/browser/register-widget/register-widget-types.js +35 -35
  39. package/lib/browser/utils/memory-commands.d.ts +27 -27
  40. package/lib/browser/utils/memory-commands.js +67 -67
  41. package/lib/browser/utils/memory-hover-renderer.d.ts +33 -33
  42. package/lib/browser/utils/memory-hover-renderer.js +111 -111
  43. package/lib/browser/utils/memory-recents.d.ts +27 -27
  44. package/lib/browser/utils/memory-recents.js +52 -52
  45. package/lib/browser/utils/memory-widget-components.d.ts +58 -58
  46. package/lib/browser/utils/memory-widget-components.js +69 -69
  47. package/lib/browser/utils/memory-widget-manager.d.ts +50 -50
  48. package/lib/browser/utils/memory-widget-manager.js +182 -182
  49. package/lib/browser/utils/memory-widget-utils.d.ts +113 -113
  50. package/lib/browser/utils/memory-widget-utils.js +42 -42
  51. package/lib/browser/utils/memory-widget-variable-utils.d.ts +57 -57
  52. package/lib/browser/utils/memory-widget-variable-utils.js +143 -143
  53. package/lib/browser/utils/multi-select-bar.d.ts +31 -31
  54. package/lib/browser/utils/multi-select-bar.js +34 -34
  55. package/lib/browser/wrapper-widgets/memory-dock-panel.d.ts +24 -24
  56. package/lib/browser/wrapper-widgets/memory-dock-panel.js +48 -48
  57. package/lib/browser/wrapper-widgets/memory-dockpanel-placeholder-widget.d.ts +23 -23
  58. package/lib/browser/wrapper-widgets/memory-dockpanel-placeholder-widget.js +57 -57
  59. package/lib/browser/wrapper-widgets/memory-layout-widget.d.ts +50 -50
  60. package/lib/browser/wrapper-widgets/memory-layout-widget.js +188 -188
  61. package/lib/common/util.d.ts +21 -21
  62. package/lib/common/util.js +30 -30
  63. package/lib/common/utils.spec.d.ts +16 -16
  64. package/lib/common/utils.spec.js +45 -45
  65. package/package.json +4 -4
  66. package/src/browser/diff-widget/memory-diff-options-widget.tsx +152 -152
  67. package/src/browser/diff-widget/memory-diff-select-widget.tsx +163 -163
  68. package/src/browser/diff-widget/memory-diff-table-widget.tsx +366 -366
  69. package/src/browser/diff-widget/memory-diff-widget-types.ts +45 -45
  70. package/src/browser/editable-widget/memory-editable-table-widget.tsx +360 -360
  71. package/src/browser/memory-inspector-frontend-contribution.ts +301 -301
  72. package/src/browser/memory-inspector-frontend-module.ts +118 -118
  73. package/src/browser/memory-provider/cdt-gdb-memory-provider.ts +132 -132
  74. package/src/browser/memory-provider/memory-provider-service.ts +86 -86
  75. package/src/browser/memory-provider/memory-provider.spec.ts +23 -23
  76. package/src/browser/memory-provider/memory-provider.ts +119 -119
  77. package/src/browser/memory-widget/memory-options-widget.tsx +738 -738
  78. package/src/browser/memory-widget/memory-table-widget.tsx +621 -621
  79. package/src/browser/memory-widget/memory-widget.ts +110 -110
  80. package/src/browser/register-widget/register-filter-service.ts +77 -77
  81. package/src/browser/register-widget/register-options-widget.tsx +393 -393
  82. package/src/browser/register-widget/register-table-widget.tsx +277 -277
  83. package/src/browser/register-widget/register-widget-types.ts +45 -45
  84. package/src/browser/register-widget/register-widget.css +34 -34
  85. package/src/browser/style/index.css +750 -750
  86. package/src/browser/style/memory-lock.svg +21 -21
  87. package/src/browser/style/memory-view.svg +20 -20
  88. package/src/browser/style/register-lock.svg +29 -29
  89. package/src/browser/style/register-view.svg +28 -28
  90. package/src/browser/utils/memory-commands.ts +76 -76
  91. package/src/browser/utils/memory-hover-renderer.ts +113 -113
  92. package/src/browser/utils/memory-recents.ts +58 -58
  93. package/src/browser/utils/memory-widget-components.tsx +193 -193
  94. package/src/browser/utils/memory-widget-manager.ts +179 -179
  95. package/src/browser/utils/memory-widget-utils.tsx +132 -132
  96. package/src/browser/utils/memory-widget-variable-utils.ts +170 -170
  97. package/src/browser/utils/multi-select-bar.css +62 -62
  98. package/src/browser/utils/multi-select-bar.tsx +75 -75
  99. package/src/browser/wrapper-widgets/memory-dock-panel.ts +51 -51
  100. package/src/browser/wrapper-widgets/memory-dockpanel-placeholder-widget.tsx +38 -38
  101. package/src/browser/wrapper-widgets/memory-layout-widget.tsx +163 -163
  102. package/src/common/util.ts +28 -28
  103. package/src/common/utils.spec.ts +52 -52
@@ -1,43 +1,43 @@
1
- "use strict";
2
- /********************************************************************************
3
- * Copyright (C) 2021 Ericsson and others.
4
- *
5
- * This program and the accompanying materials are made available under the
6
- * terms of the Eclipse Public License v. 2.0 which is available at
7
- * http://www.eclipse.org/legal/epl-2.0.
8
- *
9
- * This Source Code may also be made available under the following Secondary
10
- * Licenses when the conditions for such availability set forth in the Eclipse
11
- * Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
- * with the GNU Classpath Exception which is available at
13
- * https://www.gnu.org/software/classpath/license.html.
14
- *
15
- * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
16
- ********************************************************************************/
17
- Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.RegisterWidgetOptions = exports.MemoryDiffWidgetData = exports.MemoryWidgetOptions = exports.Interfaces = exports.Utils = exports.Constants = void 0;
19
- var Constants;
20
- (function (Constants) {
21
- Constants.DEBOUNCE_TIME = 200;
22
- Constants.ERROR_TIMEOUT = 5000;
23
- })(Constants = exports.Constants || (exports.Constants = {}));
24
- var Utils;
25
- (function (Utils) {
26
- Utils.validateNumericalInputs = (e, allowNegative = true) => {
27
- const toReplace = allowNegative ? /[^\d-]/g : /[^\d]/g;
28
- e.target.value = e.target.value.replace(toReplace, '');
29
- };
30
- Utils.isPrintableAsAscii = (byte) => byte >= 32 && byte < (128 - 1);
31
- })(Utils = exports.Utils || (exports.Utils = {}));
32
- var Interfaces;
33
- (function (Interfaces) {
34
- let Endianness;
35
- (function (Endianness) {
36
- Endianness["Little"] = "Little Endian";
37
- Endianness["Big"] = "Big Endian";
38
- })(Endianness = Interfaces.Endianness || (Interfaces.Endianness = {}));
39
- })(Interfaces = exports.Interfaces || (exports.Interfaces = {}));
40
- exports.MemoryWidgetOptions = Symbol('MemoryWidgetOptions');
41
- exports.MemoryDiffWidgetData = Symbol('MemoryDiffWidgetData');
42
- exports.RegisterWidgetOptions = Symbol('RegisterWidgetData');
1
+ "use strict";
2
+ /********************************************************************************
3
+ * Copyright (C) 2021 Ericsson and others.
4
+ *
5
+ * This program and the accompanying materials are made available under the
6
+ * terms of the Eclipse Public License v. 2.0 which is available at
7
+ * http://www.eclipse.org/legal/epl-2.0.
8
+ *
9
+ * This Source Code may also be made available under the following Secondary
10
+ * Licenses when the conditions for such availability set forth in the Eclipse
11
+ * Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
+ * with the GNU Classpath Exception which is available at
13
+ * https://www.gnu.org/software/classpath/license.html.
14
+ *
15
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
16
+ ********************************************************************************/
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.RegisterWidgetOptions = exports.MemoryDiffWidgetData = exports.MemoryWidgetOptions = exports.Interfaces = exports.Utils = exports.Constants = void 0;
19
+ var Constants;
20
+ (function (Constants) {
21
+ Constants.DEBOUNCE_TIME = 200;
22
+ Constants.ERROR_TIMEOUT = 5000;
23
+ })(Constants = exports.Constants || (exports.Constants = {}));
24
+ var Utils;
25
+ (function (Utils) {
26
+ Utils.validateNumericalInputs = (e, allowNegative = true) => {
27
+ const toReplace = allowNegative ? /[^\d-]/g : /[^\d]/g;
28
+ e.target.value = e.target.value.replace(toReplace, '');
29
+ };
30
+ Utils.isPrintableAsAscii = (byte) => byte >= 32 && byte < (128 - 1);
31
+ })(Utils = exports.Utils || (exports.Utils = {}));
32
+ var Interfaces;
33
+ (function (Interfaces) {
34
+ let Endianness;
35
+ (function (Endianness) {
36
+ Endianness["Little"] = "Little Endian";
37
+ Endianness["Big"] = "Big Endian";
38
+ })(Endianness = Interfaces.Endianness || (Interfaces.Endianness = {}));
39
+ })(Interfaces = exports.Interfaces || (exports.Interfaces = {}));
40
+ exports.MemoryWidgetOptions = Symbol('MemoryWidgetOptions');
41
+ exports.MemoryDiffWidgetData = Symbol('MemoryDiffWidgetData');
42
+ exports.RegisterWidgetOptions = Symbol('RegisterWidgetData');
43
43
  //# sourceMappingURL=memory-widget-utils.js.map
@@ -1,58 +1,58 @@
1
- /********************************************************************************
2
- * Copyright (C) 2021 Ericsson and others.
3
- *
4
- * This program and the accompanying materials are made available under the
5
- * terms of the Eclipse Public License v. 2.0 which is available at
6
- * http://www.eclipse.org/legal/epl-2.0.
7
- *
8
- * This Source Code may also be made available under the following Secondary
9
- * Licenses when the conditions for such availability set forth in the Eclipse
10
- * Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
- * with the GNU Classpath Exception which is available at
12
- * https://www.gnu.org/software/classpath/license.html.
13
- *
14
- * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
- ********************************************************************************/
16
- import { DebugVariable } from '@theia/debug/lib/browser/console/debug-console-items';
17
- import { DebugSession } from '@theia/debug/lib/browser/debug-session';
18
- import * as Long from 'long';
19
- export interface VariableRange {
20
- name: string;
21
- address: Long;
22
- pastTheEndAddress: Long;
23
- type?: string;
24
- value?: string;
25
- }
26
- export interface VariableDecoration {
27
- name: string;
28
- color: string;
29
- firstAppearance?: boolean;
30
- }
31
- export interface RegisterReadResult {
32
- threadId: string | undefined;
33
- registers: DebugVariable[];
34
- }
35
- export declare class VariableFinder {
36
- protected readonly HIGH_CONTRAST_COLORS: string[];
37
- protected readonly NON_HC_COLORS: string[];
38
- protected readonly variables: VariableRange[];
39
- protected currentIndex: number;
40
- protected currentVariable: VariableRange | undefined;
41
- protected handledVariables: Map<string, Long.Long>;
42
- protected workingColors: string[];
43
- protected lastCall: Long.Long;
44
- constructor(variables: VariableRange[], highContrast?: boolean);
45
- /**
46
- * @param address the address of interest.
47
- *
48
- * This function should be called with a sequence of addresses in increasing order
49
- */
50
- getVariableForAddress(address: Long): VariableDecoration | undefined;
51
- protected initialize(address: Long): void;
52
- searchForVariable(addressOrName: Long | string): VariableRange | undefined;
53
- }
54
- /**
55
- * Get the Registers of the currently selected frame.
56
- */
57
- export declare function getRegisters(session: DebugSession | undefined): Promise<DebugVariable[]>;
1
+ /********************************************************************************
2
+ * Copyright (C) 2021 Ericsson and others.
3
+ *
4
+ * This program and the accompanying materials are made available under the
5
+ * terms of the Eclipse Public License v. 2.0 which is available at
6
+ * http://www.eclipse.org/legal/epl-2.0.
7
+ *
8
+ * This Source Code may also be made available under the following Secondary
9
+ * Licenses when the conditions for such availability set forth in the Eclipse
10
+ * Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ * with the GNU Classpath Exception which is available at
12
+ * https://www.gnu.org/software/classpath/license.html.
13
+ *
14
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
+ ********************************************************************************/
16
+ import { DebugVariable } from '@theia/debug/lib/browser/console/debug-console-items';
17
+ import { DebugSession } from '@theia/debug/lib/browser/debug-session';
18
+ import * as Long from 'long';
19
+ export interface VariableRange {
20
+ name: string;
21
+ address: Long;
22
+ pastTheEndAddress: Long;
23
+ type?: string;
24
+ value?: string;
25
+ }
26
+ export interface VariableDecoration {
27
+ name: string;
28
+ color: string;
29
+ firstAppearance?: boolean;
30
+ }
31
+ export interface RegisterReadResult {
32
+ threadId: string | undefined;
33
+ registers: DebugVariable[];
34
+ }
35
+ export declare class VariableFinder {
36
+ protected readonly HIGH_CONTRAST_COLORS: string[];
37
+ protected readonly NON_HC_COLORS: string[];
38
+ protected readonly variables: VariableRange[];
39
+ protected currentIndex: number;
40
+ protected currentVariable: VariableRange | undefined;
41
+ protected handledVariables: Map<string, Long.Long>;
42
+ protected workingColors: string[];
43
+ protected lastCall: Long.Long;
44
+ constructor(variables: VariableRange[], highContrast?: boolean);
45
+ /**
46
+ * @param address the address of interest.
47
+ *
48
+ * This function should be called with a sequence of addresses in increasing order
49
+ */
50
+ getVariableForAddress(address: Long): VariableDecoration | undefined;
51
+ protected initialize(address: Long): void;
52
+ searchForVariable(addressOrName: Long | string): VariableRange | undefined;
53
+ }
54
+ /**
55
+ * Get the Registers of the currently selected frame.
56
+ */
57
+ export declare function getRegisters(session: DebugSession | undefined): Promise<DebugVariable[]>;
58
58
  //# sourceMappingURL=memory-widget-variable-utils.d.ts.map
@@ -1,144 +1,144 @@
1
- "use strict";
2
- /********************************************************************************
3
- * Copyright (C) 2021 Ericsson and others.
4
- *
5
- * This program and the accompanying materials are made available under the
6
- * terms of the Eclipse Public License v. 2.0 which is available at
7
- * http://www.eclipse.org/legal/epl-2.0.
8
- *
9
- * This Source Code may also be made available under the following Secondary
10
- * Licenses when the conditions for such availability set forth in the Eclipse
11
- * Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
- * with the GNU Classpath Exception which is available at
13
- * https://www.gnu.org/software/classpath/license.html.
14
- *
15
- * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
16
- ********************************************************************************/
17
- Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.getRegisters = exports.VariableFinder = void 0;
19
- const debug_console_items_1 = require("@theia/debug/lib/browser/console/debug-console-items");
20
- const Long = require("long");
21
- class VariableFinder {
22
- constructor(variables, highContrast = false) {
23
- this.HIGH_CONTRAST_COLORS = [
24
- 'var(--theia-contrastActiveBorder)',
25
- 'var(--theia-contrastBorder)',
26
- ];
27
- this.NON_HC_COLORS = [
28
- 'var(--theia-terminal-ansiBlue)',
29
- 'var(--theia-terminal-ansiGreen)',
30
- 'var(--theia-terminal-ansiRed)',
31
- 'var(--theia-terminal-ansiYellow)',
32
- 'var(--theia-terminal-ansiMagenta)',
33
- ];
34
- this.currentIndex = -1;
35
- this.currentVariable = undefined;
36
- this.handledVariables = new Map();
37
- this.lastCall = Long.MAX_UNSIGNED_VALUE;
38
- this.variables = variables.sort((a, b) => a.address.lessThan(b.address) ? -1 : 1);
39
- this.workingColors = highContrast ? this.HIGH_CONTRAST_COLORS : this.NON_HC_COLORS;
40
- }
41
- /**
42
- * @param address the address of interest.
43
- *
44
- * This function should be called with a sequence of addresses in increasing order
45
- */
46
- getVariableForAddress(address) {
47
- if (address.lessThan(this.lastCall)) {
48
- this.initialize(address);
49
- }
50
- this.lastCall = address;
51
- if (this.currentVariable && address.greaterThanOrEqual(this.currentVariable.pastTheEndAddress)) {
52
- this.currentIndex += 1;
53
- this.currentVariable = this.variables[this.currentIndex];
54
- }
55
- if (!this.currentVariable) {
56
- return undefined;
57
- }
58
- const { name } = this.currentVariable;
59
- // const color = `hsl(${HSL_BASIS * this.currentIndex / this.variables.length}, 60%, 60%)`;
60
- const color = this.workingColors[this.currentIndex % this.workingColors.length];
61
- const decoration = {
62
- name,
63
- color,
64
- firstAppearance: this.handledVariables.get(name) === address || !this.handledVariables.has(name),
65
- };
66
- if (address.greaterThanOrEqual(this.currentVariable.address) && address.lessThan(this.currentVariable.pastTheEndAddress)) {
67
- this.handledVariables.set(name, address);
68
- return decoration;
69
- }
70
- return undefined;
71
- }
72
- initialize(address) {
73
- this.handledVariables.clear();
74
- const firstCandidateIndex = this.variables.findIndex(variable => address.lessThan(variable.pastTheEndAddress));
75
- if (firstCandidateIndex === -1) {
76
- this.currentIndex = this.variables.length;
77
- }
78
- else {
79
- this.currentVariable = this.variables[firstCandidateIndex];
80
- this.currentIndex = firstCandidateIndex;
81
- }
82
- }
83
- searchForVariable(addressOrName) {
84
- if (typeof addressOrName === 'string') {
85
- return this.variables.find(variable => variable.name === addressOrName);
86
- }
87
- let upperLimit = this.variables.length - 1;
88
- let lowerLimit = 0;
89
- while (upperLimit >= lowerLimit) {
90
- const target = Math.floor((lowerLimit + upperLimit) / 2);
91
- const candidate = this.variables[target];
92
- if (addressOrName >= candidate.address && addressOrName < candidate.pastTheEndAddress) {
93
- return candidate;
94
- }
95
- if (addressOrName < candidate.address) {
96
- upperLimit = target - 1;
97
- }
98
- if (addressOrName >= candidate.pastTheEndAddress) {
99
- lowerLimit = target + 1;
100
- }
101
- }
102
- return undefined;
103
- }
104
- }
105
- exports.VariableFinder = VariableFinder;
106
- /**
107
- * Get the Registers of the currently selected frame.
108
- */
109
- async function getRegisters(session) {
110
- if (session === undefined) {
111
- console.warn('No active debug session.');
112
- return [];
113
- }
114
- const frame = session.currentFrame;
115
- if (frame === undefined) {
116
- throw new Error('No active stack frame.');
117
- }
118
- const registers = [];
119
- const scopes = await frame.getScopes();
120
- const regScope = scopes.find(x => x.render() === 'Registers');
121
- if (regScope !== undefined) {
122
- const handleRegisterScope = async (scope) => {
123
- const variables = await scope.getElements();
124
- for (const v of variables) {
125
- if (v instanceof debug_console_items_1.DebugVariable) {
126
- try {
127
- BigInt(v.value); // Make sure the value looks like a numerical value
128
- registers.push(v);
129
- }
130
- catch (_a) {
131
- handleRegisterScope(v);
132
- }
133
- }
134
- }
135
- };
136
- handleRegisterScope(regScope);
137
- }
138
- else {
139
- throw new Error('No Register scope in active stack frame.');
140
- }
141
- return registers;
142
- }
143
- exports.getRegisters = getRegisters;
1
+ "use strict";
2
+ /********************************************************************************
3
+ * Copyright (C) 2021 Ericsson and others.
4
+ *
5
+ * This program and the accompanying materials are made available under the
6
+ * terms of the Eclipse Public License v. 2.0 which is available at
7
+ * http://www.eclipse.org/legal/epl-2.0.
8
+ *
9
+ * This Source Code may also be made available under the following Secondary
10
+ * Licenses when the conditions for such availability set forth in the Eclipse
11
+ * Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
+ * with the GNU Classpath Exception which is available at
13
+ * https://www.gnu.org/software/classpath/license.html.
14
+ *
15
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
16
+ ********************************************************************************/
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.getRegisters = exports.VariableFinder = void 0;
19
+ const debug_console_items_1 = require("@theia/debug/lib/browser/console/debug-console-items");
20
+ const Long = require("long");
21
+ class VariableFinder {
22
+ constructor(variables, highContrast = false) {
23
+ this.HIGH_CONTRAST_COLORS = [
24
+ 'var(--theia-contrastActiveBorder)',
25
+ 'var(--theia-contrastBorder)',
26
+ ];
27
+ this.NON_HC_COLORS = [
28
+ 'var(--theia-terminal-ansiBlue)',
29
+ 'var(--theia-terminal-ansiGreen)',
30
+ 'var(--theia-terminal-ansiRed)',
31
+ 'var(--theia-terminal-ansiYellow)',
32
+ 'var(--theia-terminal-ansiMagenta)',
33
+ ];
34
+ this.currentIndex = -1;
35
+ this.currentVariable = undefined;
36
+ this.handledVariables = new Map();
37
+ this.lastCall = Long.MAX_UNSIGNED_VALUE;
38
+ this.variables = variables.sort((a, b) => a.address.lessThan(b.address) ? -1 : 1);
39
+ this.workingColors = highContrast ? this.HIGH_CONTRAST_COLORS : this.NON_HC_COLORS;
40
+ }
41
+ /**
42
+ * @param address the address of interest.
43
+ *
44
+ * This function should be called with a sequence of addresses in increasing order
45
+ */
46
+ getVariableForAddress(address) {
47
+ if (address.lessThan(this.lastCall)) {
48
+ this.initialize(address);
49
+ }
50
+ this.lastCall = address;
51
+ if (this.currentVariable && address.greaterThanOrEqual(this.currentVariable.pastTheEndAddress)) {
52
+ this.currentIndex += 1;
53
+ this.currentVariable = this.variables[this.currentIndex];
54
+ }
55
+ if (!this.currentVariable) {
56
+ return undefined;
57
+ }
58
+ const { name } = this.currentVariable;
59
+ // const color = `hsl(${HSL_BASIS * this.currentIndex / this.variables.length}, 60%, 60%)`;
60
+ const color = this.workingColors[this.currentIndex % this.workingColors.length];
61
+ const decoration = {
62
+ name,
63
+ color,
64
+ firstAppearance: this.handledVariables.get(name) === address || !this.handledVariables.has(name),
65
+ };
66
+ if (address.greaterThanOrEqual(this.currentVariable.address) && address.lessThan(this.currentVariable.pastTheEndAddress)) {
67
+ this.handledVariables.set(name, address);
68
+ return decoration;
69
+ }
70
+ return undefined;
71
+ }
72
+ initialize(address) {
73
+ this.handledVariables.clear();
74
+ const firstCandidateIndex = this.variables.findIndex(variable => address.lessThan(variable.pastTheEndAddress));
75
+ if (firstCandidateIndex === -1) {
76
+ this.currentIndex = this.variables.length;
77
+ }
78
+ else {
79
+ this.currentVariable = this.variables[firstCandidateIndex];
80
+ this.currentIndex = firstCandidateIndex;
81
+ }
82
+ }
83
+ searchForVariable(addressOrName) {
84
+ if (typeof addressOrName === 'string') {
85
+ return this.variables.find(variable => variable.name === addressOrName);
86
+ }
87
+ let upperLimit = this.variables.length - 1;
88
+ let lowerLimit = 0;
89
+ while (upperLimit >= lowerLimit) {
90
+ const target = Math.floor((lowerLimit + upperLimit) / 2);
91
+ const candidate = this.variables[target];
92
+ if (addressOrName >= candidate.address && addressOrName < candidate.pastTheEndAddress) {
93
+ return candidate;
94
+ }
95
+ if (addressOrName < candidate.address) {
96
+ upperLimit = target - 1;
97
+ }
98
+ if (addressOrName >= candidate.pastTheEndAddress) {
99
+ lowerLimit = target + 1;
100
+ }
101
+ }
102
+ return undefined;
103
+ }
104
+ }
105
+ exports.VariableFinder = VariableFinder;
106
+ /**
107
+ * Get the Registers of the currently selected frame.
108
+ */
109
+ async function getRegisters(session) {
110
+ if (session === undefined) {
111
+ console.warn('No active debug session.');
112
+ return [];
113
+ }
114
+ const frame = session.currentFrame;
115
+ if (frame === undefined) {
116
+ throw new Error('No active stack frame.');
117
+ }
118
+ const registers = [];
119
+ const scopes = await frame.getScopes();
120
+ const regScope = scopes.find(x => x.render() === 'Registers');
121
+ if (regScope !== undefined) {
122
+ const handleRegisterScope = async (scope) => {
123
+ const variables = await scope.getElements();
124
+ for (const v of variables) {
125
+ if (v instanceof debug_console_items_1.DebugVariable) {
126
+ try {
127
+ BigInt(v.value); // Make sure the value looks like a numerical value
128
+ registers.push(v);
129
+ }
130
+ catch (_a) {
131
+ handleRegisterScope(v);
132
+ }
133
+ }
134
+ }
135
+ };
136
+ handleRegisterScope(regScope);
137
+ }
138
+ else {
139
+ throw new Error('No Register scope in active stack frame.');
140
+ }
141
+ return registers;
142
+ }
143
+ exports.getRegisters = getRegisters;
144
144
  //# sourceMappingURL=memory-widget-variable-utils.js.map
@@ -1,32 +1,32 @@
1
- /********************************************************************************
2
- * Copyright (C) 2021 Ericsson and others.
3
- *
4
- * This program and the accompanying materials are made available under the
5
- * terms of the Eclipse Public License v. 2.0 which is available at
6
- * http://www.eclipse.org/legal/epl-2.0.
7
- *
8
- * This Source Code may also be made available under the following Secondary
9
- * Licenses when the conditions for such availability set forth in the Eclipse
10
- * Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
- * with the GNU Classpath Exception which is available at
12
- * https://www.gnu.org/software/classpath/license.html.
13
- *
14
- * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
- ********************************************************************************/
16
- /// <reference types="react" />
17
- import * as React from '@theia/core/shared/react';
18
- import { MWLabelProps } from './memory-widget-components';
19
- export interface SingleSelectItemProps {
20
- id: string;
21
- label: string;
22
- defaultChecked?: boolean;
23
- }
24
- interface MultiSelectBarProps {
25
- items: SingleSelectItemProps[];
26
- id?: string;
27
- onSelectionChanged: (labelSelected: string, newSelectionState: boolean) => unknown;
28
- }
29
- export declare const MultiSelectBar: React.FC<MultiSelectBarProps>;
30
- export declare const MWMultiSelect: React.FC<MWLabelProps & MultiSelectBarProps>;
31
- export {};
1
+ /********************************************************************************
2
+ * Copyright (C) 2021 Ericsson and others.
3
+ *
4
+ * This program and the accompanying materials are made available under the
5
+ * terms of the Eclipse Public License v. 2.0 which is available at
6
+ * http://www.eclipse.org/legal/epl-2.0.
7
+ *
8
+ * This Source Code may also be made available under the following Secondary
9
+ * Licenses when the conditions for such availability set forth in the Eclipse
10
+ * Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ * with the GNU Classpath Exception which is available at
12
+ * https://www.gnu.org/software/classpath/license.html.
13
+ *
14
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
+ ********************************************************************************/
16
+ /// <reference types="react" />
17
+ import * as React from '@theia/core/shared/react';
18
+ import { MWLabelProps } from './memory-widget-components';
19
+ export interface SingleSelectItemProps {
20
+ id: string;
21
+ label: string;
22
+ defaultChecked?: boolean;
23
+ }
24
+ interface MultiSelectBarProps {
25
+ items: SingleSelectItemProps[];
26
+ id?: string;
27
+ onSelectionChanged: (labelSelected: string, newSelectionState: boolean) => unknown;
28
+ }
29
+ export declare const MultiSelectBar: React.FC<MultiSelectBarProps>;
30
+ export declare const MWMultiSelect: React.FC<MWLabelProps & MultiSelectBarProps>;
31
+ export {};
32
32
  //# sourceMappingURL=multi-select-bar.d.ts.map
@@ -1,35 +1,35 @@
1
- "use strict";
2
- /********************************************************************************
3
- * Copyright (C) 2021 Ericsson and others.
4
- *
5
- * This program and the accompanying materials are made available under the
6
- * terms of the Eclipse Public License v. 2.0 which is available at
7
- * http://www.eclipse.org/legal/epl-2.0.
8
- *
9
- * This Source Code may also be made available under the following Secondary
10
- * Licenses when the conditions for such availability set forth in the Eclipse
11
- * Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
- * with the GNU Classpath Exception which is available at
13
- * https://www.gnu.org/software/classpath/license.html.
14
- *
15
- * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
16
- ********************************************************************************/
17
- Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.MWMultiSelect = exports.MultiSelectBar = void 0;
19
- const React = require("@theia/core/shared/react");
20
- const memory_widget_components_1 = require("./memory-widget-components");
21
- const MultiSelectBar = ({ items, onSelectionChanged, id }) => {
22
- const changeHandler = React.useCallback(e => {
23
- onSelectionChanged(e.target.id, e.target.checked);
24
- }, [onSelectionChanged]);
25
- return (React.createElement("div", { className: 'multi-select-bar', id: id }, items.map(({ label, id: itemId, defaultChecked }) => (React.createElement(LabeledCheckbox, { label: label, onChange: changeHandler, defaultChecked: !!defaultChecked, id: itemId, key: `${label}-${id}-checkbox` })))));
26
- };
27
- exports.MultiSelectBar = MultiSelectBar;
28
- const LabeledCheckbox = ({ defaultChecked, label, onChange, id }) => (React.createElement("div", { className: 'multi-select-checkbox-wrapper' },
29
- React.createElement("input", { tabIndex: 0, type: 'checkbox', id: id, className: 'multi-select-checkbox', defaultChecked: defaultChecked, onChange: onChange }),
30
- React.createElement(memory_widget_components_1.MWLabel, { id: id, label: label, classNames: ['multi-select-label'] })));
31
- const MWMultiSelect = ({ id, label, disabled, items, onSelectionChanged }) => (React.createElement(React.Fragment, null,
32
- React.createElement(memory_widget_components_1.MWLabel, { id: id, label: label, disabled: disabled }),
33
- React.createElement(exports.MultiSelectBar, { id: id, items: items, onSelectionChanged: onSelectionChanged })));
34
- exports.MWMultiSelect = MWMultiSelect;
1
+ "use strict";
2
+ /********************************************************************************
3
+ * Copyright (C) 2021 Ericsson and others.
4
+ *
5
+ * This program and the accompanying materials are made available under the
6
+ * terms of the Eclipse Public License v. 2.0 which is available at
7
+ * http://www.eclipse.org/legal/epl-2.0.
8
+ *
9
+ * This Source Code may also be made available under the following Secondary
10
+ * Licenses when the conditions for such availability set forth in the Eclipse
11
+ * Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
+ * with the GNU Classpath Exception which is available at
13
+ * https://www.gnu.org/software/classpath/license.html.
14
+ *
15
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
16
+ ********************************************************************************/
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.MWMultiSelect = exports.MultiSelectBar = void 0;
19
+ const React = require("@theia/core/shared/react");
20
+ const memory_widget_components_1 = require("./memory-widget-components");
21
+ const MultiSelectBar = ({ items, onSelectionChanged, id }) => {
22
+ const changeHandler = React.useCallback(e => {
23
+ onSelectionChanged(e.target.id, e.target.checked);
24
+ }, [onSelectionChanged]);
25
+ return (React.createElement("div", { className: 'multi-select-bar', id: id }, items.map(({ label, id: itemId, defaultChecked }) => (React.createElement(LabeledCheckbox, { label: label, onChange: changeHandler, defaultChecked: !!defaultChecked, id: itemId, key: `${label}-${id}-checkbox` })))));
26
+ };
27
+ exports.MultiSelectBar = MultiSelectBar;
28
+ const LabeledCheckbox = ({ defaultChecked, label, onChange, id }) => (React.createElement("div", { className: 'multi-select-checkbox-wrapper' },
29
+ React.createElement("input", { tabIndex: 0, type: 'checkbox', id: id, className: 'multi-select-checkbox', defaultChecked: defaultChecked, onChange: onChange }),
30
+ React.createElement(memory_widget_components_1.MWLabel, { id: id, label: label, classNames: ['multi-select-label'] })));
31
+ const MWMultiSelect = ({ id, label, disabled, items, onSelectionChanged }) => (React.createElement(React.Fragment, null,
32
+ React.createElement(memory_widget_components_1.MWLabel, { id: id, label: label, disabled: disabled }),
33
+ React.createElement(exports.MultiSelectBar, { id: id, items: items, onSelectionChanged: onSelectionChanged })));
34
+ exports.MWMultiSelect = MWMultiSelect;
35
35
  //# sourceMappingURL=multi-select-bar.js.map