Repository navigation
Allow Hierarchical call stack view #35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+1,529
−109
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,93 @@ | ||
| import { DebugSession, InitializedEvent, Response, TerminatedEvent } from "@vscode/debugadapter"; | ||
| import { DebugProtocol } from "@vscode/debugprotocol"; | ||
| import { ContextSessionLink, ContextSessionSink, TCF_CAPABILITIES } from "./tcfDebugSession"; | ||
|
|
||
| /** Connects a child session to its group in the root adapter, undefined if the group is gone. */ | ||
| export type ContextSessionConnector = (sink: ContextSessionSink) => ContextSessionLink | undefined; | ||
|
|
||
| /** | ||
| * Debug adapter of a child session that shows the threads of one container | ||
| * context (see ContextSessionHost). The root adapter does the work: thread, | ||
| * frame and variable IDs are the root's, so requests are passed on as they | ||
| * are. Breakpoints are only planted by the root session. | ||
| */ | ||
| export class TcfContextSession extends DebugSession implements ContextSessionSink { | ||
| private link: ContextSessionLink | undefined; | ||
| private terminated = false; | ||
|
|
||
| constructor(private readonly connect: ContextSessionConnector) { | ||
| super(); | ||
| } | ||
|
|
||
| terminate(): void { | ||
| this.link = undefined; | ||
| if (!this.terminated) { | ||
| this.terminated = true; | ||
| this.sendEvent(new TerminatedEvent()); | ||
| } | ||
| } | ||
|
|
||
| override sendEvent(event: DebugProtocol.Event): void { | ||
| if (event.event === "stopped") { | ||
| // The IDs are the root session's. Without them VS Code finds the | ||
| // hit breakpoints by the location of the top frame. | ||
| const body = { ...(event as DebugProtocol.StoppedEvent).body }; | ||
| delete body.hitBreakpointIds; | ||
| event = { ...event, body }; | ||
| } | ||
| super.sendEvent(event); | ||
| } | ||
|
|
||
| protected override dispatchRequest(request: DebugProtocol.Request): void { | ||
| const response: DebugProtocol.Response = new Response(request); | ||
| switch (request.command) { | ||
| case "initialize": | ||
| response.body = { ...TCF_CAPABILITIES }; | ||
| this.sendResponse(response); | ||
| return; | ||
| case "attach": | ||
| case "launch": | ||
| this.link = this.connect(this); | ||
| this.sendResponse(response); | ||
| if (this.link) { | ||
| this.sendEvent(new InitializedEvent()); | ||
| } else { | ||
| this.terminate(); | ||
| } | ||
| return; | ||
| case "configurationDone": | ||
| this.sendResponse(response); | ||
| this.link?.configured(); | ||
| return; | ||
| case "threads": | ||
| response.body = { threads: this.link?.threads() ?? [] }; | ||
| this.sendResponse(response); | ||
| return; | ||
| case "setBreakpoints": | ||
| case "setFunctionBreakpoints": | ||
| case "setInstructionBreakpoints": | ||
| case "setDataBreakpoints": | ||
| // No entries, so VS Code keeps the root session's state for | ||
| // each breakpoint. | ||
| response.body = { breakpoints: [] }; | ||
| this.sendResponse(response); | ||
| return; | ||
| case "setExceptionBreakpoints": | ||
| this.sendResponse(response); | ||
| return; | ||
| case "disconnect": | ||
| case "terminate": | ||
| this.link?.disconnect(); | ||
| this.link = undefined; | ||
| this.terminated = true; | ||
| this.sendResponse(response); | ||
| return; | ||
| } | ||
| const link = this.link; | ||
| if (!link) { | ||
| this.sendErrorResponse(response, 4, "The debug session has ended"); | ||
| return; | ||
| } | ||
| void link.forward(request).then((r) => this.sendResponse({ ...r, seq: 0, request_seq: request.seq })); | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.