@theia/memory-inspector 1.45.1 → 1.46.0-next.72
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/README.md +71 -71
- package/lib/browser/diff-widget/memory-diff-options-widget.d.ts +36 -36
- package/lib/browser/diff-widget/memory-diff-options-widget.js +132 -132
- package/lib/browser/diff-widget/memory-diff-select-widget.d.ts +50 -50
- package/lib/browser/diff-widget/memory-diff-select-widget.js +137 -137
- package/lib/browser/diff-widget/memory-diff-table-widget.d.ts +77 -77
- package/lib/browser/diff-widget/memory-diff-table-widget.js +314 -314
- package/lib/browser/diff-widget/memory-diff-widget-types.d.ts +41 -41
- package/lib/browser/diff-widget/memory-diff-widget-types.js +23 -23
- package/lib/browser/editable-widget/memory-editable-table-widget.d.ts +64 -64
- package/lib/browser/editable-widget/memory-editable-table-widget.js +324 -324
- package/lib/browser/memory-inspector-frontend-contribution.d.ts +46 -46
- package/lib/browser/memory-inspector-frontend-contribution.js +291 -291
- package/lib/browser/memory-inspector-frontend-module.d.ts +21 -21
- package/lib/browser/memory-inspector-frontend-module.js +87 -87
- package/lib/browser/memory-provider/cdt-gdb-memory-provider.d.ts +35 -35
- package/lib/browser/memory-provider/cdt-gdb-memory-provider.js +136 -136
- package/lib/browser/memory-provider/memory-provider-service.d.ts +36 -36
- package/lib/browser/memory-provider/memory-provider-service.js +101 -101
- package/lib/browser/memory-provider/memory-provider.d.ts +65 -65
- package/lib/browser/memory-provider/memory-provider.js +96 -96
- package/lib/browser/memory-provider/memory-provider.spec.d.ts +16 -16
- package/lib/browser/memory-provider/memory-provider.spec.js +23 -23
- package/lib/browser/memory-widget/memory-options-widget.d.ts +136 -136
- package/lib/browser/memory-widget/memory-options-widget.js +564 -564
- package/lib/browser/memory-widget/memory-table-widget.d.ts +146 -146
- package/lib/browser/memory-widget/memory-table-widget.js +487 -487
- package/lib/browser/memory-widget/memory-widget.d.ts +33 -33
- package/lib/browser/memory-widget/memory-widget.js +112 -112
- package/lib/browser/register-widget/register-filter-service.d.ts +42 -42
- package/lib/browser/register-widget/register-filter-service.js +81 -81
- package/lib/browser/register-widget/register-options-widget.d.ts +81 -81
- package/lib/browser/register-widget/register-options-widget.js +338 -338
- package/lib/browser/register-widget/register-table-widget.d.ts +77 -77
- package/lib/browser/register-widget/register-table-widget.js +230 -230
- package/lib/browser/register-widget/register-widget-types.d.ts +29 -29
- package/lib/browser/register-widget/register-widget-types.js +35 -35
- package/lib/browser/utils/memory-commands.d.ts +27 -27
- package/lib/browser/utils/memory-commands.js +67 -67
- package/lib/browser/utils/memory-hover-renderer.d.ts +33 -33
- package/lib/browser/utils/memory-hover-renderer.js +111 -111
- package/lib/browser/utils/memory-recents.d.ts +27 -27
- package/lib/browser/utils/memory-recents.js +52 -52
- package/lib/browser/utils/memory-widget-components.d.ts +58 -58
- package/lib/browser/utils/memory-widget-components.js +69 -69
- package/lib/browser/utils/memory-widget-manager.d.ts +50 -50
- package/lib/browser/utils/memory-widget-manager.js +182 -182
- package/lib/browser/utils/memory-widget-utils.d.ts +113 -113
- package/lib/browser/utils/memory-widget-utils.js +42 -42
- package/lib/browser/utils/memory-widget-variable-utils.d.ts +57 -57
- package/lib/browser/utils/memory-widget-variable-utils.js +143 -143
- package/lib/browser/utils/multi-select-bar.d.ts +31 -31
- package/lib/browser/utils/multi-select-bar.js +34 -34
- package/lib/browser/wrapper-widgets/memory-dock-panel.d.ts +24 -24
- package/lib/browser/wrapper-widgets/memory-dock-panel.js +48 -48
- package/lib/browser/wrapper-widgets/memory-dockpanel-placeholder-widget.d.ts +23 -23
- package/lib/browser/wrapper-widgets/memory-dockpanel-placeholder-widget.js +57 -57
- package/lib/browser/wrapper-widgets/memory-layout-widget.d.ts +51 -51
- package/lib/browser/wrapper-widgets/memory-layout-widget.js +191 -191
- package/lib/common/util.d.ts +21 -21
- package/lib/common/util.js +30 -30
- package/lib/common/utils.spec.d.ts +16 -16
- package/lib/common/utils.spec.js +45 -45
- package/package.json +4 -4
- package/src/browser/diff-widget/memory-diff-options-widget.tsx +152 -152
- package/src/browser/diff-widget/memory-diff-select-widget.tsx +163 -163
- package/src/browser/diff-widget/memory-diff-table-widget.tsx +366 -366
- package/src/browser/diff-widget/memory-diff-widget-types.ts +45 -45
- package/src/browser/editable-widget/memory-editable-table-widget.tsx +359 -359
- package/src/browser/memory-inspector-frontend-contribution.ts +301 -301
- package/src/browser/memory-inspector-frontend-module.ts +118 -118
- package/src/browser/memory-provider/cdt-gdb-memory-provider.ts +132 -132
- package/src/browser/memory-provider/memory-provider-service.ts +86 -86
- package/src/browser/memory-provider/memory-provider.spec.ts +23 -23
- package/src/browser/memory-provider/memory-provider.ts +119 -119
- package/src/browser/memory-widget/memory-options-widget.tsx +738 -738
- package/src/browser/memory-widget/memory-table-widget.tsx +625 -625
- package/src/browser/memory-widget/memory-widget.ts +114 -114
- package/src/browser/register-widget/register-filter-service.ts +76 -76
- package/src/browser/register-widget/register-options-widget.tsx +393 -393
- package/src/browser/register-widget/register-table-widget.tsx +276 -276
- package/src/browser/register-widget/register-widget-types.ts +45 -45
- package/src/browser/register-widget/register-widget.css +34 -34
- package/src/browser/style/index.css +746 -746
- package/src/browser/style/memory-lock.svg +21 -21
- package/src/browser/style/memory-view.svg +20 -20
- package/src/browser/style/register-lock.svg +29 -29
- package/src/browser/style/register-view.svg +28 -28
- package/src/browser/utils/memory-commands.ts +76 -76
- package/src/browser/utils/memory-hover-renderer.ts +113 -113
- package/src/browser/utils/memory-recents.ts +58 -58
- package/src/browser/utils/memory-widget-components.tsx +193 -193
- package/src/browser/utils/memory-widget-manager.ts +179 -179
- package/src/browser/utils/memory-widget-utils.tsx +132 -132
- package/src/browser/utils/memory-widget-variable-utils.ts +170 -170
- package/src/browser/utils/multi-select-bar.css +61 -61
- package/src/browser/utils/multi-select-bar.tsx +75 -75
- package/src/browser/wrapper-widgets/memory-dock-panel.ts +51 -51
- package/src/browser/wrapper-widgets/memory-dockpanel-placeholder-widget.tsx +38 -38
- package/src/browser/wrapper-widgets/memory-layout-widget.tsx +167 -167
- package/src/common/util.ts +28 -28
- package/src/common/utils.spec.ts +52 -52
|
@@ -1,152 +1,152 @@
|
|
|
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 { inject, injectable, postConstruct } from '@theia/core/shared/inversify';
|
|
19
|
-
import * as React from '@theia/core/shared/react';
|
|
20
|
-
import { ThemeType } from '@theia/core/lib/common/theme';
|
|
21
|
-
import { LENGTH_FIELD_ID, LOCATION_OFFSET_FIELD_ID, MemoryOptionsWidget } from '../memory-widget/memory-options-widget';
|
|
22
|
-
import { MWInput } from '../utils/memory-widget-components';
|
|
23
|
-
import { Interfaces, MemoryDiffWidgetData, Utils } from '../utils/memory-widget-utils';
|
|
24
|
-
import { DiffLabels } from './memory-diff-widget-types';
|
|
25
|
-
import { nls } from '@theia/core/lib/common/nls';
|
|
26
|
-
|
|
27
|
-
export interface DiffMemoryOptions extends Interfaces.MemoryOptions {
|
|
28
|
-
beforeOffset: number;
|
|
29
|
-
afterOffset: number;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
@injectable()
|
|
33
|
-
export class MemoryDiffOptionsWidget extends MemoryOptionsWidget {
|
|
34
|
-
@inject(MemoryDiffWidgetData) protected override memoryWidgetOptions: MemoryDiffWidgetData;
|
|
35
|
-
|
|
36
|
-
protected themeType: ThemeType;
|
|
37
|
-
|
|
38
|
-
override get options(): DiffMemoryOptions {
|
|
39
|
-
return this.storeState();
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
updateDiffData(newDiffData: Partial<MemoryDiffWidgetData>): void {
|
|
43
|
-
this.memoryWidgetOptions = { ...this.memoryWidgetOptions, ...newDiffData };
|
|
44
|
-
this.init();
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
@postConstruct()
|
|
48
|
-
protected override init(): void {
|
|
49
|
-
this.addClass(MemoryOptionsWidget.ID);
|
|
50
|
-
this.addClass('diff-options-widget');
|
|
51
|
-
const { identifier, beforeBytes, afterBytes } = this.memoryWidgetOptions;
|
|
52
|
-
|
|
53
|
-
this.id = `${MemoryDiffOptionsWidget.ID}-${identifier}`;
|
|
54
|
-
this.title.label = nls.localize('theia/memory-inspector/diff/label', 'Diff: {0}', identifier);
|
|
55
|
-
this.title.caption = this.title.label;
|
|
56
|
-
this.title.iconClass = this.iconClass;
|
|
57
|
-
this.title.closable = true;
|
|
58
|
-
|
|
59
|
-
this.toDispose.push(this.onOptionsChanged(() => this.update()));
|
|
60
|
-
|
|
61
|
-
beforeBytes.label = DiffLabels.Before;
|
|
62
|
-
afterBytes.label = DiffLabels.After;
|
|
63
|
-
|
|
64
|
-
this.columnsDisplayed = {
|
|
65
|
-
beforeAddress: {
|
|
66
|
-
label: nls.localizeByDefault('Address'),
|
|
67
|
-
doRender: true
|
|
68
|
-
},
|
|
69
|
-
beforeData: {
|
|
70
|
-
label: this.memoryWidgetOptions.titles[0],
|
|
71
|
-
doRender: true
|
|
72
|
-
},
|
|
73
|
-
afterAddress: {
|
|
74
|
-
label: nls.localizeByDefault('Address'),
|
|
75
|
-
doRender: true
|
|
76
|
-
},
|
|
77
|
-
afterData: {
|
|
78
|
-
label: this.memoryWidgetOptions.titles[1],
|
|
79
|
-
doRender: true
|
|
80
|
-
},
|
|
81
|
-
variables: {
|
|
82
|
-
label: nls.localizeByDefault('Variables'),
|
|
83
|
-
doRender: false
|
|
84
|
-
},
|
|
85
|
-
ascii: {
|
|
86
|
-
label: nls.localize('theia/memory-inspector/ascii', 'ASCII'),
|
|
87
|
-
doRender: false
|
|
88
|
-
},
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
this.update();
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
protected override acceptFocus(): void {
|
|
95
|
-
const settingsCog = this.node.querySelector('.toggle-settings-click-zone') as HTMLDivElement;
|
|
96
|
-
settingsCog?.focus();
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
protected override renderMemoryLocationGroup(): React.ReactNode {
|
|
100
|
-
const { titles: [beforeTitle, afterTitle] } = this.memoryWidgetOptions;
|
|
101
|
-
return (
|
|
102
|
-
<div className='t-mv-group view-group'>
|
|
103
|
-
<MWInput
|
|
104
|
-
id={LOCATION_OFFSET_FIELD_ID}
|
|
105
|
-
label={nls.localize('theia/memory-inspector/diff-widget/offset-label', '{0} Offset', beforeTitle)}
|
|
106
|
-
title={nls.localize('theia/memory-inspector/diff-widget/offset-title', 'Bytes to offset the memory from {0}', beforeTitle)}
|
|
107
|
-
defaultValue='0'
|
|
108
|
-
passRef={this.assignOffsetRef}
|
|
109
|
-
onChange={Utils.validateNumericalInputs}
|
|
110
|
-
onKeyDown={this.doRefresh}
|
|
111
|
-
/>
|
|
112
|
-
<MWInput
|
|
113
|
-
id={LENGTH_FIELD_ID}
|
|
114
|
-
label={nls.localize('theia/memory-inspector/diff-widget/offset-label', '{0} Offset', afterTitle)}
|
|
115
|
-
title={nls.localize('theia/memory-inspector/diff-widget/offset-title', 'Bytes to offset the memory from {0}', afterTitle)}
|
|
116
|
-
defaultValue='0'
|
|
117
|
-
passRef={this.assignReadLengthRef}
|
|
118
|
-
onChange={Utils.validateNumericalInputs}
|
|
119
|
-
onKeyDown={this.doRefresh}
|
|
120
|
-
/>
|
|
121
|
-
<button
|
|
122
|
-
type='button'
|
|
123
|
-
className='theia-button main view-group-go-button'
|
|
124
|
-
title={nls.localizeByDefault('Go')}
|
|
125
|
-
onClick={this.doRefresh}
|
|
126
|
-
>
|
|
127
|
-
{nls.localizeByDefault('Go')}
|
|
128
|
-
</button>
|
|
129
|
-
</div>
|
|
130
|
-
);
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
protected override getObligatoryColumnIds(): string[] {
|
|
134
|
-
return ['beforeAddress', 'beforeData', 'afterAddress', 'afterData'];
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
protected override doRefresh = (event: React.KeyboardEvent<HTMLInputElement> | React.MouseEvent<HTMLButtonElement, MouseEvent>): void => {
|
|
138
|
-
if ('key' in event && KeyCode.createKeyCode(event.nativeEvent).key?.keyCode !== Key.ENTER.keyCode) {
|
|
139
|
-
return;
|
|
140
|
-
}
|
|
141
|
-
this.fireDidChangeOptions();
|
|
142
|
-
};
|
|
143
|
-
|
|
144
|
-
override storeState(): DiffMemoryOptions {
|
|
145
|
-
return {
|
|
146
|
-
...super.storeState(),
|
|
147
|
-
// prefix a 0. It'll do nothing if it's a number, but if it's an empty string or garbage, it'll make parseInt return 0.
|
|
148
|
-
beforeOffset: parseInt(`0${this.offsetField?.value ?? 0}`),
|
|
149
|
-
afterOffset: parseInt(`0${this.readLengthField?.value ?? 0}`),
|
|
150
|
-
};
|
|
151
|
-
}
|
|
152
|
-
}
|
|
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 { inject, injectable, postConstruct } from '@theia/core/shared/inversify';
|
|
19
|
+
import * as React from '@theia/core/shared/react';
|
|
20
|
+
import { ThemeType } from '@theia/core/lib/common/theme';
|
|
21
|
+
import { LENGTH_FIELD_ID, LOCATION_OFFSET_FIELD_ID, MemoryOptionsWidget } from '../memory-widget/memory-options-widget';
|
|
22
|
+
import { MWInput } from '../utils/memory-widget-components';
|
|
23
|
+
import { Interfaces, MemoryDiffWidgetData, Utils } from '../utils/memory-widget-utils';
|
|
24
|
+
import { DiffLabels } from './memory-diff-widget-types';
|
|
25
|
+
import { nls } from '@theia/core/lib/common/nls';
|
|
26
|
+
|
|
27
|
+
export interface DiffMemoryOptions extends Interfaces.MemoryOptions {
|
|
28
|
+
beforeOffset: number;
|
|
29
|
+
afterOffset: number;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
@injectable()
|
|
33
|
+
export class MemoryDiffOptionsWidget extends MemoryOptionsWidget {
|
|
34
|
+
@inject(MemoryDiffWidgetData) protected override memoryWidgetOptions: MemoryDiffWidgetData;
|
|
35
|
+
|
|
36
|
+
protected themeType: ThemeType;
|
|
37
|
+
|
|
38
|
+
override get options(): DiffMemoryOptions {
|
|
39
|
+
return this.storeState();
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
updateDiffData(newDiffData: Partial<MemoryDiffWidgetData>): void {
|
|
43
|
+
this.memoryWidgetOptions = { ...this.memoryWidgetOptions, ...newDiffData };
|
|
44
|
+
this.init();
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
@postConstruct()
|
|
48
|
+
protected override init(): void {
|
|
49
|
+
this.addClass(MemoryOptionsWidget.ID);
|
|
50
|
+
this.addClass('diff-options-widget');
|
|
51
|
+
const { identifier, beforeBytes, afterBytes } = this.memoryWidgetOptions;
|
|
52
|
+
|
|
53
|
+
this.id = `${MemoryDiffOptionsWidget.ID}-${identifier}`;
|
|
54
|
+
this.title.label = nls.localize('theia/memory-inspector/diff/label', 'Diff: {0}', identifier);
|
|
55
|
+
this.title.caption = this.title.label;
|
|
56
|
+
this.title.iconClass = this.iconClass;
|
|
57
|
+
this.title.closable = true;
|
|
58
|
+
|
|
59
|
+
this.toDispose.push(this.onOptionsChanged(() => this.update()));
|
|
60
|
+
|
|
61
|
+
beforeBytes.label = DiffLabels.Before;
|
|
62
|
+
afterBytes.label = DiffLabels.After;
|
|
63
|
+
|
|
64
|
+
this.columnsDisplayed = {
|
|
65
|
+
beforeAddress: {
|
|
66
|
+
label: nls.localizeByDefault('Address'),
|
|
67
|
+
doRender: true
|
|
68
|
+
},
|
|
69
|
+
beforeData: {
|
|
70
|
+
label: this.memoryWidgetOptions.titles[0],
|
|
71
|
+
doRender: true
|
|
72
|
+
},
|
|
73
|
+
afterAddress: {
|
|
74
|
+
label: nls.localizeByDefault('Address'),
|
|
75
|
+
doRender: true
|
|
76
|
+
},
|
|
77
|
+
afterData: {
|
|
78
|
+
label: this.memoryWidgetOptions.titles[1],
|
|
79
|
+
doRender: true
|
|
80
|
+
},
|
|
81
|
+
variables: {
|
|
82
|
+
label: nls.localizeByDefault('Variables'),
|
|
83
|
+
doRender: false
|
|
84
|
+
},
|
|
85
|
+
ascii: {
|
|
86
|
+
label: nls.localize('theia/memory-inspector/ascii', 'ASCII'),
|
|
87
|
+
doRender: false
|
|
88
|
+
},
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
this.update();
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
protected override acceptFocus(): void {
|
|
95
|
+
const settingsCog = this.node.querySelector('.toggle-settings-click-zone') as HTMLDivElement;
|
|
96
|
+
settingsCog?.focus();
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
protected override renderMemoryLocationGroup(): React.ReactNode {
|
|
100
|
+
const { titles: [beforeTitle, afterTitle] } = this.memoryWidgetOptions;
|
|
101
|
+
return (
|
|
102
|
+
<div className='t-mv-group view-group'>
|
|
103
|
+
<MWInput
|
|
104
|
+
id={LOCATION_OFFSET_FIELD_ID}
|
|
105
|
+
label={nls.localize('theia/memory-inspector/diff-widget/offset-label', '{0} Offset', beforeTitle)}
|
|
106
|
+
title={nls.localize('theia/memory-inspector/diff-widget/offset-title', 'Bytes to offset the memory from {0}', beforeTitle)}
|
|
107
|
+
defaultValue='0'
|
|
108
|
+
passRef={this.assignOffsetRef}
|
|
109
|
+
onChange={Utils.validateNumericalInputs}
|
|
110
|
+
onKeyDown={this.doRefresh}
|
|
111
|
+
/>
|
|
112
|
+
<MWInput
|
|
113
|
+
id={LENGTH_FIELD_ID}
|
|
114
|
+
label={nls.localize('theia/memory-inspector/diff-widget/offset-label', '{0} Offset', afterTitle)}
|
|
115
|
+
title={nls.localize('theia/memory-inspector/diff-widget/offset-title', 'Bytes to offset the memory from {0}', afterTitle)}
|
|
116
|
+
defaultValue='0'
|
|
117
|
+
passRef={this.assignReadLengthRef}
|
|
118
|
+
onChange={Utils.validateNumericalInputs}
|
|
119
|
+
onKeyDown={this.doRefresh}
|
|
120
|
+
/>
|
|
121
|
+
<button
|
|
122
|
+
type='button'
|
|
123
|
+
className='theia-button main view-group-go-button'
|
|
124
|
+
title={nls.localizeByDefault('Go')}
|
|
125
|
+
onClick={this.doRefresh}
|
|
126
|
+
>
|
|
127
|
+
{nls.localizeByDefault('Go')}
|
|
128
|
+
</button>
|
|
129
|
+
</div>
|
|
130
|
+
);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
protected override getObligatoryColumnIds(): string[] {
|
|
134
|
+
return ['beforeAddress', 'beforeData', 'afterAddress', 'afterData'];
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
protected override doRefresh = (event: React.KeyboardEvent<HTMLInputElement> | React.MouseEvent<HTMLButtonElement, MouseEvent>): void => {
|
|
138
|
+
if ('key' in event && KeyCode.createKeyCode(event.nativeEvent).key?.keyCode !== Key.ENTER.keyCode) {
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
this.fireDidChangeOptions();
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
override storeState(): DiffMemoryOptions {
|
|
145
|
+
return {
|
|
146
|
+
...super.storeState(),
|
|
147
|
+
// prefix a 0. It'll do nothing if it's a number, but if it's an empty string or garbage, it'll make parseInt return 0.
|
|
148
|
+
beforeOffset: parseInt(`0${this.offsetField?.value ?? 0}`),
|
|
149
|
+
afterOffset: parseInt(`0${this.readLengthField?.value ?? 0}`),
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
}
|
|
@@ -1,163 +1,163 @@
|
|
|
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, Message, ReactWidget } from '@theia/core/lib/browser';
|
|
18
|
-
import { inject, injectable, postConstruct } from '@theia/core/shared/inversify';
|
|
19
|
-
import * as React from '@theia/core/shared/react';
|
|
20
|
-
import * as Long from 'long';
|
|
21
|
-
import { MemoryWidget } from '../memory-widget/memory-widget';
|
|
22
|
-
import { RegisterWidget } from '../register-widget/register-widget-types';
|
|
23
|
-
import { MWSelect } from '../utils/memory-widget-components';
|
|
24
|
-
import { MemoryWidgetManager } from '../utils/memory-widget-manager';
|
|
25
|
-
import { Interfaces } from '../utils/memory-widget-utils';
|
|
26
|
-
import { VariableRange } from '../utils/memory-widget-variable-utils';
|
|
27
|
-
import { MemoryDiffWidget } from './memory-diff-table-widget';
|
|
28
|
-
import { nls } from '@theia/core/lib/common/nls';
|
|
29
|
-
|
|
30
|
-
export interface DiffMemory {
|
|
31
|
-
beforeAddress: Long;
|
|
32
|
-
beforeBytes: Interfaces.LabeledUint8Array;
|
|
33
|
-
beforeVariables: VariableRange[];
|
|
34
|
-
afterAddress: Long;
|
|
35
|
-
afterBytes: Interfaces.LabeledUint8Array;
|
|
36
|
-
afterVariables: VariableRange[];
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
@injectable()
|
|
40
|
-
export class MemoryDiffSelectWidget extends ReactWidget {
|
|
41
|
-
static DIFF_SELECT_CLASS = 'memory-diff-select';
|
|
42
|
-
|
|
43
|
-
protected beforeWidgetLabel = '';
|
|
44
|
-
protected afterWidgetLabel = '';
|
|
45
|
-
|
|
46
|
-
protected labelToWidgetMap = new Map<string, MemoryWidget>();
|
|
47
|
-
|
|
48
|
-
@inject(MemoryWidgetManager) protected readonly memoryWidgetManager: MemoryWidgetManager;
|
|
49
|
-
|
|
50
|
-
@postConstruct()
|
|
51
|
-
protected init(): void {
|
|
52
|
-
this.addClass(MemoryDiffSelectWidget.DIFF_SELECT_CLASS);
|
|
53
|
-
this.id = MemoryDiffSelectWidget.DIFF_SELECT_CLASS;
|
|
54
|
-
this.updateWidgetMap();
|
|
55
|
-
this.update();
|
|
56
|
-
this.toDispose.push(this.memoryWidgetManager.onChanged(() => this.updateWidgetMap()));
|
|
57
|
-
this.scrollOptions = { ...this.scrollOptions, suppressScrollX: false };
|
|
58
|
-
this.hide();
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
override onActivateRequest(msg: Message): void {
|
|
62
|
-
super.onActivateRequest(msg);
|
|
63
|
-
this.node.querySelector('select')?.focus();
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
protected assignBaseValue = (e: React.ChangeEvent<HTMLSelectElement>): void => {
|
|
67
|
-
this.beforeWidgetLabel = e.target.value;
|
|
68
|
-
this.update();
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
protected assignLaterValue = (e: React.ChangeEvent<HTMLSelectElement>): void => {
|
|
72
|
-
this.afterWidgetLabel = e.target.value;
|
|
73
|
-
this.update();
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
render(): React.ReactNode {
|
|
77
|
-
const optionLabels = [...this.labelToWidgetMap.keys()];
|
|
78
|
-
const currentBase = this.getBeforeLabel(optionLabels);
|
|
79
|
-
const currentChanged = this.getAfterLabel(optionLabels, currentBase);
|
|
80
|
-
return optionLabels.length > 1 && (
|
|
81
|
-
<div className='memory-diff-select-wrapper'>
|
|
82
|
-
<div className='diff-select-input-wrapper'>
|
|
83
|
-
<div className='t-mv-diff-select-widget-options-wrapper'>
|
|
84
|
-
<MWSelect
|
|
85
|
-
id='diff-selector-before'
|
|
86
|
-
label='compare'
|
|
87
|
-
value={currentBase}
|
|
88
|
-
options={optionLabels}
|
|
89
|
-
onChange={this.assignBaseValue}
|
|
90
|
-
/>
|
|
91
|
-
</div>
|
|
92
|
-
<div className='t-mv-diff-select-widget-options-wrapper'>
|
|
93
|
-
<MWSelect
|
|
94
|
-
id='diff-selector-after'
|
|
95
|
-
label='with'
|
|
96
|
-
value={currentChanged}
|
|
97
|
-
options={optionLabels.filter(label => label !== currentBase)}
|
|
98
|
-
onChange={this.assignLaterValue}
|
|
99
|
-
onKeyDown={this.diffIfEnter}
|
|
100
|
-
/>
|
|
101
|
-
</div>
|
|
102
|
-
</div>
|
|
103
|
-
<button
|
|
104
|
-
type='button'
|
|
105
|
-
className='theia-button main memory-diff-select-go'
|
|
106
|
-
title={nls.localizeByDefault('Go')}
|
|
107
|
-
onClick={this.diff}
|
|
108
|
-
>
|
|
109
|
-
{nls.localizeByDefault('Go')}
|
|
110
|
-
</button>
|
|
111
|
-
</div>
|
|
112
|
-
);
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
protected diffIfEnter = (e: React.KeyboardEvent<HTMLInputElement>): void => {
|
|
116
|
-
if (KeyCode.createKeyCode(e.nativeEvent).key?.keyCode === Key.ENTER.keyCode) {
|
|
117
|
-
this.doDiff();
|
|
118
|
-
}
|
|
119
|
-
};
|
|
120
|
-
|
|
121
|
-
protected updateWidgetMap(): void {
|
|
122
|
-
const widgets = this.memoryWidgetManager.availableWidgets.filter(widget => !MemoryDiffWidget.is(widget) && !RegisterWidget.is(widget));
|
|
123
|
-
this.labelToWidgetMap = new Map<string, MemoryWidget>(widgets.map((widget): [string, MemoryWidget] => [widget.title.label, widget]));
|
|
124
|
-
this.update();
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
protected getBeforeLabel(optionLabels: string[] = [...this.labelToWidgetMap.keys()]): string {
|
|
128
|
-
return this.labelToWidgetMap.has(this.beforeWidgetLabel) && this.beforeWidgetLabel || optionLabels[0];
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
protected getAfterLabel(optionLabels: string[], beforeWidgetLabel: string = this.getBeforeLabel(optionLabels)): string {
|
|
132
|
-
return (this.afterWidgetLabel && this.afterWidgetLabel !== beforeWidgetLabel
|
|
133
|
-
? this.afterWidgetLabel
|
|
134
|
-
: optionLabels.find(label => label !== beforeWidgetLabel)) ?? '';
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
protected diff = (): void => this.doDiff();
|
|
138
|
-
|
|
139
|
-
protected doDiff(): void {
|
|
140
|
-
const labels = [...this.labelToWidgetMap.keys()];
|
|
141
|
-
const baseLabel = this.getBeforeLabel(labels);
|
|
142
|
-
const changedLabel = this.getAfterLabel(labels, baseLabel);
|
|
143
|
-
const baseWidget = this.labelToWidgetMap.get(baseLabel);
|
|
144
|
-
const changedWidget = this.labelToWidgetMap.get(changedLabel);
|
|
145
|
-
if (baseWidget && changedWidget) {
|
|
146
|
-
const memoryAndAddresses = this.getMemoryArrays(baseWidget, changedWidget);
|
|
147
|
-
this.memoryWidgetManager.doDiff({ ...memoryAndAddresses, titles: [baseLabel, changedLabel] });
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
protected getMemoryArrays(beforeWidget: MemoryWidget, afterWidget: MemoryWidget): DiffMemory {
|
|
152
|
-
const { memory: beforeMemory } = beforeWidget.optionsWidget;
|
|
153
|
-
const { memory: afterMemory } = afterWidget.optionsWidget;
|
|
154
|
-
return {
|
|
155
|
-
beforeBytes: beforeMemory.bytes,
|
|
156
|
-
afterBytes: afterMemory.bytes,
|
|
157
|
-
beforeAddress: beforeMemory.address,
|
|
158
|
-
afterAddress: afterMemory.address,
|
|
159
|
-
beforeVariables: beforeMemory.variables,
|
|
160
|
-
afterVariables: afterMemory.variables,
|
|
161
|
-
};
|
|
162
|
-
}
|
|
163
|
-
}
|
|
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, Message, ReactWidget } from '@theia/core/lib/browser';
|
|
18
|
+
import { inject, injectable, postConstruct } from '@theia/core/shared/inversify';
|
|
19
|
+
import * as React from '@theia/core/shared/react';
|
|
20
|
+
import * as Long from 'long';
|
|
21
|
+
import { MemoryWidget } from '../memory-widget/memory-widget';
|
|
22
|
+
import { RegisterWidget } from '../register-widget/register-widget-types';
|
|
23
|
+
import { MWSelect } from '../utils/memory-widget-components';
|
|
24
|
+
import { MemoryWidgetManager } from '../utils/memory-widget-manager';
|
|
25
|
+
import { Interfaces } from '../utils/memory-widget-utils';
|
|
26
|
+
import { VariableRange } from '../utils/memory-widget-variable-utils';
|
|
27
|
+
import { MemoryDiffWidget } from './memory-diff-table-widget';
|
|
28
|
+
import { nls } from '@theia/core/lib/common/nls';
|
|
29
|
+
|
|
30
|
+
export interface DiffMemory {
|
|
31
|
+
beforeAddress: Long;
|
|
32
|
+
beforeBytes: Interfaces.LabeledUint8Array;
|
|
33
|
+
beforeVariables: VariableRange[];
|
|
34
|
+
afterAddress: Long;
|
|
35
|
+
afterBytes: Interfaces.LabeledUint8Array;
|
|
36
|
+
afterVariables: VariableRange[];
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
@injectable()
|
|
40
|
+
export class MemoryDiffSelectWidget extends ReactWidget {
|
|
41
|
+
static DIFF_SELECT_CLASS = 'memory-diff-select';
|
|
42
|
+
|
|
43
|
+
protected beforeWidgetLabel = '';
|
|
44
|
+
protected afterWidgetLabel = '';
|
|
45
|
+
|
|
46
|
+
protected labelToWidgetMap = new Map<string, MemoryWidget>();
|
|
47
|
+
|
|
48
|
+
@inject(MemoryWidgetManager) protected readonly memoryWidgetManager: MemoryWidgetManager;
|
|
49
|
+
|
|
50
|
+
@postConstruct()
|
|
51
|
+
protected init(): void {
|
|
52
|
+
this.addClass(MemoryDiffSelectWidget.DIFF_SELECT_CLASS);
|
|
53
|
+
this.id = MemoryDiffSelectWidget.DIFF_SELECT_CLASS;
|
|
54
|
+
this.updateWidgetMap();
|
|
55
|
+
this.update();
|
|
56
|
+
this.toDispose.push(this.memoryWidgetManager.onChanged(() => this.updateWidgetMap()));
|
|
57
|
+
this.scrollOptions = { ...this.scrollOptions, suppressScrollX: false };
|
|
58
|
+
this.hide();
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
override onActivateRequest(msg: Message): void {
|
|
62
|
+
super.onActivateRequest(msg);
|
|
63
|
+
this.node.querySelector('select')?.focus();
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
protected assignBaseValue = (e: React.ChangeEvent<HTMLSelectElement>): void => {
|
|
67
|
+
this.beforeWidgetLabel = e.target.value;
|
|
68
|
+
this.update();
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
protected assignLaterValue = (e: React.ChangeEvent<HTMLSelectElement>): void => {
|
|
72
|
+
this.afterWidgetLabel = e.target.value;
|
|
73
|
+
this.update();
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
render(): React.ReactNode {
|
|
77
|
+
const optionLabels = [...this.labelToWidgetMap.keys()];
|
|
78
|
+
const currentBase = this.getBeforeLabel(optionLabels);
|
|
79
|
+
const currentChanged = this.getAfterLabel(optionLabels, currentBase);
|
|
80
|
+
return optionLabels.length > 1 && (
|
|
81
|
+
<div className='memory-diff-select-wrapper'>
|
|
82
|
+
<div className='diff-select-input-wrapper'>
|
|
83
|
+
<div className='t-mv-diff-select-widget-options-wrapper'>
|
|
84
|
+
<MWSelect
|
|
85
|
+
id='diff-selector-before'
|
|
86
|
+
label='compare'
|
|
87
|
+
value={currentBase}
|
|
88
|
+
options={optionLabels}
|
|
89
|
+
onChange={this.assignBaseValue}
|
|
90
|
+
/>
|
|
91
|
+
</div>
|
|
92
|
+
<div className='t-mv-diff-select-widget-options-wrapper'>
|
|
93
|
+
<MWSelect
|
|
94
|
+
id='diff-selector-after'
|
|
95
|
+
label='with'
|
|
96
|
+
value={currentChanged}
|
|
97
|
+
options={optionLabels.filter(label => label !== currentBase)}
|
|
98
|
+
onChange={this.assignLaterValue}
|
|
99
|
+
onKeyDown={this.diffIfEnter}
|
|
100
|
+
/>
|
|
101
|
+
</div>
|
|
102
|
+
</div>
|
|
103
|
+
<button
|
|
104
|
+
type='button'
|
|
105
|
+
className='theia-button main memory-diff-select-go'
|
|
106
|
+
title={nls.localizeByDefault('Go')}
|
|
107
|
+
onClick={this.diff}
|
|
108
|
+
>
|
|
109
|
+
{nls.localizeByDefault('Go')}
|
|
110
|
+
</button>
|
|
111
|
+
</div>
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
protected diffIfEnter = (e: React.KeyboardEvent<HTMLInputElement>): void => {
|
|
116
|
+
if (KeyCode.createKeyCode(e.nativeEvent).key?.keyCode === Key.ENTER.keyCode) {
|
|
117
|
+
this.doDiff();
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
protected updateWidgetMap(): void {
|
|
122
|
+
const widgets = this.memoryWidgetManager.availableWidgets.filter(widget => !MemoryDiffWidget.is(widget) && !RegisterWidget.is(widget));
|
|
123
|
+
this.labelToWidgetMap = new Map<string, MemoryWidget>(widgets.map((widget): [string, MemoryWidget] => [widget.title.label, widget]));
|
|
124
|
+
this.update();
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
protected getBeforeLabel(optionLabels: string[] = [...this.labelToWidgetMap.keys()]): string {
|
|
128
|
+
return this.labelToWidgetMap.has(this.beforeWidgetLabel) && this.beforeWidgetLabel || optionLabels[0];
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
protected getAfterLabel(optionLabels: string[], beforeWidgetLabel: string = this.getBeforeLabel(optionLabels)): string {
|
|
132
|
+
return (this.afterWidgetLabel && this.afterWidgetLabel !== beforeWidgetLabel
|
|
133
|
+
? this.afterWidgetLabel
|
|
134
|
+
: optionLabels.find(label => label !== beforeWidgetLabel)) ?? '';
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
protected diff = (): void => this.doDiff();
|
|
138
|
+
|
|
139
|
+
protected doDiff(): void {
|
|
140
|
+
const labels = [...this.labelToWidgetMap.keys()];
|
|
141
|
+
const baseLabel = this.getBeforeLabel(labels);
|
|
142
|
+
const changedLabel = this.getAfterLabel(labels, baseLabel);
|
|
143
|
+
const baseWidget = this.labelToWidgetMap.get(baseLabel);
|
|
144
|
+
const changedWidget = this.labelToWidgetMap.get(changedLabel);
|
|
145
|
+
if (baseWidget && changedWidget) {
|
|
146
|
+
const memoryAndAddresses = this.getMemoryArrays(baseWidget, changedWidget);
|
|
147
|
+
this.memoryWidgetManager.doDiff({ ...memoryAndAddresses, titles: [baseLabel, changedLabel] });
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
protected getMemoryArrays(beforeWidget: MemoryWidget, afterWidget: MemoryWidget): DiffMemory {
|
|
152
|
+
const { memory: beforeMemory } = beforeWidget.optionsWidget;
|
|
153
|
+
const { memory: afterMemory } = afterWidget.optionsWidget;
|
|
154
|
+
return {
|
|
155
|
+
beforeBytes: beforeMemory.bytes,
|
|
156
|
+
afterBytes: afterMemory.bytes,
|
|
157
|
+
beforeAddress: beforeMemory.address,
|
|
158
|
+
afterAddress: afterMemory.address,
|
|
159
|
+
beforeVariables: beforeMemory.variables,
|
|
160
|
+
afterVariables: afterMemory.variables,
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
}
|