src/vs/workbench/contrib/debug/common/debugSource.ts

165 LOC · 58 covered · 107 uncovered · 9 ranges · 15 concepts · 1 introducers · 9 tests

File neighbourhood

The centred file is linked to every concept that introduces one of its ranges, every test that runs code from the file, and the gray connector concepts standing between those tests and the file's own introducer concepts. Undirected links join concepts to every file where they introduce source and concepts to the tests they introduce; arrows show specialization between the displayed concepts and bridge only concepts omitted from this view. Concept colors match the source ranges below; connector concepts have no source color and are shown in gray.

Focused file, its introducer and connector concepts, their introduced files, and tests that run code from the file

In the embedded map, ordinary wheel input scrolls the page; use the visible controls to zoom and drag to pan. Open the full-screen map for canvas navigation: wheel pans, Ctrl/Command plus wheel zooms, and arrow keys pan when this region is focused. On touch screens, open the full-screen map to pan or pinch. If JavaScript or WebGL is unavailable, use the related-file, concept, and source links on this page.

Focused file, its introducer and connector concepts, their introduced files, and tests that run code from the filesrc/vs/workbench/contrib/debug/common/debugModel.ts · 2158 LOCcommon/debugModel.tssrc/vs/workbench/contrib/debug/common/debugStorage.ts · 189 LOCcommon/debugStorage.tssrc/vs/workbench/contrib/debug/common/disassemblyViewInput.ts · 45 LOCcommon/disassemblyViewIn…src/vs/workbench/contrib/debug/test/common/mockDebug.ts · 697 LOCcommon/mockDebug.tsdebugModel.ts ×5 · 39 introduced LOCdebugModel.ts ×5debugModel.ts ×1 · 13 introduced LOCdebugModel.ts ×1debugModel.ts ×1 · 8 introduced LOCdebugModel.ts ×1debugModel.ts ×6 · 20 introduced LOCdebugModel.ts ×6debugStorage.ts ×17 · 98 introduced LOCdebugStorage.ts ×17debugModel.ts ×3 · 29 introduced LOCdebugModel.ts ×3debugModel.ts ×2 · 11 introduced LOCdebugModel.ts ×2debugModel.ts ×2 · 12 introduced LOCdebugModel.ts ×2debugModel.ts ×2 · 13 introduced LOCdebugModel.ts ×2mockDebug.ts ×1 · 2 introduced LOCmockDebug.ts ×1mockDebug.ts ×1 · 2 introduced LOCmockDebug.ts ×1mockDebug.ts ×7 · 30 introduced LOCmockDebug.ts ×7abstractDebugAdapter.ts ×4 · 18 introduced LOCabstractDebugAdapter.ts …debugModel.ts ×1 · 1 introduced LOCdebugModel.ts ×1debugModel.ts ×185 · 988 introduced LOCdebugModel.ts ×185abstractDebugAdapter.test|title=Debug - AbstractDebugAdapter event ordering does not insert boundaries between events|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/contrib/debug/test/common/abstractDebugAdapter.test|title=Debug - AbstractDebugAdapter event ordering does not insert boundaries between events|occurrence=1abstractDebugAdapter.tes…abstractDebugAdapter.test|title=Debug - AbstractDebugAdapter event ordering inserts task boundary after response|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/contrib/debug/test/common/abstractDebugAdapter.test|title=Debug - AbstractDebugAdapter event ordering inserts task boundary after response|occurrence=1abstractDebugAdapter.tes…abstractDebugAdapter.test|title=Debug - AbstractDebugAdapter event ordering inserts task boundary before response|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/contrib/debug/test/common/abstractDebugAdapter.test|title=Debug - AbstractDebugAdapter event ordering inserts task boundary before response|occurrence=1abstractDebugAdapter.tes…debugModel.test|title=DebugModel DebugModel refreshTopOfCallstack resolves all returned promises when called multiple times|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/contrib/debug/test/common/debugModel.test|title=DebugModel DebugModel refreshTopOfCallstack resolves all returned promises when called multiple times|occurrence=1debugModel.test|title=De…debugModel.test|title=DebugModel ExceptionBreakpoint Restored matches new|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/contrib/debug/test/common/debugModel.test|title=DebugModel ExceptionBreakpoint Restored matches new|occurrence=1debugModel.test|title=De…debugModel.test|title=DebugModel FunctionBreakpoint Id is saved|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/contrib/debug/test/common/debugModel.test|title=DebugModel FunctionBreakpoint Id is saved|occurrence=1debugModel.test|title=De…debugModel.test|title=DebugModel InstructionBreakpoint removeInstructionBreakpoints falls back to instructionReference+offset when address not supplied|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/contrib/debug/test/common/debugModel.test|title=DebugModel InstructionBreakpoint removeInstructionBreakpoints falls back to instructionReference+offset when address not supplied|occurrence=1debugModel.test|title=De…debugModel.test|title=DebugModel InstructionBreakpoint removeInstructionBreakpoints prefers address match when instructionReference has changed|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/contrib/debug/test/common/debugModel.test|title=DebugModel InstructionBreakpoint removeInstructionBreakpoints prefers address match when instructionReference has changed|occurrence=1debugModel.test|title=De…debugModel.test|title=DebugModel InstructionBreakpoint removeInstructionBreakpoints with only address removes the matching entry and leaves others|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/contrib/debug/test/common/debugModel.test|title=DebugModel InstructionBreakpoint removeInstructionBreakpoints with only address removes the matching entry and leaves others|occurrence=1debugModel.test|title=De…Focused file · src/vs/workbench/contrib/debug/common/debugSource.ts · 165 LOCcommon/debugSource.ts

Graph controls are ready.

Interactive rendering requires JavaScript and WebGL. Use the related-file, concept, and source links on this page while the interactive map is unavailable.

1 > /*--------------------------------------------------------------------------------------------- debugModel.ts ×185
2 > * Copyright (c) Microsoft Corporation. All rights reserved.
3 > * Licensed under the MIT License. See License.txt in the project root for license information.
4 > *--------------------------------------------------------------------------------------------*/
5 >
6 > import * as nls from '../../../../nls.js';
7 > import { URI } from '../../../../base/common/uri.js';
8 > import { normalize, isAbsolute } from '../../../../base/common/path.js';
9 > import * as resources from '../../../../base/common/resources.js';
10 > import { DEBUG_SCHEME } from './debug.js';
11 > import { IRange } from '../../../../editor/common/core/range.js';
12 > import { IEditorService, SIDE_GROUP, ACTIVE_GROUP } from '../../../services/editor/common/editorService.js';
13 > import { Schemas } from '../../../../base/common/network.js';
14 > import { isUriString } from './debugUtils.js';
15 > import { IEditorPane } from '../../../common/editor.js';
16 > import { TextEditorSelectionRevealType } from '../../../../platform/editor/common/editor.js';
17 > import { IUriIdentityService } from '../../../../platform/uriIdentity/common/uriIdentity.js';
18 > import { ILogService } from '../../../../platform/log/common/log.js';
19 >
20 > export const UNKNOWN_SOURCE_LABEL = nls.localize('unknownSource', "Unknown Source");
21 >
22 > /**
23 > * Debug URI format
24 > *
25 > * a debug URI represents a Source object and the debug session where the Source comes from.
26 > *
27 > * debug:arbitrary_path?session=123e4567-e89b-12d3-a456-426655440000&ref=1016
28 > * \___/ \____________/ \__________________________________________/ \______/
29 > * | | | |
30 > * scheme source.path session id source.reference
31 > *
32 > *
33 > */
34 >
35 > export class Source {
36 >
37 > readonly uri: URI;
38 > available: boolean;
39 > raw: DebugProtocol.Source;
40 >
41 > constructor(raw_: DebugProtocol.Source | undefined, sessionId: string, uriIdentityService: IUriIdentityService, logService: ILogService) {
42 let path: string;
43 if (raw_) {
44 this.raw = raw_;
45 path = this.raw.path || this.raw.name || '';
46 this.available = true;
47 } else {
48 this.raw = { name: UNKNOWN_SOURCE_LABEL };
49 this.available = false;
50 path = `${DEBUG_SCHEME}:${UNKNOWN_SOURCE_LABEL}`;
51 }
52
53 this.uri = getUriFromSource(this.raw, path, sessionId, uriIdentityService, logService);
54 }
56 > get name() {
57 return this.raw.name || resources.basenameOrAuthority(this.uri);
58 }
60 > get origin() {
61 return this.raw.origin;
62 }
64 > get presentationHint() {
65 return this.raw.presentationHint;
66 }
68 > get reference() {
69 return this.raw.sourceReference;
70 }
72 > get inMemory() {
73 return this.uri.scheme === DEBUG_SCHEME;
74 }
76 > openInEditor(editorService: IEditorService, selection: IRange, preserveFocus?: boolean, sideBySide?: boolean, pinned?: boolean): Promise<IEditorPane | undefined> {
77 return !this.available ? Promise.resolve(undefined) : editorService.openEditor({
78 resource: this.uri,
79 description: this.origin,
80 options: {
81 preserveFocus,
82 selection,
83 revealIfOpened: true,
84 selectionRevealType: TextEditorSelectionRevealType.CenterIfOutsideViewport,
85 pinned
86 }
87 }, sideBySide ? SIDE_GROUP : ACTIVE_GROUP);
88 }
90 > static getEncodedDebugData(modelUri: URI): { name: string; path: string; sessionId?: string; sourceReference?: number } {
91 let path: string;
92 let sourceReference: number | undefined;
93 let sessionId: string | undefined;
94
95 switch (modelUri.scheme) {
96 case Schemas.file:
97 path = normalize(modelUri.fsPath);
98 break;
99 case DEBUG_SCHEME:
100 path = modelUri.path;
101 if (modelUri.query) {
102 const keyvalues = modelUri.query.split('&');
103 for (const keyvalue of keyvalues) {
104 const pair = keyvalue.split('=');
105 if (pair.length === 2) {
106 switch (pair[0]) {
107 case 'session':
108 sessionId = pair[1];
109 break;
110 case 'ref':
111 sourceReference = parseInt(pair[1]);
112 break;
113 }
114 }
115 }
116 }
117 break;
118 default:
119 path = modelUri.toString();
120 break;
121 }
122
123 return {
124 name: resources.basenameOrAuthority(modelUri),
125 path,
126 sourceReference,
127 sessionId
128 };
129 }
131 >
132 > export function getUriFromSource(raw: DebugProtocol.Source, path: string | undefined, sessionId: string, uriIdentityService: IUriIdentityService, logService: ILogService): URI {
133 const _getUriFromSource = (path: string | undefined) => {
134 if (typeof raw.sourceReference === 'number' && raw.sourceReference > 0) {
135 return URI.from({
136 scheme: DEBUG_SCHEME,
137 path: path?.replace(/^\/+/g, '/'), // #174054
138 query: `session=${sessionId}&ref=${raw.sourceReference}`
139 });
140 }
141
142 if (path && isUriString(path)) { // path looks like a uri
143 return uriIdentityService.asCanonicalUri(URI.parse(path));
144 }
145 // assume a filesystem path
146 if (path && isAbsolute(path)) {
147 return uriIdentityService.asCanonicalUri(URI.file(path));
148 }
149 // path is relative: since VS Code cannot deal with this by itself
150 // create a debug url that will result in a DAP 'source' request when the url is resolved.
151 return uriIdentityService.asCanonicalUri(URI.from({
152 scheme: DEBUG_SCHEME,
153 path,
154 query: `session=${sessionId}`
155 }));
156 };
157
158
159 try {
160 return _getUriFromSource(path);
161 } catch (err) {
162 logService.error('Invalid path from debug adapter: ' + path);
163 return _getUriFromSource('/invalidDebugSource');
164 }
165 }