Repository navigation
Add support for remote debugging with experimental debugger #1230
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
Don Jayamanne (DonJayamanne)
merged 20 commits into
microsoft:master
from
DonJayamanne:issueAttachExperimental
Apr 4, 2018
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
2fd50a7
split compilation for faster compilation on windows
DonJayamanne b9d6c0b
:sparkles: experimental debugger attach
DonJayamanne 4a1dcb0
:hammer: refactor
DonJayamanne 5d6223c
:white_check_mark: tests for experimental debugger attach
DonJayamanne 15249b3
:hammer: increase timeout of this test
DonJayamanne febe297
:memo: change log [skip ci]
DonJayamanne 35afa54
increase timeout for tests
DonJayamanne c24183b
add templates for attaching
DonJayamanne 3275dd5
change label [skip ci]
DonJayamanne 0e5f0f6
chane type [skip ci]
DonJayamanne 9032acf
improvements tests (temporary workaround due to PTVSD issues)
DonJayamanne 4f855f0
:hammer: connect vsc to ptvsd early on
DonJayamanne 08dc364
:hammer: use utils
DonJayamanne 39dcd34
code review changes
DonJayamanne 22d710d
:hammer: fix typo
DonJayamanne 5c1dcfb
:hammer: fix code review comments
DonJayamanne 8ec6576
fixed code review comments
DonJayamanne 80b1903
Further clean up
DonJayamanne 10297ef
:hammer: rename based on code review
DonJayamanne 9bf271a
revert changes
DonJayamanne 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| Add prelimnary support for remote debugging using the experimental debugger. | ||
| Attach to a Python program started using the command `python -m ptvsd --server --port 9091 --file pythonFile.py` |
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,51 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. | ||
|
|
||
| 'use strict'; | ||
|
|
||
| import { connect, Socket } from 'net'; | ||
| import { DebugSession } from 'vscode-debugadapter'; | ||
| import { AttachRequestArguments, IDebugServer, IPythonProcess } from '../Common/Contracts'; | ||
| import { BaseDebugServer } from './BaseDebugServer'; | ||
|
|
||
| export class RemoteDebugServerV2 extends BaseDebugServer { | ||
| private args: AttachRequestArguments; | ||
| private socket?: Socket; | ||
| constructor(debugSession: DebugSession, pythonProcess: IPythonProcess, args: AttachRequestArguments) { | ||
| super(debugSession, pythonProcess); | ||
| this.args = args; | ||
| } | ||
|
|
||
| public Stop() { | ||
| if (this.socket) { | ||
| this.socket.destroy(); | ||
| } | ||
| } | ||
| public Start(): Promise<IDebugServer> { | ||
| return new Promise<IDebugServer>((resolve, reject) => { | ||
| const port = this.args.port!; | ||
| const options = { port }; | ||
| if (typeof this.args.host === 'string' && this.args.host.length > 0) { | ||
| // tslint:disable-next-line:no-any | ||
| (<any>options).host = this.args.host; | ||
| } | ||
| try { | ||
| let connected = false; | ||
| const socket = connect(options, () => { | ||
| connected = true; | ||
| this.socket = socket; | ||
| this.clientSocket.resolve(socket); | ||
| resolve(options); | ||
| }); | ||
| socket.on('error', ex => { | ||
| if (connected) { | ||
| return; | ||
| } | ||
| reject(ex); | ||
| }); | ||
| } catch (ex) { | ||
| reject(ex); | ||
| } | ||
| }); | ||
| } | ||
| } |
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be worth splitting into
AttachConfigurationProviderandLaunchConfigurationProviderand have static factory likegetConfigurationProvider(mode). Class has bunch ofgetLaunchXandgetAttachXand casts and checks for the debug mode.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately there can only be one debug configuration, that handles both
launchandattach(& more in the future).I've cleaned up the code,
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There could be one class that contains a
handlerspecific to the mode. I.e. debug configuration class acts as a proxy and simply forwards calls to 'launchor 'attachhandlerThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍