Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
673bf004
V
vscode
项目概览
掘金者说
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
673bf004
编写于
6月 06, 2018
作者:
I
isidor
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Revert "debug: send events to adapter in a queue. Step requests cancel all pending requests"
This reverts commit
259ff5f9
.
上级
3a440172
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
37 addition
and
45 deletion
+37
-45
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
+34
-42
未找到文件。
src/vs/workbench/parts/debug/electron-browser/debugService.ts
浏览文件 @
673bf004
...
...
@@ -1224,7 +1224,7 @@ export class DebugService implements debug.IDebugService {
const
sendBreakpointsToSession
=
(
session
:
debug
.
ISession
):
TPromise
<
void
>
=>
{
const
raw
=
<
RawDebugSession
>
session
.
raw
;
if
(
!
raw
.
initialised
)
{
if
(
!
raw
.
readyForBreakpoints
)
{
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
.
initialised
||
!
raw
.
capabilities
.
supportsFunctionBreakpoints
)
{
if
(
!
raw
.
readyForBreakpoints
||
!
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
.
initialised
||
this
.
model
.
getExceptionBreakpoints
().
length
===
0
)
{
if
(
!
raw
.
readyForBreakpoints
||
this
.
model
.
getExceptionBreakpoints
().
length
===
0
)
{
return
TPromise
.
as
(
null
);
}
...
...
src/vs/workbench/parts/debug/electron-browser/rawDebugSession.ts
浏览文件 @
673bf004
...
...
@@ -17,7 +17,6 @@ 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
{
...
...
@@ -39,12 +38,12 @@ export class RawDebugSession implements debug.IRawSession {
private
debugAdapter
:
debug
.
IDebugAdapter
;
public
emittedStopped
:
boolean
;
public
initialised
:
boolean
;
public
readyForBreakpoints
:
boolean
;
private
cachedInitServerP
:
TPromise
<
void
>
;
private
startTime
:
number
;
public
disconnected
:
boolean
;
private
requestQueue
=
new
Queue
()
;
private
sentPromises
:
TPromise
<
DebugProtocol
.
Response
>
[]
;
private
_capabilities
:
DebugProtocol
.
Capabilities
;
private
allThreadsContinued
:
boolean
;
...
...
@@ -71,26 +70,9 @@ export class RawDebugSession implements debug.IRawSession {
@
IOutputService
private
outputService
:
IOutputService
)
{
this
.
emittedStopped
=
false
;
this
.
initialised
=
false
;
this
.
readyForBreakpoints
=
false
;
this
.
allThreadsContinued
=
true
;
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
.
sentPromises
=
[];
this
.
_onDidInitialize
=
new
Emitter
<
DebugProtocol
.
InitializedEvent
>
();
this
.
_onDidStop
=
new
Emitter
<
DebugProtocol
.
StoppedEvent
>
();
...
...
@@ -153,6 +135,24 @@ 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
.
requestQueue
.
queue
(()
=>
{
return
this
.
initServer
().
then
(()
=>
{
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,6 +208,9 @@ 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
;
});
}
...
...
@@ -230,7 +233,7 @@ export class RawDebugSession implements debug.IRawSession {
event
.
sessionId
=
this
.
id
;
if
(
event
.
event
===
'
initialized
'
)
{
this
.
initialised
=
true
;
this
.
readyForBreakpoints
=
true
;
this
.
_onDidInitialize
.
fire
(
event
);
}
else
if
(
event
.
event
===
'
capabilities
'
&&
event
.
body
)
{
const
capabilites
=
(
<
DebugProtocol
.
CapabilitiesEvent
>
event
).
body
.
capabilities
;
...
...
@@ -282,17 +285,7 @@ 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
;
...
...
@@ -300,7 +293,6 @@ 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
;
...
...
@@ -308,7 +300,6 @@ 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
;
...
...
@@ -316,7 +307,6 @@ 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
;
...
...
@@ -339,7 +329,6 @@ 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
;
...
...
@@ -351,12 +340,17 @@ 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
;
...
...
@@ -411,7 +405,6 @@ 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
);
...
...
@@ -421,7 +414,6 @@ 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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录