@theia/memory-inspector 1.53.0-next.5 → 1.53.0-next.55

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 (40) hide show
  1. package/README.md +71 -71
  2. package/package.json +4 -4
  3. package/src/browser/diff-widget/memory-diff-options-widget.tsx +152 -152
  4. package/src/browser/diff-widget/memory-diff-select-widget.tsx +163 -163
  5. package/src/browser/diff-widget/memory-diff-table-widget.tsx +366 -366
  6. package/src/browser/diff-widget/memory-diff-widget-types.ts +45 -45
  7. package/src/browser/editable-widget/memory-editable-table-widget.tsx +359 -359
  8. package/src/browser/memory-inspector-frontend-contribution.ts +301 -301
  9. package/src/browser/memory-inspector-frontend-module.ts +118 -118
  10. package/src/browser/memory-provider/cdt-gdb-memory-provider.ts +132 -132
  11. package/src/browser/memory-provider/memory-provider-service.ts +86 -86
  12. package/src/browser/memory-provider/memory-provider.spec.ts +23 -23
  13. package/src/browser/memory-provider/memory-provider.ts +119 -119
  14. package/src/browser/memory-widget/memory-options-widget.tsx +738 -738
  15. package/src/browser/memory-widget/memory-table-widget.tsx +625 -625
  16. package/src/browser/memory-widget/memory-widget.ts +114 -114
  17. package/src/browser/register-widget/register-filter-service.ts +76 -76
  18. package/src/browser/register-widget/register-options-widget.tsx +393 -393
  19. package/src/browser/register-widget/register-table-widget.tsx +276 -276
  20. package/src/browser/register-widget/register-widget-types.ts +45 -45
  21. package/src/browser/register-widget/register-widget.css +34 -34
  22. package/src/browser/style/index.css +746 -746
  23. package/src/browser/style/memory-lock.svg +21 -21
  24. package/src/browser/style/memory-view.svg +20 -20
  25. package/src/browser/style/register-lock.svg +29 -29
  26. package/src/browser/style/register-view.svg +28 -28
  27. package/src/browser/utils/memory-commands.ts +76 -76
  28. package/src/browser/utils/memory-hover-renderer.ts +113 -113
  29. package/src/browser/utils/memory-recents.ts +58 -58
  30. package/src/browser/utils/memory-widget-components.tsx +193 -193
  31. package/src/browser/utils/memory-widget-manager.ts +179 -179
  32. package/src/browser/utils/memory-widget-utils.tsx +132 -132
  33. package/src/browser/utils/memory-widget-variable-utils.ts +170 -170
  34. package/src/browser/utils/multi-select-bar.css +61 -61
  35. package/src/browser/utils/multi-select-bar.tsx +75 -75
  36. package/src/browser/wrapper-widgets/memory-dock-panel.ts +51 -51
  37. package/src/browser/wrapper-widgets/memory-dockpanel-placeholder-widget.tsx +38 -38
  38. package/src/browser/wrapper-widgets/memory-layout-widget.tsx +167 -167
  39. package/src/common/util.ts +28 -28
  40. package/src/common/utils.spec.ts +52 -52
@@ -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-only WITH Classpath-exception-2.0
15
- ********************************************************************************/
16
-
17
- /*
18
- * Utility for storing and sorting an array of most recently visited memory locations
19
- */
20
- interface RecentsOptions {
21
- maxValues?: number;
22
- }
23
-
24
- export class Recents {
25
- protected maxValues: number;
26
- protected _values: string[] = [];
27
- get values(): string[] {
28
- return this._values;
29
- }
30
-
31
- constructor(initialValues?: string[], opts?: RecentsOptions) {
32
- this.maxValues = opts?.maxValues ?? 10;
33
- if (initialValues) {
34
- if (initialValues.length <= this.maxValues) {
35
- this._values = initialValues;
36
- return;
37
- }
38
- console.error('Initial values length is greater than allowed length, resetting to empty array');
39
- }
40
- this._values = [];
41
- }
42
-
43
- add(locationString: string): void {
44
- const indexOf = this.has(locationString);
45
- if (indexOf > -1) {
46
- this._values.splice(indexOf, 1);
47
- } else {
48
- if (this._values.length === this.maxValues) {
49
- this._values.shift();
50
- }
51
- }
52
- this._values.push(locationString);
53
- }
54
-
55
- has(locationString: string): number {
56
- return this._values.indexOf(locationString);
57
- }
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-only WITH Classpath-exception-2.0
15
+ ********************************************************************************/
16
+
17
+ /*
18
+ * Utility for storing and sorting an array of most recently visited memory locations
19
+ */
20
+ interface RecentsOptions {
21
+ maxValues?: number;
22
+ }
23
+
24
+ export class Recents {
25
+ protected maxValues: number;
26
+ protected _values: string[] = [];
27
+ get values(): string[] {
28
+ return this._values;
29
+ }
30
+
31
+ constructor(initialValues?: string[], opts?: RecentsOptions) {
32
+ this.maxValues = opts?.maxValues ?? 10;
33
+ if (initialValues) {
34
+ if (initialValues.length <= this.maxValues) {
35
+ this._values = initialValues;
36
+ return;
37
+ }
38
+ console.error('Initial values length is greater than allowed length, resetting to empty array');
39
+ }
40
+ this._values = [];
41
+ }
42
+
43
+ add(locationString: string): void {
44
+ const indexOf = this.has(locationString);
45
+ if (indexOf > -1) {
46
+ this._values.splice(indexOf, 1);
47
+ } else {
48
+ if (this._values.length === this.maxValues) {
49
+ this._values.shift();
50
+ }
51
+ }
52
+ this._values.push(locationString);
53
+ }
54
+
55
+ has(locationString: string): number {
56
+ return this._values.indexOf(locationString);
57
+ }
58
+ }
@@ -1,193 +1,193 @@
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-only WITH Classpath-exception-2.0
15
- ********************************************************************************/
16
-
17
- import { Key, KeyCode } from '@theia/core/lib/browser';
18
- import * as React from '@theia/core/shared/react';
19
- import { Interfaces } from './memory-widget-utils';
20
-
21
- export interface MWLabelProps { id: string; label: string; disabled?: boolean; classNames?: string[] }
22
-
23
- export const MWLabel: React.FC<MWLabelProps> = ({ id, label, disabled, classNames }) => {
24
- const additionalClassNames = classNames ? classNames.join(' ') : '';
25
- return <label htmlFor={id} className={`t-mv-label theia-header no-select ${additionalClassNames}${disabled ? ' disabled' : ''}`}>{label}</label>;
26
- };
27
-
28
- export interface InputProps<T extends HTMLElement = HTMLElement> {
29
- id: string;
30
- label: string;
31
- defaultValue?: string;
32
- value?: string;
33
- onChange?: React.EventHandler<React.ChangeEvent>;
34
- onKeyDown?: React.EventHandler<React.KeyboardEvent<HTMLInputElement>>;
35
- passRef?: React.ClassAttributes<T>['ref'];
36
- title?: string;
37
- disabled?: boolean;
38
- placeholder?: string;
39
- }
40
-
41
- export const MWInput: React.FC<InputProps<HTMLInputElement>> = ({ id, label, passRef, defaultValue, onChange, title, onKeyDown, disabled }) => (
42
- <>
43
- <MWLabel id={id} label={label} disabled={disabled} />
44
- <input
45
- tabIndex={0}
46
- type='text'
47
- ref={passRef}
48
- id={id}
49
- className='theia-input t-mv-input'
50
- defaultValue={defaultValue}
51
- onChange={onChange}
52
- onKeyDown={onKeyDown}
53
- title={title}
54
- spellCheck={false}
55
- disabled={disabled}
56
- />
57
- </>
58
- );
59
-
60
- export interface LabelAndSelectProps extends InputProps<HTMLSelectElement> {
61
- options: string[];
62
- }
63
-
64
- export const MWSelect: React.FC<LabelAndSelectProps> = ({ id, label, options, passRef, onChange, title, value, disabled }) => (
65
- <>
66
- <MWLabel id={id} label={label} disabled={disabled} />
67
- <select
68
- tabIndex={0}
69
- ref={passRef}
70
- id={id}
71
- className='theia-select t-mv-select'
72
- value={value}
73
- onChange={onChange}
74
- title={title}
75
- disabled={disabled}
76
- >
77
- {options.map(option => <option value={option} key={option}>{option}</option>)}
78
- </select>
79
- </>
80
- );
81
-
82
- export interface LabelAndSelectWithNameProps extends InputProps<HTMLSelectElement> {
83
- options: Array<[string, string]>;
84
- }
85
-
86
- export const MWSelectWithName: React.FC<LabelAndSelectWithNameProps> = ({ id, label, options, passRef, onChange, title, value, disabled }) => (
87
- <>
88
- <MWLabel id={id} label={label} disabled={disabled} />
89
- <select
90
- tabIndex={0}
91
- ref={passRef}
92
- id={id}
93
- className='theia-select'
94
- value={value}
95
- onChange={onChange}
96
- title={title}
97
- disabled={disabled}
98
- >
99
- {options.map(option => <option value={option[0]} key={option[0]}>{option[1]}</option>)}
100
- </select>
101
- </>
102
- );
103
-
104
- export interface InputWithSelectProps<T extends HTMLElement> extends InputProps<T> {
105
- options: string[];
106
- onSelectChange?(e: React.ChangeEvent): void;
107
- onInputChange?(e: React.ChangeEvent<HTMLInputElement>): void;
108
- }
109
- export const MWInputWithSelect: React.FC<InputWithSelectProps<HTMLInputElement>> = (
110
- { id, label, passRef, onKeyDown, title, options, onSelectChange, defaultValue, disabled, placeholder },
111
- ) => (
112
- <>
113
- <MWLabel id={id} label={label} disabled={disabled} />
114
- <div className='mw-input-select'>
115
- <input
116
- tabIndex={0}
117
- type='text'
118
- ref={passRef}
119
- id={id}
120
- className='theia-input t-mv-input'
121
- defaultValue={defaultValue}
122
- onKeyDown={onKeyDown}
123
- title={title}
124
- spellCheck={false}
125
- disabled={disabled}
126
- placeholder={placeholder}
127
- />
128
- <select
129
- className='theia-select t-mv-select'
130
- onChange={onSelectChange}
131
- disabled={disabled || (options.length === 0)}
132
- >
133
- {options.reverse().map(option => <option key={`'mw-input-select'-${id}-${option}`} value={option}>{option}</option>)}
134
- </select>
135
- </div>
136
- </>
137
- );
138
-
139
- export interface MoreMemoryProps {
140
- options: number[];
141
- direction: 'above' | 'below';
142
- handler(opts: Interfaces.MoreMemoryOptions): void;
143
- }
144
-
145
- export const MWMoreMemorySelect: React.FC<MoreMemoryProps> = ({ options, handler, direction }) => {
146
- const [numBytes, setNumBytes] = React.useState<number>(options[0]);
147
- const containerRef = React.createRef<HTMLDivElement>();
148
- const onSelectChange = (e: React.ChangeEvent<HTMLSelectElement>): void => {
149
- e.stopPropagation();
150
- const { value } = e.currentTarget;
151
- setNumBytes(parseInt(value));
152
- };
153
-
154
- const loadMoreMemory = (e: React.MouseEvent | React.KeyboardEvent): void => {
155
- containerRef.current?.blur();
156
- const doHandle = !('key' in e) || KeyCode.createKeyCode(e.nativeEvent).key?.keyCode === Key.ENTER.keyCode;
157
- if (doHandle) {
158
- handler({
159
- numBytes,
160
- direction,
161
- });
162
- }
163
- };
164
-
165
- return (
166
- <div
167
- className='mw-more-memory-select'
168
- tabIndex={0}
169
- role='button'
170
- onClick={loadMoreMemory}
171
- onKeyDown={loadMoreMemory}
172
- ref={containerRef}
173
- >
174
- <div className='mw-more-memory-select-top no-select'>
175
- Load
176
- <select
177
- className='theia-select'
178
- onChange={onSelectChange}
179
- tabIndex={0}
180
- >
181
- {options.map(option => (
182
- <option
183
- key={`mw-more-memory-select-${option}`}
184
- value={option}
185
- >
186
- {option}
187
- </option>))}
188
- </select>
189
- {`more bytes ${direction}`}
190
- </div>
191
- </div>
192
- );
193
- };
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-only WITH Classpath-exception-2.0
15
+ ********************************************************************************/
16
+
17
+ import { Key, KeyCode } from '@theia/core/lib/browser';
18
+ import * as React from '@theia/core/shared/react';
19
+ import { Interfaces } from './memory-widget-utils';
20
+
21
+ export interface MWLabelProps { id: string; label: string; disabled?: boolean; classNames?: string[] }
22
+
23
+ export const MWLabel: React.FC<MWLabelProps> = ({ id, label, disabled, classNames }) => {
24
+ const additionalClassNames = classNames ? classNames.join(' ') : '';
25
+ return <label htmlFor={id} className={`t-mv-label theia-header no-select ${additionalClassNames}${disabled ? ' disabled' : ''}`}>{label}</label>;
26
+ };
27
+
28
+ export interface InputProps<T extends HTMLElement = HTMLElement> {
29
+ id: string;
30
+ label: string;
31
+ defaultValue?: string;
32
+ value?: string;
33
+ onChange?: React.EventHandler<React.ChangeEvent>;
34
+ onKeyDown?: React.EventHandler<React.KeyboardEvent<HTMLInputElement>>;
35
+ passRef?: React.ClassAttributes<T>['ref'];
36
+ title?: string;
37
+ disabled?: boolean;
38
+ placeholder?: string;
39
+ }
40
+
41
+ export const MWInput: React.FC<InputProps<HTMLInputElement>> = ({ id, label, passRef, defaultValue, onChange, title, onKeyDown, disabled }) => (
42
+ <>
43
+ <MWLabel id={id} label={label} disabled={disabled} />
44
+ <input
45
+ tabIndex={0}
46
+ type='text'
47
+ ref={passRef}
48
+ id={id}
49
+ className='theia-input t-mv-input'
50
+ defaultValue={defaultValue}
51
+ onChange={onChange}
52
+ onKeyDown={onKeyDown}
53
+ title={title}
54
+ spellCheck={false}
55
+ disabled={disabled}
56
+ />
57
+ </>
58
+ );
59
+
60
+ export interface LabelAndSelectProps extends InputProps<HTMLSelectElement> {
61
+ options: string[];
62
+ }
63
+
64
+ export const MWSelect: React.FC<LabelAndSelectProps> = ({ id, label, options, passRef, onChange, title, value, disabled }) => (
65
+ <>
66
+ <MWLabel id={id} label={label} disabled={disabled} />
67
+ <select
68
+ tabIndex={0}
69
+ ref={passRef}
70
+ id={id}
71
+ className='theia-select t-mv-select'
72
+ value={value}
73
+ onChange={onChange}
74
+ title={title}
75
+ disabled={disabled}
76
+ >
77
+ {options.map(option => <option value={option} key={option}>{option}</option>)}
78
+ </select>
79
+ </>
80
+ );
81
+
82
+ export interface LabelAndSelectWithNameProps extends InputProps<HTMLSelectElement> {
83
+ options: Array<[string, string]>;
84
+ }
85
+
86
+ export const MWSelectWithName: React.FC<LabelAndSelectWithNameProps> = ({ id, label, options, passRef, onChange, title, value, disabled }) => (
87
+ <>
88
+ <MWLabel id={id} label={label} disabled={disabled} />
89
+ <select
90
+ tabIndex={0}
91
+ ref={passRef}
92
+ id={id}
93
+ className='theia-select'
94
+ value={value}
95
+ onChange={onChange}
96
+ title={title}
97
+ disabled={disabled}
98
+ >
99
+ {options.map(option => <option value={option[0]} key={option[0]}>{option[1]}</option>)}
100
+ </select>
101
+ </>
102
+ );
103
+
104
+ export interface InputWithSelectProps<T extends HTMLElement> extends InputProps<T> {
105
+ options: string[];
106
+ onSelectChange?(e: React.ChangeEvent): void;
107
+ onInputChange?(e: React.ChangeEvent<HTMLInputElement>): void;
108
+ }
109
+ export const MWInputWithSelect: React.FC<InputWithSelectProps<HTMLInputElement>> = (
110
+ { id, label, passRef, onKeyDown, title, options, onSelectChange, defaultValue, disabled, placeholder },
111
+ ) => (
112
+ <>
113
+ <MWLabel id={id} label={label} disabled={disabled} />
114
+ <div className='mw-input-select'>
115
+ <input
116
+ tabIndex={0}
117
+ type='text'
118
+ ref={passRef}
119
+ id={id}
120
+ className='theia-input t-mv-input'
121
+ defaultValue={defaultValue}
122
+ onKeyDown={onKeyDown}
123
+ title={title}
124
+ spellCheck={false}
125
+ disabled={disabled}
126
+ placeholder={placeholder}
127
+ />
128
+ <select
129
+ className='theia-select t-mv-select'
130
+ onChange={onSelectChange}
131
+ disabled={disabled || (options.length === 0)}
132
+ >
133
+ {options.reverse().map(option => <option key={`'mw-input-select'-${id}-${option}`} value={option}>{option}</option>)}
134
+ </select>
135
+ </div>
136
+ </>
137
+ );
138
+
139
+ export interface MoreMemoryProps {
140
+ options: number[];
141
+ direction: 'above' | 'below';
142
+ handler(opts: Interfaces.MoreMemoryOptions): void;
143
+ }
144
+
145
+ export const MWMoreMemorySelect: React.FC<MoreMemoryProps> = ({ options, handler, direction }) => {
146
+ const [numBytes, setNumBytes] = React.useState<number>(options[0]);
147
+ const containerRef = React.createRef<HTMLDivElement>();
148
+ const onSelectChange = (e: React.ChangeEvent<HTMLSelectElement>): void => {
149
+ e.stopPropagation();
150
+ const { value } = e.currentTarget;
151
+ setNumBytes(parseInt(value));
152
+ };
153
+
154
+ const loadMoreMemory = (e: React.MouseEvent | React.KeyboardEvent): void => {
155
+ containerRef.current?.blur();
156
+ const doHandle = !('key' in e) || KeyCode.createKeyCode(e.nativeEvent).key?.keyCode === Key.ENTER.keyCode;
157
+ if (doHandle) {
158
+ handler({
159
+ numBytes,
160
+ direction,
161
+ });
162
+ }
163
+ };
164
+
165
+ return (
166
+ <div
167
+ className='mw-more-memory-select'
168
+ tabIndex={0}
169
+ role='button'
170
+ onClick={loadMoreMemory}
171
+ onKeyDown={loadMoreMemory}
172
+ ref={containerRef}
173
+ >
174
+ <div className='mw-more-memory-select-top no-select'>
175
+ Load
176
+ <select
177
+ className='theia-select'
178
+ onChange={onSelectChange}
179
+ tabIndex={0}
180
+ >
181
+ {options.map(option => (
182
+ <option
183
+ key={`mw-more-memory-select-${option}`}
184
+ value={option}
185
+ >
186
+ {option}
187
+ </option>))}
188
+ </select>
189
+ {`more bytes ${direction}`}
190
+ </div>
191
+ </div>
192
+ );
193
+ };