Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
57106501
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,发现更多精彩内容 >>
提交
57106501
编写于
5月 03, 2016
作者:
I
isidor
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
debug: do not fabricate fake 'continued' event
上级
8334c894
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
123 addition
and
93 deletion
+123
-93
src/vs/workbench/parts/debug/common/debug.ts
src/vs/workbench/parts/debug/common/debug.ts
+6
-6
src/vs/workbench/parts/debug/electron-browser/debugActions.ts
...vs/workbench/parts/debug/electron-browser/debugActions.ts
+6
-6
src/vs/workbench/parts/debug/electron-browser/debugService.ts
...vs/workbench/parts/debug/electron-browser/debugService.ts
+85
-22
src/vs/workbench/parts/debug/node/rawDebugSession.ts
src/vs/workbench/parts/debug/node/rawDebugSession.ts
+6
-39
src/vs/workbench/parts/debug/test/common/mockDebugService.ts
src/vs/workbench/parts/debug/test/common/mockDebugService.ts
+20
-20
未找到文件。
src/vs/workbench/parts/debug/common/debug.ts
浏览文件 @
57106501
...
...
@@ -239,12 +239,6 @@ export interface IRawDebugSession {
disconnect
(
restart
?:
boolean
,
force
?:
boolean
):
TPromise
<
DebugProtocol
.
DisconnectResponse
>
;
next
(
args
:
DebugProtocol
.
NextArguments
):
TPromise
<
DebugProtocol
.
NextResponse
>
;
stepIn
(
args
:
DebugProtocol
.
StepInArguments
):
TPromise
<
DebugProtocol
.
StepInResponse
>
;
stepOut
(
args
:
DebugProtocol
.
StepOutArguments
):
TPromise
<
DebugProtocol
.
StepOutResponse
>
;
continue
(
args
:
DebugProtocol
.
ContinueArguments
):
TPromise
<
DebugProtocol
.
ContinueResponse
>
;
pause
(
args
:
DebugProtocol
.
PauseArguments
):
TPromise
<
DebugProtocol
.
PauseResponse
>
;
stackTrace
(
args
:
DebugProtocol
.
StackTraceArguments
):
TPromise
<
DebugProtocol
.
StackTraceResponse
>
;
scopes
(
args
:
DebugProtocol
.
ScopesArguments
):
TPromise
<
DebugProtocol
.
ScopesResponse
>
;
variables
(
args
:
DebugProtocol
.
VariablesArguments
):
TPromise
<
DebugProtocol
.
VariablesResponse
>
;
...
...
@@ -402,6 +396,12 @@ export interface IDebugService {
* Opens a new or reveals an already visible editor showing the source.
*/
openOrRevealSource
(
source
:
Source
,
lineNumber
:
number
,
preserveFocus
:
boolean
,
sideBySide
:
boolean
):
TPromise
<
any
>
;
next
(
threadId
:
number
):
TPromise
<
void
>
;
stepIn
(
threadId
:
number
):
TPromise
<
void
>
;
stepOut
(
threadId
:
number
):
TPromise
<
void
>
;
continue
(
threadId
:
number
):
TPromise
<
void
>
;
pause
(
threadId
:
number
):
TPromise
<
any
>
;
}
// Editor interfaces
...
...
src/vs/workbench/parts/debug/electron-browser/debugActions.ts
浏览文件 @
57106501
...
...
@@ -160,7 +160,7 @@ export class StepOverDebugAction extends AbstractDebugAction {
}
public
run
():
TPromise
<
any
>
{
return
this
.
debugService
.
getActiveSession
().
next
({
threadId
:
this
.
debugService
.
getViewModel
().
getFocusedThreadId
()
}
);
return
this
.
debugService
.
next
(
this
.
debugService
.
getViewModel
().
getFocusedThreadId
()
);
}
protected
isEnabled
(
state
:
debug
.
State
):
boolean
{
...
...
@@ -177,7 +177,7 @@ export class StepIntoDebugAction extends AbstractDebugAction {
}
public
run
():
TPromise
<
any
>
{
return
this
.
debugService
.
getActiveSession
().
stepIn
({
threadId
:
this
.
debugService
.
getViewModel
().
getFocusedThreadId
()
}
);
return
this
.
debugService
.
stepIn
(
this
.
debugService
.
getViewModel
().
getFocusedThreadId
()
);
}
protected
isEnabled
(
state
:
debug
.
State
):
boolean
{
...
...
@@ -194,7 +194,7 @@ export class StepOutDebugAction extends AbstractDebugAction {
}
public
run
():
TPromise
<
any
>
{
return
this
.
debugService
.
getActiveSession
().
stepOut
({
threadId
:
this
.
debugService
.
getViewModel
().
getFocusedThreadId
()
}
);
return
this
.
debugService
.
stepOut
(
this
.
debugService
.
getViewModel
().
getFocusedThreadId
()
);
}
protected
isEnabled
(
state
:
debug
.
State
):
boolean
{
...
...
@@ -236,7 +236,7 @@ export class ContinueAction extends AbstractDebugAction {
}
public
run
():
TPromise
<
any
>
{
return
this
.
debugService
.
getActiveSession
().
continue
({
threadId
:
this
.
debugService
.
getViewModel
().
getFocusedThreadId
()
}
);
return
this
.
debugService
.
continue
(
this
.
debugService
.
getViewModel
().
getFocusedThreadId
()
);
}
protected
isEnabled
(
state
:
debug
.
State
):
boolean
{
...
...
@@ -253,7 +253,7 @@ export class PauseAction extends AbstractDebugAction {
}
public
run
():
TPromise
<
any
>
{
return
this
.
debugService
.
getActiveSession
().
pause
({
threadId
:
this
.
debugService
.
getViewModel
().
getFocusedThreadId
()
}
);
return
this
.
debugService
.
pause
(
this
.
debugService
.
getViewModel
().
getFocusedThreadId
()
);
}
protected
isEnabled
(
state
:
debug
.
State
):
boolean
{
...
...
@@ -543,7 +543,7 @@ export class RunToCursorAction extends EditorAction {
});
return
this
.
debugService
.
addBreakpoints
([{
uri
,
lineNumber
}]).
then
(()
=>
{
this
.
debugService
.
getActiveSession
().
continue
({
threadId
:
this
.
debugService
.
getViewModel
().
getFocusedThreadId
()
}
);
this
.
debugService
.
continue
(
this
.
debugService
.
getViewModel
().
getFocusedThreadId
()
);
});
}
...
...
src/vs/workbench/parts/debug/electron-browser/debugService.ts
浏览文件 @
57106501
...
...
@@ -267,28 +267,6 @@ export class DebugService implements debug.IDebugService {
},
errors
.
onUnexpectedError
);
}));
this
.
toDisposeOnSessionEnd
.
push
(
this
.
session
.
onDidContinue
(
threadID
=>
{
aria
.
status
(
nls
.
localize
(
'
debuggingContinued
'
,
"
Debugging continued.
"
));
// TODO@Isidor temporary workaround for #5835
if
(
strings
.
equalsIgnoreCase
(
this
.
session
.
configuration
.
type
,
'
go
'
))
{
this
.
model
.
clearThreads
(
false
);
}
else
{
this
.
model
.
clearThreads
(
false
,
threadID
);
}
// Get a top stack frame of a stopped thread if there is any.
const
threads
=
this
.
model
.
getThreads
();
const
stoppedReference
=
Object
.
keys
(
threads
).
filter
(
ref
=>
threads
[
ref
].
stopped
).
pop
();
const
stoppedThread
=
stoppedReference
?
threads
[
parseInt
(
stoppedReference
)]
:
null
;
const
callStack
=
stoppedThread
?
stoppedThread
.
getCachedCallStack
()
:
null
;
const
stackFrameToFocus
=
callStack
&&
callStack
.
length
>
0
?
callStack
[
0
]
:
null
;
this
.
setFocusedStackFrameAndEvaluate
(
stackFrameToFocus
).
done
(
null
,
errors
.
onUnexpectedError
);
if
(
!
stoppedThread
)
{
this
.
setStateAndEmit
(
this
.
configurationManager
.
configuration
.
noDebug
?
debug
.
State
.
RunningNoDebug
:
debug
.
State
.
Running
);
}
}));
this
.
toDisposeOnSessionEnd
.
push
(
this
.
session
.
onDidThread
(
event
=>
{
if
(
event
.
body
.
reason
===
'
started
'
)
{
this
.
getThreadData
().
done
(
null
,
errors
.
onUnexpectedError
);
...
...
@@ -811,6 +789,91 @@ export class DebugService implements debug.IDebugService {
return
this
.
configurationManager
;
}
public
next
(
threadId
:
number
):
TPromise
<
void
>
{
if
(
!
this
.
session
)
{
return
TPromise
.
as
(
null
);
}
return
this
.
session
.
next
({
threadId
}).
then
(()
=>
{
this
.
lazyTransitionToRunningState
(
threadId
);
});
}
public
stepIn
(
threadId
:
number
):
TPromise
<
void
>
{
if
(
!
this
.
session
)
{
return
TPromise
.
as
(
null
);
}
return
this
.
session
.
stepIn
({
threadId
}).
then
(()
=>
{
this
.
lazyTransitionToRunningState
(
threadId
);
});
}
public
stepOut
(
threadId
:
number
):
TPromise
<
void
>
{
if
(
!
this
.
session
)
{
return
TPromise
.
as
(
null
);
}
return
this
.
session
.
stepOut
({
threadId
}).
then
(()
=>
{
this
.
lazyTransitionToRunningState
(
threadId
);
});
}
public
continue
(
threadId
:
number
):
TPromise
<
void
>
{
if
(
!
this
.
session
)
{
return
TPromise
.
as
(
null
);
}
return
this
.
session
.
continue
({
threadId
}).
then
(()
=>
{
this
.
lazyTransitionToRunningState
(
threadId
);
});
}
public
pause
(
threadId
:
number
):
TPromise
<
any
>
{
if
(
!
this
.
session
)
{
return
TPromise
.
as
(
null
);
}
return
this
.
session
.
pause
({
threadId
}
);
}
private
lazyTransitionToRunningState
(
threadId
:
number
):
void
{
let
cancelTransitionToRunningState
=
false
;
const
toDispose
=
this
.
session
.
onDidStop
(
e
=>
{
if
(
e
.
body
.
threadId
===
threadId
||
e
.
body
.
allThreadsStopped
)
{
cancelTransitionToRunningState
=
true
;
}
});
// Do not immediatly transition to running state since that might cause unnecessery flickering
// of the tree in the debug viewlet. Only transition if no stopped event has arrived in 500ms.
setTimeout
(()
=>
{
toDispose
.
dispose
();
if
(
!
cancelTransitionToRunningState
)
{
aria
.
status
(
nls
.
localize
(
'
debuggingContinued
'
,
"
Debugging continued.
"
));
// TODO@Isidor temporary workaround for #5835
if
(
strings
.
equalsIgnoreCase
(
this
.
session
.
configuration
.
type
,
'
go
'
))
{
this
.
model
.
clearThreads
(
false
);
}
else
{
this
.
model
.
clearThreads
(
false
,
threadId
);
}
// Get a top stack frame of a stopped thread if there is any.
const
threads
=
this
.
model
.
getThreads
();
const
stoppedReference
=
Object
.
keys
(
threads
).
filter
(
ref
=>
threads
[
ref
].
stopped
).
pop
();
const
stoppedThread
=
stoppedReference
?
threads
[
parseInt
(
stoppedReference
)]
:
null
;
const
callStack
=
stoppedThread
?
stoppedThread
.
getCachedCallStack
()
:
null
;
const
stackFrameToFocus
=
callStack
&&
callStack
.
length
>
0
?
callStack
[
0
]
:
null
;
this
.
setFocusedStackFrameAndEvaluate
(
stackFrameToFocus
).
done
(
null
,
errors
.
onUnexpectedError
);
if
(
!
stoppedThread
)
{
this
.
setStateAndEmit
(
this
.
configurationManager
.
configuration
.
noDebug
?
debug
.
State
.
RunningNoDebug
:
debug
.
State
.
Running
);
}
}
},
500
);
}
private
getDebugStringEditorInput
(
source
:
Source
,
value
:
string
,
mtype
:
string
):
DebugStringEditorInput
{
const
filtered
=
this
.
debugStringEditorInputs
.
filter
(
input
=>
input
.
getResource
().
toString
()
===
source
.
uri
.
toString
());
...
...
src/vs/workbench/parts/debug/node/rawDebugSession.ts
浏览文件 @
57106501
...
...
@@ -42,8 +42,6 @@ export class RawDebugSession extends v8.V8Protocol implements debug.IRawDebugSes
public
emittedStopped
:
boolean
;
public
readyForBreakpoints
:
boolean
;
private
lastThreadId
:
number
;
private
flowEventsCount
:
number
;
private
serverProcess
:
cp
.
ChildProcess
;
private
socket
:
net
.
Socket
=
null
;
private
cachedInitServer
:
TPromise
<
void
>
;
...
...
@@ -57,7 +55,6 @@ export class RawDebugSession extends v8.V8Protocol implements debug.IRawDebugSes
private
_onDidStop
:
Emitter
<
DebugProtocol
.
StoppedEvent
>
;
private
_onDidTerminateDebugee
:
Emitter
<
SessionTerminatedEvent
>
;
private
_onDidExitAdapter
:
Emitter
<
SessionExitedEvent
>
;
private
_onDidContinue
:
Emitter
<
number
>
;
private
_onDidThread
:
Emitter
<
DebugProtocol
.
ThreadEvent
>
;
private
_onDidOutput
:
Emitter
<
DebugProtocol
.
OutputEvent
>
;
private
_onDidBreakpoint
:
Emitter
<
DebugProtocol
.
BreakpointEvent
>
;
...
...
@@ -71,7 +68,6 @@ export class RawDebugSession extends v8.V8Protocol implements debug.IRawDebugSes
private
telemtryAdapter
:
AIAdapter
)
{
super
();
this
.
flowEventsCount
=
0
;
this
.
emittedStopped
=
false
;
this
.
readyForBreakpoints
=
false
;
this
.
sentPromises
=
[];
...
...
@@ -80,7 +76,6 @@ export class RawDebugSession extends v8.V8Protocol implements debug.IRawDebugSes
this
.
_onDidStop
=
new
Emitter
<
DebugProtocol
.
StoppedEvent
>
();
this
.
_onDidTerminateDebugee
=
new
Emitter
<
SessionTerminatedEvent
>
();
this
.
_onDidExitAdapter
=
new
Emitter
<
SessionExitedEvent
>
();
this
.
_onDidContinue
=
new
Emitter
<
number
>
();
this
.
_onDidThread
=
new
Emitter
<
DebugProtocol
.
ThreadEvent
>
();
this
.
_onDidOutput
=
new
Emitter
<
DebugProtocol
.
OutputEvent
>
();
this
.
_onDidBreakpoint
=
new
Emitter
<
DebugProtocol
.
BreakpointEvent
>
();
...
...
@@ -103,10 +98,6 @@ export class RawDebugSession extends v8.V8Protocol implements debug.IRawDebugSes
return
this
.
_onDidExitAdapter
.
event
;
}
public
get
onDidContinue
():
Event
<
number
>
{
return
this
.
_onDidContinue
.
event
;
}
public
get
onDidThread
():
Event
<
DebugProtocol
.
ThreadEvent
>
{
return
this
.
_onDidThread
.
event
;
}
...
...
@@ -182,7 +173,6 @@ export class RawDebugSession extends v8.V8Protocol implements debug.IRawDebugSes
this
.
_onDidInitialize
.
fire
(
event
);
}
else
if
(
event
.
event
===
'
stopped
'
)
{
this
.
emittedStopped
=
true
;
this
.
flowEventsCount
++
;
this
.
_onDidStop
.
fire
(
<
DebugProtocol
.
StoppedEvent
>
event
);
}
else
if
(
event
.
event
===
'
thread
'
)
{
this
.
_onDidThread
.
fire
(
<
DebugProtocol
.
ThreadEvent
>
event
);
...
...
@@ -191,15 +181,9 @@ export class RawDebugSession extends v8.V8Protocol implements debug.IRawDebugSes
}
else
if
(
event
.
event
===
'
breakpoint
'
)
{
this
.
_onDidBreakpoint
.
fire
(
<
DebugProtocol
.
BreakpointEvent
>
event
);
}
else
if
(
event
.
event
===
'
terminated
'
)
{
this
.
flowEventsCount
++
;
this
.
_onDidTerminateDebugee
.
fire
(
<
SessionTerminatedEvent
>
event
);
}
else
if
(
event
.
event
===
'
exit
'
)
{
this
.
flowEventsCount
++
;
this
.
_onDidExitAdapter
.
fire
(
<
SessionExitedEvent
>
event
);
}
else
if
(
event
.
event
===
'
continued
'
)
{
// TODO@Isidor continued event needs to come from the adapter
this
.
flowEventsCount
++
;
this
.
_onDidContinue
.
fire
(
this
.
lastThreadId
);
}
this
.
_onDidEvent
.
fire
(
event
);
...
...
@@ -222,45 +206,28 @@ export class RawDebugSession extends v8.V8Protocol implements debug.IRawDebugSes
public
launch
(
args
:
DebugProtocol
.
LaunchRequestArguments
):
TPromise
<
DebugProtocol
.
LaunchResponse
>
{
this
.
isAttach
=
false
;
return
this
.
send
AndLazyContinue
(
'
launch
'
,
args
);
return
this
.
send
(
'
launch
'
,
args
);
}
public
attach
(
args
:
DebugProtocol
.
AttachRequestArguments
):
TPromise
<
DebugProtocol
.
AttachResponse
>
{
this
.
isAttach
=
true
;
return
this
.
send
AndLazyContinue
(
'
attach
'
,
args
);
return
this
.
send
(
'
attach
'
,
args
);
}
public
next
(
args
:
DebugProtocol
.
NextArguments
):
TPromise
<
DebugProtocol
.
NextResponse
>
{
return
this
.
send
AndLazyContinue
(
'
next
'
,
args
);
return
this
.
send
(
'
next
'
,
args
);
}
public
stepIn
(
args
:
DebugProtocol
.
StepInArguments
):
TPromise
<
DebugProtocol
.
StepInResponse
>
{
return
this
.
send
AndLazyContinue
(
'
stepIn
'
,
args
);
return
this
.
send
(
'
stepIn
'
,
args
);
}
public
stepOut
(
args
:
DebugProtocol
.
StepOutArguments
):
TPromise
<
DebugProtocol
.
StepOutResponse
>
{
return
this
.
send
AndLazyContinue
(
'
stepOut
'
,
args
);
return
this
.
send
(
'
stepOut
'
,
args
);
}
public
continue
(
args
:
DebugProtocol
.
ContinueArguments
):
TPromise
<
DebugProtocol
.
ContinueResponse
>
{
return
this
.
sendAndLazyContinue
(
'
continue
'
,
args
);
}
// node sometimes sends "stopped" events earlier than the response for the "step" request.
// due to this we only emit "continued" if we did not miss a stopped event.
// we do not emit straight away to reduce viewlet flickering.
private
sendAndLazyContinue
(
command
:
string
,
args
:
any
):
TPromise
<
DebugProtocol
.
Response
>
{
const
count
=
this
.
flowEventsCount
;
this
.
lastThreadId
=
args
.
threadId
;
return
this
.
send
(
command
,
args
).
then
(
response
=>
{
setTimeout
(()
=>
{
if
(
this
.
flowEventsCount
===
count
)
{
this
.
onEvent
({
event
:
'
continued
'
,
type
:
'
event
'
,
seq
:
0
});
}
},
500
);
return
response
;
});
return
this
.
send
(
'
continue
'
,
args
);
}
public
pause
(
args
:
DebugProtocol
.
PauseArguments
):
TPromise
<
DebugProtocol
.
PauseResponse
>
{
...
...
src/vs/workbench/parts/debug/test/common/mockDebugService.ts
浏览文件 @
57106501
...
...
@@ -102,6 +102,26 @@ export class MockDebugService implements debug.IDebugService {
public
openOrRevealSource
(
source
:
Source
,
lineNumber
:
number
,
preserveFocus
:
boolean
,
sideBySide
:
boolean
):
TPromise
<
any
>
{
return
TPromise
.
as
(
null
);
}
public
next
(
threadId
:
number
):
TPromise
<
void
>
{
return
TPromise
.
as
(
null
);
}
public
stepIn
(
threadId
:
number
):
TPromise
<
void
>
{
return
TPromise
.
as
(
null
);
}
public
stepOut
(
threadId
:
number
):
TPromise
<
void
>
{
return
TPromise
.
as
(
null
);
}
public
continue
(
threadId
:
number
):
TPromise
<
void
>
{
return
TPromise
.
as
(
null
);
}
public
pause
(
threadId
:
number
):
TPromise
<
any
>
{
return
TPromise
.
as
(
null
);
}
}
...
...
@@ -131,26 +151,6 @@ class MockRawSession implements debug.IRawDebugSession {
return
TPromise
.
as
(
null
);
}
public
next
(
args
:
DebugProtocol
.
NextArguments
):
TPromise
<
DebugProtocol
.
NextResponse
>
{
return
TPromise
.
as
(
null
);
}
public
stepIn
(
args
:
DebugProtocol
.
StepInArguments
):
TPromise
<
DebugProtocol
.
StepInResponse
>
{
return
TPromise
.
as
(
null
);
}
public
stepOut
(
args
:
DebugProtocol
.
StepOutArguments
):
TPromise
<
DebugProtocol
.
StepOutResponse
>
{
return
TPromise
.
as
(
null
);
}
public
continue
(
args
:
DebugProtocol
.
ContinueArguments
):
TPromise
<
DebugProtocol
.
ContinueResponse
>
{
return
TPromise
.
as
(
null
);
}
public
pause
(
args
:
DebugProtocol
.
PauseArguments
):
TPromise
<
DebugProtocol
.
PauseResponse
>
{
return
TPromise
.
as
(
null
);
}
public
stackTrace
(
args
:
DebugProtocol
.
StackTraceArguments
):
TPromise
<
DebugProtocol
.
StackTraceResponse
>
{
return
TPromise
.
as
({
body
:
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录