Skip to content
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

fix: remove current execution position when performing stop or continue dbgp operation. #367

Merged
merged 2 commits into from Feb 2, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
94 changes: 56 additions & 38 deletions src/phpDebug.ts
Expand Up @@ -894,88 +894,106 @@ class PhpDebugSession extends vscode.DebugSession {
response: VSCodeDebugProtocol.ContinueResponse,
args: VSCodeDebugProtocol.ContinueArguments
) {
let xdebugResponse: xdebug.StatusResponse | undefined
let connection: xdebug.Connection | undefined
try {
const connection = this._connections.get(args.threadId)
connection = this._connections.get(args.threadId)
if (!connection) {
throw new Error('Unknown thread ID ' + args.threadId)
return this.sendErrorResponse(response, new Error('Unknown thread ID ' + args.threadId))
}
response.body = {
allThreadsContinued: false,
}
xdebugResponse = await connection.sendRunCommand()
this.sendResponse(response)
} catch (error) {
this.sendErrorResponse(response, error)
zobo marked this conversation as resolved.
Show resolved Hide resolved
if (xdebugResponse) {
this._checkStatus(xdebugResponse)
}
return
}
response.body = {
allThreadsContinued: false,
try {
const xdebugResponse = await connection.sendRunCommand()
this._checkStatus(xdebugResponse)
} catch (error) {
this.sendEvent(
new vscode.OutputEvent(
'continueRequest thread ID ' + args.threadId + ' error: ' + error.message + '\n'
),
true
)
}
this.sendResponse(response)
this._checkStatus(xdebugResponse)
}

protected async nextRequest(response: VSCodeDebugProtocol.NextResponse, args: VSCodeDebugProtocol.NextArguments) {
let xdebugResponse: xdebug.StatusResponse | undefined
let connection: xdebug.Connection | undefined
try {
const connection = this._connections.get(args.threadId)
connection = this._connections.get(args.threadId)
if (!connection) {
throw new Error('Unknown thread ID ' + args.threadId)
return this.sendErrorResponse(response, new Error('Unknown thread ID ' + args.threadId))
}
xdebugResponse = await connection.sendStepOverCommand()
this.sendResponse(response)
} catch (error) {
this.sendErrorResponse(response, error)
if (xdebugResponse) {
this._checkStatus(xdebugResponse)
}
return
}
this.sendResponse(response)
this._checkStatus(xdebugResponse)
try {
const xdebugResponse = await connection.sendStepOverCommand()
this._checkStatus(xdebugResponse)
} catch (error) {
this.sendEvent(
new vscode.OutputEvent('nextRequest thread ID ' + args.threadId + ' error: ' + error.message + '\n'),
true
)
}
}

protected async stepInRequest(
response: VSCodeDebugProtocol.StepInResponse,
args: VSCodeDebugProtocol.StepInArguments
) {
let xdebugResponse: xdebug.StatusResponse | undefined
let connection: xdebug.Connection | undefined
try {
const connection = this._connections.get(args.threadId)
connection = this._connections.get(args.threadId)
if (!connection) {
throw new Error('Unknown thread ID ' + args.threadId)
return this.sendErrorResponse(response, new Error('Unknown thread ID ' + args.threadId))
}
xdebugResponse = await connection.sendStepIntoCommand()
this.sendResponse(response)
} catch (error) {
this.sendErrorResponse(response, error)
if (xdebugResponse) {
this._checkStatus(xdebugResponse)
}
return
}
this.sendResponse(response)
this._checkStatus(xdebugResponse)
try {
const xdebugResponse = await connection.sendStepIntoCommand()
this._checkStatus(xdebugResponse)
} catch (error) {
this.sendEvent(
new vscode.OutputEvent('stepInRequest thread ID ' + args.threadId + ' error: ' + error.message + '\n'),
true
)
}
}

protected async stepOutRequest(
response: VSCodeDebugProtocol.StepOutResponse,
args: VSCodeDebugProtocol.StepOutArguments
) {
let xdebugResponse: xdebug.StatusResponse | undefined
let connection: xdebug.Connection | undefined
try {
const connection = this._connections.get(args.threadId)
connection = this._connections.get(args.threadId)
if (!connection) {
throw new Error('Unknown thread ID ' + args.threadId)
return this.sendErrorResponse(response, new Error('Unknown thread ID ' + args.threadId))
}
xdebugResponse = await connection.sendStepOutCommand()
this.sendResponse(response)
} catch (error) {
this.sendErrorResponse(response, error)
if (xdebugResponse) {
this._checkStatus(xdebugResponse)
}
return
}
this.sendResponse(response)
this._checkStatus(xdebugResponse)
try {
const xdebugResponse = await connection.sendStepOutCommand()
this._checkStatus(xdebugResponse)
} catch (error) {
this.sendEvent(
new vscode.OutputEvent('stepOutRequest thread ID ' + args.threadId + ' error: ' + error.message + '\n'),
true
)
}
}

protected pauseRequest(response: VSCodeDebugProtocol.PauseResponse, args: VSCodeDebugProtocol.PauseArguments) {
Expand Down