Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
259ff5f9
V
vscode
项目概览
xxadev
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
259ff5f9
编写于
6月 06, 2018
作者:
I
isidor
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
debug: send events to adapter in a queue. Step requests cancel all pending requests
fixes #50896
上级
a41ac457
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
45 addition
and
37 deletion
+45
-37
src/vs/workbench/parts/debug/electron-browser/debugService.ts
...vs/workbench/parts/debug/electron-browser/debugService.ts
+3
-3
src/vs/workbench/parts/debug/electron-browser/rawDebugSession.ts
...workbench/parts/debug/electron-browser/rawDebugSession.ts
+42
-34
未找到文件。
src/vs/workbench/parts/debug/electron-browser/debugService.ts
浏览文件 @
259ff5f9
...
...
@@ -1224,7 +1224,7 @@ export class DebugService implements debug.IDebugService {
const
sendBreakpointsToSession
=
(
session
:
debug
.
ISession
):
TPromise
<
void
>
=>
{
const
raw
=
<
RawDebugSession
>
session
.
raw
;
if
(
!
raw
.
readyForBreakpoints
)
{
if
(
!
raw
.
initialised
)
{
return
TPromise
.
as
(
null
);
}
...
...
@@ -1274,7 +1274,7 @@ export class DebugService implements debug.IDebugService {
private
sendFunctionBreakpoints
(
session
?:
debug
.
ISession
):
TPromise
<
void
>
{
const
sendFunctionBreakpointsToSession
=
(
session
:
debug
.
ISession
):
TPromise
<
void
>
=>
{
const
raw
=
<
RawDebugSession
>
session
.
raw
;
if
(
!
raw
.
readyForBreakpoints
||
!
raw
.
capabilities
.
supportsFunctionBreakpoints
)
{
if
(
!
raw
.
initialised
||
!
raw
.
capabilities
.
supportsFunctionBreakpoints
)
{
return
TPromise
.
as
(
null
);
}
...
...
@@ -1299,7 +1299,7 @@ export class DebugService implements debug.IDebugService {
private
sendExceptionBreakpoints
(
session
?:
debug
.
ISession
):
TPromise
<
void
>
{
const
sendExceptionBreakpointsToSession
=
(
session
:
debug
.
ISession
):
TPromise
<
any
>
=>
{
const
raw
=
<
RawDebugSession
>
session
.
raw
;
if
(
!
raw
.
readyForBreakpoints
||
this
.
model
.
getExceptionBreakpoints
().
length
===
0
)
{
if
(
!
raw
.
initialised
||
this
.
model
.
getExceptionBreakpoints
().
length
===
0
)
{
return
TPromise
.
as
(
null
);
}
...
...
src/vs/workbench/parts/debug/electron-browser/rawDebugSession.ts
浏览文件 @
259ff5f9
...
...
@@ -17,6 +17,7 @@ import { IWorkspaceFolder } from 'vs/platform/workspace/common/workspace';
import
{
INotificationService
}
from
'
vs/platform/notification/common/notification
'
;
import
{
formatPII
}
from
'
vs/workbench/parts/debug/common/debugUtils
'
;
import
{
SocketDebugAdapter
}
from
'
vs/workbench/parts/debug/node/debugAdapter
'
;
import
{
Queue
}
from
'
vs/base/common/async
'
;
export
interface
SessionExitedEvent
extends
debug
.
DebugEvent
{
...
...
@@ -38,12 +39,12 @@ export class RawDebugSession implements debug.IRawSession {
private
debugAdapter
:
debug
.
IDebugAdapter
;
public
emittedStopped
:
boolean
;
public
readyForBreakpoints
:
boolean
;
public
initialised
:
boolean
;
private
cachedInitServerP
:
TPromise
<
void
>
;
private
startTime
:
number
;
public
disconnected
:
boolean
;
private
sentPromises
:
TPromise
<
DebugProtocol
.
Response
>
[]
;
private
requestQueue
=
new
Queue
()
;
private
_capabilities
:
DebugProtocol
.
Capabilities
;
private
allThreadsContinued
:
boolean
;
...
...
@@ -70,9 +71,26 @@ export class RawDebugSession implements debug.IRawSession {
@
IOutputService
private
outputService
:
IOutputService
)
{
this
.
emittedStopped
=
false
;
this
.
readyForBreakpoints
=
false
;
this
.
initialised
=
false
;
this
.
allThreadsContinued
=
true
;
this
.
sentPromises
=
[];
this
.
requestQueue
.
queue
(()
=>
{
if
(
this
.
cachedInitServerP
)
{
return
this
.
cachedInitServerP
;
}
const
startSessionP
=
this
.
startSession
();
this
.
cachedInitServerP
=
startSessionP
.
then
(()
=>
{
this
.
startTime
=
new
Date
().
getTime
();
},
err
=>
{
this
.
cachedInitServerP
=
null
;
return
TPromise
.
wrapError
(
err
);
});
return
this
.
cachedInitServerP
;
});
this
.
_onDidInitialize
=
new
Emitter
<
DebugProtocol
.
InitializedEvent
>
();
this
.
_onDidStop
=
new
Emitter
<
DebugProtocol
.
StoppedEvent
>
();
...
...
@@ -135,24 +153,6 @@ export class RawDebugSession implements debug.IRawSession {
return
this
.
_onDidEvent
.
event
;
}
private
initServer
():
TPromise
<
void
>
{
if
(
this
.
cachedInitServerP
)
{
return
this
.
cachedInitServerP
;
}
const
startSessionP
=
this
.
startSession
();
this
.
cachedInitServerP
=
startSessionP
.
then
(()
=>
{
this
.
startTime
=
new
Date
().
getTime
();
},
err
=>
{
this
.
cachedInitServerP
=
null
;
return
TPromise
.
wrapError
(
err
);
});
return
this
.
cachedInitServerP
;
}
private
startSession
():
TPromise
<
void
>
{
return
this
.
_debugger
.
createDebugAdapter
(
this
.
root
,
this
.
outputService
,
this
.
debugServerPort
).
then
(
debugAdapter
=>
{
...
...
@@ -173,7 +173,7 @@ export class RawDebugSession implements debug.IRawSession {
}
private
send
<
R
extends
DebugProtocol
.
Response
>
(
command
:
string
,
args
:
any
,
cancelOnDisconnect
=
true
):
TPromise
<
R
>
{
return
this
.
initServer
().
then
(()
=>
{
return
this
.
requestQueue
.
queue
(()
=>
{
const
promise
=
this
.
internalSend
<
R
>
(
command
,
args
).
then
(
response
=>
response
,
(
errorResponse
:
DebugProtocol
.
ErrorResponse
)
=>
{
const
error
=
errorResponse
&&
errorResponse
.
body
?
errorResponse
.
body
.
error
:
null
;
const
errorMessage
=
errorResponse
?
errorResponse
.
message
:
''
;
...
...
@@ -208,9 +208,6 @@ export class RawDebugSession implements debug.IRawSession {
return
errors
.
isPromiseCanceledError
(
errorResponse
)
?
undefined
:
TPromise
.
wrapError
<
R
>
(
new
Error
(
userMessage
));
});
if
(
cancelOnDisconnect
)
{
this
.
sentPromises
.
push
(
promise
);
}
return
promise
;
});
}
...
...
@@ -233,7 +230,7 @@ export class RawDebugSession implements debug.IRawSession {
event
.
sessionId
=
this
.
id
;
if
(
event
.
event
===
'
initialized
'
)
{
this
.
readyForBreakpoints
=
true
;
this
.
initialised
=
true
;
this
.
_onDidInitialize
.
fire
(
event
);
}
else
if
(
event
.
event
===
'
capabilities
'
&&
event
.
body
)
{
const
capabilites
=
(
<
DebugProtocol
.
CapabilitiesEvent
>
event
).
body
.
capabilities
;
...
...
@@ -285,7 +282,17 @@ export class RawDebugSession implements debug.IRawSession {
return
this
.
send
(
'
attach
'
,
args
).
then
(
response
=>
this
.
readCapabilities
(
response
));
}
private
clearRequestQueue
():
void
{
// If the debug session is initialitised it is fine to clear all pending requests
// This is mostly done by "step" requests which change the state of the debuggee
// Thus canceling other requests like "variables" and "evaluate" makes snese
if
(
this
.
initialised
)
{
this
.
requestQueue
.
cancel
();
}
}
public
next
(
args
:
DebugProtocol
.
NextArguments
):
TPromise
<
DebugProtocol
.
NextResponse
>
{
this
.
clearRequestQueue
();
return
this
.
send
(
'
next
'
,
args
).
then
(
response
=>
{
this
.
fireFakeContinued
(
args
.
threadId
);
return
response
;
...
...
@@ -293,6 +300,7 @@ export class RawDebugSession implements debug.IRawSession {
}
public
stepIn
(
args
:
DebugProtocol
.
StepInArguments
):
TPromise
<
DebugProtocol
.
StepInResponse
>
{
this
.
clearRequestQueue
();
return
this
.
send
(
'
stepIn
'
,
args
).
then
(
response
=>
{
this
.
fireFakeContinued
(
args
.
threadId
);
return
response
;
...
...
@@ -300,6 +308,7 @@ export class RawDebugSession implements debug.IRawSession {
}
public
stepOut
(
args
:
DebugProtocol
.
StepOutArguments
):
TPromise
<
DebugProtocol
.
StepOutResponse
>
{
this
.
clearRequestQueue
();
return
this
.
send
(
'
stepOut
'
,
args
).
then
(
response
=>
{
this
.
fireFakeContinued
(
args
.
threadId
);
return
response
;
...
...
@@ -307,6 +316,7 @@ export class RawDebugSession implements debug.IRawSession {
}
public
continue
(
args
:
DebugProtocol
.
ContinueArguments
):
TPromise
<
DebugProtocol
.
ContinueResponse
>
{
this
.
clearRequestQueue
();
return
this
.
send
<
DebugProtocol
.
ContinueResponse
>
(
'
continue
'
,
args
).
then
(
response
=>
{
if
(
response
&&
response
.
body
&&
response
.
body
.
allThreadsContinued
!==
undefined
)
{
this
.
allThreadsContinued
=
response
.
body
.
allThreadsContinued
;
...
...
@@ -329,6 +339,7 @@ export class RawDebugSession implements debug.IRawSession {
}
public
restartFrame
(
args
:
DebugProtocol
.
RestartFrameArguments
,
threadId
:
number
):
TPromise
<
DebugProtocol
.
RestartFrameResponse
>
{
this
.
clearRequestQueue
();
return
this
.
send
(
'
restartFrame
'
,
args
).
then
(
response
=>
{
this
.
fireFakeContinued
(
threadId
);
return
response
;
...
...
@@ -340,17 +351,12 @@ export class RawDebugSession implements debug.IRawSession {
}
public
disconnect
(
restart
=
false
,
force
=
false
):
TPromise
<
DebugProtocol
.
DisconnectResponse
>
{
this
.
clearRequestQueue
();
if
(
this
.
disconnected
&&
force
)
{
return
this
.
stopServer
();
}
// Cancel all sent promises on disconnect so debug trees are not left in a broken state #3666.
// Give a 1s timeout to give a chance for some promises to complete.
setTimeout
(()
=>
{
this
.
sentPromises
.
forEach
(
p
=>
p
&&
p
.
cancel
());
this
.
sentPromises
=
[];
},
1000
);
if
(
this
.
debugAdapter
&&
!
this
.
disconnected
)
{
// point of no return: from now on don't report any errors
this
.
disconnected
=
true
;
...
...
@@ -405,6 +411,7 @@ export class RawDebugSession implements debug.IRawSession {
}
public
stepBack
(
args
:
DebugProtocol
.
StepBackArguments
):
TPromise
<
DebugProtocol
.
StepBackResponse
>
{
this
.
clearRequestQueue
();
return
this
.
send
(
'
stepBack
'
,
args
).
then
(
response
=>
{
if
(
response
.
body
===
undefined
)
{
this
.
fireFakeContinued
(
args
.
threadId
);
...
...
@@ -414,6 +421,7 @@ export class RawDebugSession implements debug.IRawSession {
}
public
reverseContinue
(
args
:
DebugProtocol
.
ReverseContinueArguments
):
TPromise
<
DebugProtocol
.
ReverseContinueResponse
>
{
this
.
clearRequestQueue
();
return
this
.
send
(
'
reverseContinue
'
,
args
).
then
(
response
=>
{
if
(
response
.
body
===
undefined
)
{
this
.
fireFakeContinued
(
args
.
threadId
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录