@theia/debug 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.
- package/README.md +62 -62
- package/lib/browser/debug-configuration-manager.js +6 -6
- package/lib/browser/debug-frontend-application-contribution.d.ts.map +1 -1
- package/lib/browser/debug-frontend-application-contribution.js.map +1 -1
- package/lib/common/inline-debug-adapter.d.ts +1 -0
- package/lib/common/inline-debug-adapter.d.ts.map +1 -1
- package/package.json +16 -16
- package/src/browser/breakpoint/breakpoint-manager.ts +369 -369
- package/src/browser/breakpoint/breakpoint-marker.ts +104 -104
- package/src/browser/console/debug-console-contribution.tsx +240 -240
- package/src/browser/console/debug-console-items.tsx +384 -384
- package/src/browser/console/debug-console-session.ts +205 -205
- package/src/browser/debug-call-stack-item-type-key.ts +20 -20
- package/src/browser/debug-configuration-manager.ts +591 -591
- package/src/browser/debug-configuration-model.ts +100 -100
- package/src/browser/debug-contribution.ts +43 -43
- package/src/browser/debug-frontend-application-contribution.ts +1551 -1551
- package/src/browser/debug-frontend-module.ts +133 -133
- package/src/browser/debug-package.spec.ts +20 -20
- package/src/browser/debug-preferences.ts +98 -98
- package/src/browser/debug-prefix-configuration.ts +195 -195
- package/src/browser/debug-resource.ts +59 -59
- package/src/browser/debug-schema-updater.ts +149 -149
- package/src/browser/debug-session-connection.ts +357 -357
- package/src/browser/debug-session-contribution.ts +157 -157
- package/src/browser/debug-session-manager.ts +683 -683
- package/src/browser/debug-session-options.ts +120 -120
- package/src/browser/debug-session.tsx +974 -974
- package/src/browser/debug-tab-bar-decorator.ts +57 -57
- package/src/browser/debug-watch-manager.ts +93 -93
- package/src/browser/disassembly-view/disassembly-view-accessibility-provider.ts +43 -43
- package/src/browser/disassembly-view/disassembly-view-breakpoint-renderer.ts +119 -119
- package/src/browser/disassembly-view/disassembly-view-contribution.ts +109 -109
- package/src/browser/disassembly-view/disassembly-view-instruction-renderer.ts +245 -245
- package/src/browser/disassembly-view/disassembly-view-table-delegate.ts +39 -39
- package/src/browser/disassembly-view/disassembly-view-utilities.ts +55 -55
- package/src/browser/disassembly-view/disassembly-view-widget.ts +463 -463
- package/src/browser/editor/debug-breakpoint-widget.tsx +293 -293
- package/src/browser/editor/debug-editor-model.ts +529 -529
- package/src/browser/editor/debug-editor-service.ts +192 -192
- package/src/browser/editor/debug-editor.ts +20 -20
- package/src/browser/editor/debug-exception-widget.tsx +122 -122
- package/src/browser/editor/debug-expression-provider.ts +78 -78
- package/src/browser/editor/debug-hover-source.tsx +105 -105
- package/src/browser/editor/debug-hover-widget.ts +298 -298
- package/src/browser/editor/debug-inline-value-decorator.ts +373 -373
- package/src/browser/model/debug-breakpoint.tsx +151 -151
- package/src/browser/model/debug-function-breakpoint.tsx +101 -101
- package/src/browser/model/debug-instruction-breakpoint.tsx +68 -68
- package/src/browser/model/debug-source-breakpoint.tsx +237 -237
- package/src/browser/model/debug-source.ts +93 -93
- package/src/browser/model/debug-stack-frame.tsx +177 -177
- package/src/browser/model/debug-thread.tsx +292 -292
- package/src/browser/preferences/launch-preferences.ts +38 -38
- package/src/browser/style/index.css +453 -453
- package/src/browser/view/debug-action.tsx +57 -57
- package/src/browser/view/debug-breakpoints-source.tsx +53 -53
- package/src/browser/view/debug-breakpoints-widget.ts +71 -71
- package/src/browser/view/debug-configuration-select.tsx +269 -269
- package/src/browser/view/debug-configuration-widget.tsx +121 -121
- package/src/browser/view/debug-exception-breakpoint.tsx +68 -68
- package/src/browser/view/debug-session-widget.ts +124 -124
- package/src/browser/view/debug-stack-frames-source.tsx +75 -75
- package/src/browser/view/debug-stack-frames-widget.ts +135 -135
- package/src/browser/view/debug-threads-source.tsx +48 -48
- package/src/browser/view/debug-threads-widget.ts +126 -126
- package/src/browser/view/debug-toolbar-widget.tsx +145 -145
- package/src/browser/view/debug-variables-source.ts +43 -43
- package/src/browser/view/debug-variables-widget.ts +61 -61
- package/src/browser/view/debug-view-model.ts +230 -230
- package/src/browser/view/debug-watch-expression.tsx +88 -88
- package/src/browser/view/debug-watch-source.ts +41 -41
- package/src/browser/view/debug-watch-widget.ts +61 -61
- package/src/browser/view/debug-widget.ts +97 -97
- package/src/common/debug-adapter-contribution-registry.ts +206 -206
- package/src/common/debug-adapter-session.ts +102 -102
- package/src/common/debug-common.ts +19 -19
- package/src/common/debug-compound.ts +33 -33
- package/src/common/debug-configuration.ts +112 -112
- package/src/common/debug-model.ts +200 -200
- package/src/common/debug-service.ts +184 -184
- package/src/common/debug-uri-utils.ts +24 -24
- package/src/common/inline-debug-adapter.ts +47 -47
- package/src/node/debug-adapter-factory.ts +107 -107
- package/src/node/debug-adapter-session-manager.ts +106 -106
- package/src/node/debug-backend-module.ts +57 -57
- package/src/node/debug-service-impl.ts +119 -119
- package/src/node/stream-debug-adapter.ts +126 -126
|
@@ -1,184 +1,184 @@
|
|
|
1
|
-
// *****************************************************************************
|
|
2
|
-
// Copyright (C) 2018 Red Hat, Inc. 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 { Channel, Disposable, Emitter, Event } from '@theia/core';
|
|
18
|
-
import { ApplicationError } from '@theia/core/lib/common/application-error';
|
|
19
|
-
import { IJSONSchema, IJSONSchemaSnippet } from '@theia/core/lib/common/json-schema';
|
|
20
|
-
import { CommandIdVariables } from '@theia/variable-resolver/lib/common/variable-types';
|
|
21
|
-
import { DebugConfiguration } from './debug-configuration';
|
|
22
|
-
|
|
23
|
-
export interface DebuggerDescription {
|
|
24
|
-
type: string
|
|
25
|
-
label: string
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* The WS endpoint path to the Debug service.
|
|
30
|
-
*/
|
|
31
|
-
export const DebugPath = '/services/debug';
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* DebugService symbol for DI.
|
|
35
|
-
*/
|
|
36
|
-
export const DebugService = Symbol('DebugService');
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* This service provides functionality to configure and to start a new debug adapter session.
|
|
40
|
-
* The workflow is the following. If user wants to debug an application and
|
|
41
|
-
* there is no debug configuration associated with the application then
|
|
42
|
-
* the list of available providers is requested to create suitable debug configuration.
|
|
43
|
-
* When configuration is chosen it is possible to alter the configuration
|
|
44
|
-
* by filling in missing values or by adding/changing/removing attributes. For this purpose the
|
|
45
|
-
* #resolveDebugConfiguration method is invoked. After that the debug adapter session will be started.
|
|
46
|
-
*/
|
|
47
|
-
export interface DebugService extends Disposable {
|
|
48
|
-
onDidChangeDebuggers?: Event<void>;
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Finds and returns an array of registered debug types.
|
|
52
|
-
* @returns An array of registered debug types
|
|
53
|
-
*/
|
|
54
|
-
debugTypes(): Promise<string[]>;
|
|
55
|
-
|
|
56
|
-
getDebuggersForLanguage(language: string): Promise<DebuggerDescription[]>;
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* Provide debugger contributed variables
|
|
60
|
-
* see "variables" at https://code.visualstudio.com/api/references/contribution-points#contributes.debuggers
|
|
61
|
-
*/
|
|
62
|
-
provideDebuggerVariables(debugType: string): Promise<CommandIdVariables>;
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* Provides the schema attributes.
|
|
66
|
-
* @param debugType The registered debug type
|
|
67
|
-
* @returns An JSON Schema describing the configuration attributes for the given debug type
|
|
68
|
-
*/
|
|
69
|
-
getSchemaAttributes(debugType: string): Promise<IJSONSchema[]>;
|
|
70
|
-
|
|
71
|
-
getConfigurationSnippets(): Promise<IJSONSchemaSnippet[]>;
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* Provides initial [debug configuration](#DebugConfiguration).
|
|
75
|
-
* @param debugType The registered debug type
|
|
76
|
-
* @returns An array of [debug configurations](#DebugConfiguration)
|
|
77
|
-
*/
|
|
78
|
-
provideDebugConfigurations(debugType: string, workspaceFolderUri: string | undefined): Promise<DebugConfiguration[]>;
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* @returns A Record of debug configuration provider types and a corresponding dynamic debug configurations array
|
|
82
|
-
*/
|
|
83
|
-
provideDynamicDebugConfigurations?(folder?: string): Promise<Record<string, DebugConfiguration[]>>;
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* Provides a dynamic debug configuration matching the name and the provider debug type
|
|
87
|
-
*/
|
|
88
|
-
fetchDynamicDebugConfiguration(name: string, type: string, folder?: string): Promise<DebugConfiguration | undefined>;
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* Resolves a [debug configuration](#DebugConfiguration) by filling in missing values
|
|
92
|
-
* or by adding/changing/removing attributes before variable substitution.
|
|
93
|
-
* @param debugConfiguration The [debug configuration](#DebugConfiguration) to resolve.
|
|
94
|
-
* @returns The resolved debug configuration, undefined or null.
|
|
95
|
-
*/
|
|
96
|
-
resolveDebugConfiguration(
|
|
97
|
-
config: DebugConfiguration,
|
|
98
|
-
workspaceFolderUri: string | undefined
|
|
99
|
-
): Promise<DebugConfiguration | undefined | null>;
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* Resolves a [debug configuration](#DebugConfiguration) by filling in missing values
|
|
103
|
-
* or by adding/changing/removing attributes with substituted variables.
|
|
104
|
-
* @param debugConfiguration The [debug configuration](#DebugConfiguration) to resolve.
|
|
105
|
-
* @returns The resolved debug configuration, undefined or null.
|
|
106
|
-
*/
|
|
107
|
-
resolveDebugConfigurationWithSubstitutedVariables(
|
|
108
|
-
config: DebugConfiguration,
|
|
109
|
-
workspaceFolderUri: string | undefined
|
|
110
|
-
): Promise<DebugConfiguration | undefined | null>;
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
* Creates a new [debug adapter session](#DebugAdapterSession).
|
|
114
|
-
* @param config The resolved [debug configuration](#DebugConfiguration).
|
|
115
|
-
* @param workspaceFolderUri The workspace folder for this sessions or undefined when folderless
|
|
116
|
-
* @returns The identifier of the created [debug adapter session](#DebugAdapterSession).
|
|
117
|
-
*/
|
|
118
|
-
createDebugSession(config: DebugConfiguration, workspaceFolderUri: string | undefined): Promise<string>;
|
|
119
|
-
|
|
120
|
-
/**
|
|
121
|
-
* Stop a running session for the given session id.
|
|
122
|
-
*/
|
|
123
|
-
terminateDebugSession(sessionId: string): Promise<void>;
|
|
124
|
-
|
|
125
|
-
/**
|
|
126
|
-
* Event handle to indicate when one or more dynamic debug configuration providers
|
|
127
|
-
* have been registered or unregistered.
|
|
128
|
-
*/
|
|
129
|
-
onDidChangeDebugConfigurationProviders: Event<void>;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
/**
|
|
133
|
-
* The endpoint path to the debug adapter session.
|
|
134
|
-
*/
|
|
135
|
-
export const DebugAdapterPath = '/services/debug-adapter';
|
|
136
|
-
|
|
137
|
-
export namespace DebugError {
|
|
138
|
-
export const NotFound = ApplicationError.declare(-41000, (type: string) => ({
|
|
139
|
-
message: `'${type}' debugger type is not supported.`,
|
|
140
|
-
data: { type }
|
|
141
|
-
}));
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
/**
|
|
145
|
-
* A closeable channel to send debug protocol messages over with error/close handling
|
|
146
|
-
*/
|
|
147
|
-
export interface DebugChannel {
|
|
148
|
-
send(content: string): void;
|
|
149
|
-
onMessage(cb: (message: string) => void): void;
|
|
150
|
-
onError(cb: (reason: unknown) => void): void;
|
|
151
|
-
onClose(cb: (code: number, reason: string) => void): void;
|
|
152
|
-
close(): void;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
/**
|
|
156
|
-
* A {@link DebugChannel} wrapper implementation that sends and receives messages to/from an underlying {@link Channel}.
|
|
157
|
-
*/
|
|
158
|
-
export class ForwardingDebugChannel implements DebugChannel {
|
|
159
|
-
private onMessageEmitter = new Emitter<string>();
|
|
160
|
-
|
|
161
|
-
constructor(private readonly underlyingChannel: Channel) {
|
|
162
|
-
this.underlyingChannel.onMessage(msg => this.onMessageEmitter.fire(msg().readString()));
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
send(content: string): void {
|
|
166
|
-
this.underlyingChannel.getWriteBuffer().writeString(content).commit();
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
onMessage(cb: (message: string) => void): void {
|
|
170
|
-
this.onMessageEmitter.event(cb);
|
|
171
|
-
}
|
|
172
|
-
onError(cb: (reason: unknown) => void): void {
|
|
173
|
-
this.underlyingChannel.onError(cb);
|
|
174
|
-
}
|
|
175
|
-
onClose(cb: (code: number, reason: string) => void): void {
|
|
176
|
-
this.underlyingChannel.onClose(event => cb(event.code ?? -1, event.reason));
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
close(): void {
|
|
180
|
-
this.underlyingChannel.close();
|
|
181
|
-
this.onMessageEmitter.dispose();
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
}
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2018 Red Hat, Inc. 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 { Channel, Disposable, Emitter, Event } from '@theia/core';
|
|
18
|
+
import { ApplicationError } from '@theia/core/lib/common/application-error';
|
|
19
|
+
import { IJSONSchema, IJSONSchemaSnippet } from '@theia/core/lib/common/json-schema';
|
|
20
|
+
import { CommandIdVariables } from '@theia/variable-resolver/lib/common/variable-types';
|
|
21
|
+
import { DebugConfiguration } from './debug-configuration';
|
|
22
|
+
|
|
23
|
+
export interface DebuggerDescription {
|
|
24
|
+
type: string
|
|
25
|
+
label: string
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* The WS endpoint path to the Debug service.
|
|
30
|
+
*/
|
|
31
|
+
export const DebugPath = '/services/debug';
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* DebugService symbol for DI.
|
|
35
|
+
*/
|
|
36
|
+
export const DebugService = Symbol('DebugService');
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* This service provides functionality to configure and to start a new debug adapter session.
|
|
40
|
+
* The workflow is the following. If user wants to debug an application and
|
|
41
|
+
* there is no debug configuration associated with the application then
|
|
42
|
+
* the list of available providers is requested to create suitable debug configuration.
|
|
43
|
+
* When configuration is chosen it is possible to alter the configuration
|
|
44
|
+
* by filling in missing values or by adding/changing/removing attributes. For this purpose the
|
|
45
|
+
* #resolveDebugConfiguration method is invoked. After that the debug adapter session will be started.
|
|
46
|
+
*/
|
|
47
|
+
export interface DebugService extends Disposable {
|
|
48
|
+
onDidChangeDebuggers?: Event<void>;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Finds and returns an array of registered debug types.
|
|
52
|
+
* @returns An array of registered debug types
|
|
53
|
+
*/
|
|
54
|
+
debugTypes(): Promise<string[]>;
|
|
55
|
+
|
|
56
|
+
getDebuggersForLanguage(language: string): Promise<DebuggerDescription[]>;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Provide debugger contributed variables
|
|
60
|
+
* see "variables" at https://code.visualstudio.com/api/references/contribution-points#contributes.debuggers
|
|
61
|
+
*/
|
|
62
|
+
provideDebuggerVariables(debugType: string): Promise<CommandIdVariables>;
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Provides the schema attributes.
|
|
66
|
+
* @param debugType The registered debug type
|
|
67
|
+
* @returns An JSON Schema describing the configuration attributes for the given debug type
|
|
68
|
+
*/
|
|
69
|
+
getSchemaAttributes(debugType: string): Promise<IJSONSchema[]>;
|
|
70
|
+
|
|
71
|
+
getConfigurationSnippets(): Promise<IJSONSchemaSnippet[]>;
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Provides initial [debug configuration](#DebugConfiguration).
|
|
75
|
+
* @param debugType The registered debug type
|
|
76
|
+
* @returns An array of [debug configurations](#DebugConfiguration)
|
|
77
|
+
*/
|
|
78
|
+
provideDebugConfigurations(debugType: string, workspaceFolderUri: string | undefined): Promise<DebugConfiguration[]>;
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* @returns A Record of debug configuration provider types and a corresponding dynamic debug configurations array
|
|
82
|
+
*/
|
|
83
|
+
provideDynamicDebugConfigurations?(folder?: string): Promise<Record<string, DebugConfiguration[]>>;
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Provides a dynamic debug configuration matching the name and the provider debug type
|
|
87
|
+
*/
|
|
88
|
+
fetchDynamicDebugConfiguration(name: string, type: string, folder?: string): Promise<DebugConfiguration | undefined>;
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Resolves a [debug configuration](#DebugConfiguration) by filling in missing values
|
|
92
|
+
* or by adding/changing/removing attributes before variable substitution.
|
|
93
|
+
* @param debugConfiguration The [debug configuration](#DebugConfiguration) to resolve.
|
|
94
|
+
* @returns The resolved debug configuration, undefined or null.
|
|
95
|
+
*/
|
|
96
|
+
resolveDebugConfiguration(
|
|
97
|
+
config: DebugConfiguration,
|
|
98
|
+
workspaceFolderUri: string | undefined
|
|
99
|
+
): Promise<DebugConfiguration | undefined | null>;
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Resolves a [debug configuration](#DebugConfiguration) by filling in missing values
|
|
103
|
+
* or by adding/changing/removing attributes with substituted variables.
|
|
104
|
+
* @param debugConfiguration The [debug configuration](#DebugConfiguration) to resolve.
|
|
105
|
+
* @returns The resolved debug configuration, undefined or null.
|
|
106
|
+
*/
|
|
107
|
+
resolveDebugConfigurationWithSubstitutedVariables(
|
|
108
|
+
config: DebugConfiguration,
|
|
109
|
+
workspaceFolderUri: string | undefined
|
|
110
|
+
): Promise<DebugConfiguration | undefined | null>;
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Creates a new [debug adapter session](#DebugAdapterSession).
|
|
114
|
+
* @param config The resolved [debug configuration](#DebugConfiguration).
|
|
115
|
+
* @param workspaceFolderUri The workspace folder for this sessions or undefined when folderless
|
|
116
|
+
* @returns The identifier of the created [debug adapter session](#DebugAdapterSession).
|
|
117
|
+
*/
|
|
118
|
+
createDebugSession(config: DebugConfiguration, workspaceFolderUri: string | undefined): Promise<string>;
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Stop a running session for the given session id.
|
|
122
|
+
*/
|
|
123
|
+
terminateDebugSession(sessionId: string): Promise<void>;
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Event handle to indicate when one or more dynamic debug configuration providers
|
|
127
|
+
* have been registered or unregistered.
|
|
128
|
+
*/
|
|
129
|
+
onDidChangeDebugConfigurationProviders: Event<void>;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* The endpoint path to the debug adapter session.
|
|
134
|
+
*/
|
|
135
|
+
export const DebugAdapterPath = '/services/debug-adapter';
|
|
136
|
+
|
|
137
|
+
export namespace DebugError {
|
|
138
|
+
export const NotFound = ApplicationError.declare(-41000, (type: string) => ({
|
|
139
|
+
message: `'${type}' debugger type is not supported.`,
|
|
140
|
+
data: { type }
|
|
141
|
+
}));
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* A closeable channel to send debug protocol messages over with error/close handling
|
|
146
|
+
*/
|
|
147
|
+
export interface DebugChannel {
|
|
148
|
+
send(content: string): void;
|
|
149
|
+
onMessage(cb: (message: string) => void): void;
|
|
150
|
+
onError(cb: (reason: unknown) => void): void;
|
|
151
|
+
onClose(cb: (code: number, reason: string) => void): void;
|
|
152
|
+
close(): void;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* A {@link DebugChannel} wrapper implementation that sends and receives messages to/from an underlying {@link Channel}.
|
|
157
|
+
*/
|
|
158
|
+
export class ForwardingDebugChannel implements DebugChannel {
|
|
159
|
+
private onMessageEmitter = new Emitter<string>();
|
|
160
|
+
|
|
161
|
+
constructor(private readonly underlyingChannel: Channel) {
|
|
162
|
+
this.underlyingChannel.onMessage(msg => this.onMessageEmitter.fire(msg().readString()));
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
send(content: string): void {
|
|
166
|
+
this.underlyingChannel.getWriteBuffer().writeString(content).commit();
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
onMessage(cb: (message: string) => void): void {
|
|
170
|
+
this.onMessageEmitter.event(cb);
|
|
171
|
+
}
|
|
172
|
+
onError(cb: (reason: unknown) => void): void {
|
|
173
|
+
this.underlyingChannel.onError(cb);
|
|
174
|
+
}
|
|
175
|
+
onClose(cb: (code: number, reason: string) => void): void {
|
|
176
|
+
this.underlyingChannel.onClose(event => cb(event.code ?? -1, event.reason));
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
close(): void {
|
|
180
|
+
this.underlyingChannel.close();
|
|
181
|
+
this.onMessageEmitter.dispose();
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
}
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
/********************************************************************************
|
|
2
|
-
* Copyright (C) 2022 STMicroelectronics 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
|
-
* The URI scheme for debug URIs.
|
|
19
|
-
*/
|
|
20
|
-
export const DEBUG_SCHEME = 'debug';
|
|
21
|
-
/**
|
|
22
|
-
* The pattern for URI schemes.
|
|
23
|
-
*/
|
|
24
|
-
export const SCHEME_PATTERN = /^[a-zA-Z][a-zA-Z0-9\+\-\.]+:/;
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (C) 2022 STMicroelectronics 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
|
+
* The URI scheme for debug URIs.
|
|
19
|
+
*/
|
|
20
|
+
export const DEBUG_SCHEME = 'debug';
|
|
21
|
+
/**
|
|
22
|
+
* The pattern for URI schemes.
|
|
23
|
+
*/
|
|
24
|
+
export const SCHEME_PATTERN = /^[a-zA-Z][a-zA-Z0-9\+\-\.]+:/;
|
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
// *****************************************************************************
|
|
2
|
-
// Copyright (C) 2021 Red Hat, Inc. 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 { Emitter, Event } from '@theia/core/lib/common/event';
|
|
18
|
-
import { DebugAdapter } from './debug-model';
|
|
19
|
-
import * as theia from '@theia/plugin';
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* A debug adapter for using the inline implementation from a plugin.
|
|
23
|
-
*/
|
|
24
|
-
export class InlineDebugAdapter implements DebugAdapter {
|
|
25
|
-
private messageReceivedEmitter = new Emitter<string>();
|
|
26
|
-
onMessageReceived: Event<string> = this.messageReceivedEmitter.event;
|
|
27
|
-
onError: Event<Error> = Event.None;
|
|
28
|
-
private closeEmitter = new Emitter<void>();
|
|
29
|
-
onClose: Event<void> = this.closeEmitter.event;
|
|
30
|
-
|
|
31
|
-
constructor(private debugAdapter: theia.DebugAdapter) {
|
|
32
|
-
this.debugAdapter.onDidSendMessage(msg => {
|
|
33
|
-
this.messageReceivedEmitter.fire(JSON.stringify(msg));
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
async start(): Promise<void> {
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
send(message: string): void {
|
|
41
|
-
this.debugAdapter.handleMessage(JSON.parse(message));
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
async stop(): Promise<void> {
|
|
45
|
-
this.debugAdapter.dispose();
|
|
46
|
-
}
|
|
47
|
-
}
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2021 Red Hat, Inc. 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 { Emitter, Event } from '@theia/core/lib/common/event';
|
|
18
|
+
import { DebugAdapter } from './debug-model';
|
|
19
|
+
import * as theia from '@theia/plugin';
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* A debug adapter for using the inline implementation from a plugin.
|
|
23
|
+
*/
|
|
24
|
+
export class InlineDebugAdapter implements DebugAdapter {
|
|
25
|
+
private messageReceivedEmitter = new Emitter<string>();
|
|
26
|
+
onMessageReceived: Event<string> = this.messageReceivedEmitter.event;
|
|
27
|
+
onError: Event<Error> = Event.None;
|
|
28
|
+
private closeEmitter = new Emitter<void>();
|
|
29
|
+
onClose: Event<void> = this.closeEmitter.event;
|
|
30
|
+
|
|
31
|
+
constructor(private debugAdapter: theia.DebugAdapter) {
|
|
32
|
+
this.debugAdapter.onDidSendMessage(msg => {
|
|
33
|
+
this.messageReceivedEmitter.fire(JSON.stringify(msg));
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
async start(): Promise<void> {
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
send(message: string): void {
|
|
41
|
+
this.debugAdapter.handleMessage(JSON.parse(message));
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
async stop(): Promise<void> {
|
|
45
|
+
this.debugAdapter.dispose();
|
|
46
|
+
}
|
|
47
|
+
}
|