import { CancellationToken } from "@codingame/monaco-vscode-api/vscode/vs/base/common/cancellation"; import { Event } from "@codingame/monaco-vscode-api/vscode/vs/base/common/event"; import { Disposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle"; import { URI } from "@codingame/monaco-vscode-api/vscode/vs/base/common/uri"; import { IPosition, Position } from "@codingame/monaco-vscode-api/vscode/vs/editor/common/core/position"; import { IAccessibilityService } from "@codingame/monaco-vscode-api/vscode/vs/platform/accessibility/common/accessibility.service"; import { IConfigurationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service"; import { IInstantiationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation"; import { ILogService } from "@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service"; import { INotificationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/notification/common/notification.service"; import { IProductService } from "@codingame/monaco-vscode-api/vscode/vs/platform/product/common/productService.service"; import { ICustomEndpointTelemetryService } from "@codingame/monaco-vscode-api/vscode/vs/platform/telemetry/common/telemetry.service"; import { ITelemetryService } from "@codingame/monaco-vscode-api/vscode/vs/platform/telemetry/common/telemetry.service"; import { IUriIdentityService } from "@codingame/monaco-vscode-api/vscode/vs/platform/uriIdentity/common/uriIdentity.service"; import { IWorkspaceFolder } from "@codingame/monaco-vscode-api/vscode/vs/platform/workspace/common/workspace"; import { IWorkspaceContextService } from "@codingame/monaco-vscode-api/vscode/vs/platform/workspace/common/workspace.service"; import { IWorkbenchEnvironmentService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/environment/common/environmentService.service"; import { IHostService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/host/browser/host.service"; import { ILifecycleService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/lifecycle/common/lifecycle.service"; import { IPaneCompositePartService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/panecomposite/browser/panecomposite.service"; import { LiveTestResult } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/testing/common/testResult"; import { ITestResultService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/testing/common/testResultService.service"; import { ITestService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/testing/common/testService.service"; import { AdapterEndEvent, IBreakpoint, IConfig, IDataBreakpoint, IDataBreakpointInfoResponse, IDebugLocationReferenced, IDebugSession, IDebugSessionOptions, IDebugger, IExceptionBreakpoint, IExceptionInfo, IFunctionBreakpoint, IInstructionBreakpoint, IMemoryRegion, IRawModelUpdate, IRawStoppedDetails, IReplElement, IStackFrame, IThread, LoadedSourceEvent, State } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/debug/common/debug"; import { IDebugService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/debug/common/debug.service"; import { DebugCompoundRoot } from "../common/debugCompoundRoot.js"; import { DebugModel, Thread } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/debug/common/debugModel"; import { Source } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/debug/common/debugSource"; import { INewReplElementData } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/debug/common/replModel"; import { RawDebugSession } from "./rawDebugSession.js"; export declare class DebugSession implements IDebugSession { private id; private _configuration; root: IWorkspaceFolder | undefined; private model; private readonly debugService; private readonly telemetryService; private readonly hostService; private readonly configurationService; private readonly paneCompositeService; private readonly workspaceContextService; private readonly productService; private readonly notificationService; private readonly uriIdentityService; private readonly instantiationService; private readonly customEndpointTelemetryService; private readonly workbenchEnvironmentService; private readonly logService; private readonly testService; private readonly accessibilityService; parentSession: IDebugSession | undefined; rememberedCapabilities?: DebugProtocol.Capabilities; private _subId; raw: RawDebugSession | undefined; private initialized; private _options; private sources; private threads; private threadIds; private cancellationMap; private readonly rawListeners; private readonly globalDisposables; private fetchThreadsScheduler; private passFocusScheduler; private lastContinuedThreadId; private repl; private stoppedDetails; private readonly statusQueue; /** Test run this debug session was spawned by */ readonly correlatedTestRun?: LiveTestResult; /** Whether we terminated the correlated run yet. Used so a 2nd terminate request goes through to the underlying session. */ private didTerminateTestRun?; private readonly _onDidChangeState; private readonly _onDidEndAdapter; private readonly _onDidLoadedSource; private readonly _onDidCustomEvent; private readonly _onDidProgressStart; private readonly _onDidProgressUpdate; private readonly _onDidProgressEnd; private readonly _onDidInvalidMemory; private readonly _onDidChangeREPLElements; private _name; private readonly _onDidChangeName; /** * Promise set while enabling dependent breakpoints to block the debugger * from continuing from a stopped state. */ private _waitToResume?; constructor(id: string, _configuration: { resolved: IConfig; unresolved: IConfig | undefined; }, root: IWorkspaceFolder | undefined, model: DebugModel, options: IDebugSessionOptions | undefined, debugService: IDebugService, telemetryService: ITelemetryService, hostService: IHostService, configurationService: IConfigurationService, paneCompositeService: IPaneCompositePartService, workspaceContextService: IWorkspaceContextService, productService: IProductService, notificationService: INotificationService, lifecycleService: ILifecycleService, uriIdentityService: IUriIdentityService, instantiationService: IInstantiationService, customEndpointTelemetryService: ICustomEndpointTelemetryService, workbenchEnvironmentService: IWorkbenchEnvironmentService, logService: ILogService, testService: ITestService, testResultService: ITestResultService, accessibilityService: IAccessibilityService); getId(): string; setSubId(subId: string | undefined): void; getMemory(memoryReference: string): IMemoryRegion; get subId(): string | undefined; get configuration(): IConfig; get unresolvedConfiguration(): IConfig | undefined; get lifecycleManagedByParent(): boolean; get compact(): boolean; get saveBeforeRestart(): boolean; get compoundRoot(): DebugCompoundRoot | undefined; get suppressDebugStatusbar(): boolean; get suppressDebugToolbar(): boolean; get suppressDebugView(): boolean; get autoExpandLazyVariables(): boolean; setConfiguration(configuration: { resolved: IConfig; unresolved: IConfig | undefined; }): void; getLabel(): string; setName(name: string): void; get name(): string; get state(): State; get capabilities(): DebugProtocol.Capabilities; get onDidChangeState(): Event; get onDidEndAdapter(): Event; get onDidChangeReplElements(): Event; get onDidChangeName(): Event; get onDidCustomEvent(): Event; get onDidLoadedSource(): Event; get onDidProgressStart(): Event; get onDidProgressUpdate(): Event; get onDidProgressEnd(): Event; get onDidInvalidateMemory(): Event; /** * create and initialize a new debug adapter for this session */ initialize(dbgr: IDebugger): Promise; /** * launch or attach to the debuggee */ launchOrAttach(config: IConfig): Promise; /** * Terminate any linked test run. */ cancelCorrelatedTestRun(): void; /** * terminate the current debug adapter session */ terminate(restart?: boolean): Promise; /** * end the current debug adapter session */ disconnect(restart?: boolean, suspend?: boolean): Promise; /** * restart debug adapter session */ restart(): Promise; sendBreakpoints(modelUri: URI, breakpointsToSend: IBreakpoint[], sourceModified: boolean): Promise; sendFunctionBreakpoints(fbpts: IFunctionBreakpoint[]): Promise; sendExceptionBreakpoints(exbpts: IExceptionBreakpoint[]): Promise; dataBytesBreakpointInfo(address: string, bytes: number): Promise; dataBreakpointInfo(name: string, variablesReference?: number, frameId?: number): Promise<{ dataId: string | null; description: string; canPersist?: boolean; } | undefined>; private _dataBreakpointInfo; sendDataBreakpoints(dataBreakpoints: IDataBreakpoint[]): Promise; sendInstructionBreakpoints(instructionBreakpoints: IInstructionBreakpoint[]): Promise; breakpointsLocations(uri: URI, lineNumber: number): Promise; getDebugProtocolBreakpoint(breakpointId: string): DebugProtocol.Breakpoint | undefined; customRequest(request: string, args: any): Promise; stackTrace(threadId: number, startFrame: number, levels: number, token: CancellationToken): Promise; exceptionInfo(threadId: number): Promise; scopes(frameId: number, threadId: number): Promise; variables(variablesReference: number, threadId: number | undefined, filter: "indexed" | "named" | undefined, start: number | undefined, count: number | undefined): Promise; evaluate(expression: string, frameId: number, context?: string, location?: { line: number; column: number; source: DebugProtocol.Source; }): Promise; restartFrame(frameId: number, threadId: number): Promise; private setLastSteppingGranularity; next(threadId: number, granularity?: DebugProtocol.SteppingGranularity): Promise; stepIn(threadId: number, targetId?: number, granularity?: DebugProtocol.SteppingGranularity): Promise; stepOut(threadId: number, granularity?: DebugProtocol.SteppingGranularity): Promise; stepBack(threadId: number, granularity?: DebugProtocol.SteppingGranularity): Promise; continue(threadId: number): Promise; reverseContinue(threadId: number): Promise; pause(threadId: number): Promise; terminateThreads(threadIds?: number[]): Promise; setVariable(variablesReference: number, name: string, value: string): Promise; setExpression(frameId: number, expression: string, value: string): Promise; gotoTargets(source: DebugProtocol.Source, line: number, column?: number): Promise; goto(threadId: number, targetId: number): Promise; loadSource(resource: URI): Promise; getLoadedSources(): Promise; completions(frameId: number | undefined, threadId: number, text: string, position: Position, token: CancellationToken): Promise; stepInTargets(frameId: number): Promise<{ id: number; label: string; }[] | undefined>; cancel(progressId: string): Promise; disassemble(memoryReference: string, offset: number, instructionOffset: number, instructionCount: number): Promise; readMemory(memoryReference: string, offset: number, count: number): Promise; writeMemory(memoryReference: string, offset: number, data: string, allowPartial?: boolean): Promise; resolveLocationReference(locationReference: number): Promise; getThread(threadId: number): Thread | undefined; getAllThreads(): IThread[]; clearThreads(removeThreads: boolean, reference?: number | undefined): void; getStoppedDetails(): IRawStoppedDetails | undefined; rawUpdate(data: IRawModelUpdate): void; private waitForTriggeredBreakpoints; private fetchThreads; initializeForTest(raw: RawDebugSession): void; private registerListeners; private handleStop; private enableDependentBreakpoints; private getBreakpointsAtPosition; private onDidExitAdapter; private shutdown; dispose(): void; getSourceForUri(uri: URI): Source | undefined; getSource(raw?: DebugProtocol.Source): Source; private getRawSource; private getNewCancellationToken; private cancelAllRequests; getReplElements(): IReplElement[]; hasSeparateRepl(): boolean; removeReplExpressions(): void; addReplExpression(stackFrame: IStackFrame | undefined, expression: string): Promise; appendToRepl(data: INewReplElementData, isImportant?: boolean): void; } /** * Keeps track of events for threads, and cancels any previous operations for * a thread when the thread goes into a new state. Currently, the operations a thread has are: * * - started * - stopped * - continue * - exited * * In each case, the new state preempts the old state, so we don't need to * queue work, just cancel old work. It's up to the caller to make sure that * no UI effects happen at the point when the `token` is cancelled. */ export declare class ThreadStatusScheduler extends Disposable { /** * An array of set of thread IDs. When a 'stopped' event is encountered, the * editor refreshes its thread IDs. In the meantime, the thread may change * state it again. So the editor puts a Set into this array when it starts * the refresh, and checks it after the refresh is finished, to see if * any of the threads it looked up should now be invalidated. */ private pendingCancellations; /** * Cancellation tokens for currently-running operations on threads. */ private readonly threadOps; /** * Runs the operation. * If thread is undefined it affects all threads. */ run(threadIdsP: Promise | number[], operation: (threadId: number, ct: CancellationToken) => Promise): Promise; /** * Cancels all ongoing state operations on the given threads. * If threads is undefined it cancel all threads. */ cancel(threadIds?: readonly number[]): void; }