Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
1a344508
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,发现更多精彩内容 >>
提交
1a344508
编写于
2月 17, 2020
作者:
I
isidor
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
debug: make session shutdown private
上级
ce0ccef9
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
31 addition
and
32 deletion
+31
-32
src/vs/workbench/contrib/debug/browser/debugService.ts
src/vs/workbench/contrib/debug/browser/debugService.ts
+1
-4
src/vs/workbench/contrib/debug/browser/debugSession.ts
src/vs/workbench/contrib/debug/browser/debugSession.ts
+26
-10
src/vs/workbench/contrib/debug/common/debug.ts
src/vs/workbench/contrib/debug/common/debug.ts
+0
-3
src/vs/workbench/contrib/debug/common/debugModel.ts
src/vs/workbench/contrib/debug/common/debugModel.ts
+0
-9
src/vs/workbench/contrib/debug/test/browser/breakpoints.test.ts
.../workbench/contrib/debug/test/browser/breakpoints.test.ts
+1
-1
src/vs/workbench/contrib/debug/test/browser/callStack.test.ts
...vs/workbench/contrib/debug/test/browser/callStack.test.ts
+2
-2
src/vs/workbench/contrib/debug/test/common/mockDebug.ts
src/vs/workbench/contrib/debug/test/common/mockDebug.ts
+0
-2
src/vs/workbench/contrib/debug/test/electron-browser/debugANSIHandling.test.ts
...rib/debug/test/electron-browser/debugANSIHandling.test.ts
+1
-1
未找到文件。
src/vs/workbench/contrib/debug/browser/debugService.ts
浏览文件 @
1a344508
...
...
@@ -117,7 +117,6 @@ export class DebugService implements IDebugService {
this
.
model
=
new
DebugModel
(
this
.
loadBreakpoints
(),
this
.
loadFunctionBreakpoints
(),
this
.
loadExceptionBreakpoints
(),
this
.
loadDataBreakpoints
(),
this
.
loadWatchExpressions
(),
this
.
textFileService
);
this
.
toDispose
.
push
(
this
.
model
);
const
setBreakpointsExistContext
=
()
=>
this
.
breakpointsExist
.
set
(
!!
(
this
.
model
.
getBreakpoints
().
length
||
this
.
model
.
getDataBreakpoints
().
length
||
this
.
model
.
getFunctionBreakpoints
().
length
));
this
.
breakpointsExist
=
CONTEXT_BREAKPOINTS_EXIST
.
bindTo
(
contextKeyService
);
setBreakpointsExistContext
();
...
...
@@ -126,7 +125,7 @@ export class DebugService implements IDebugService {
this
.
taskRunner
=
this
.
instantiationService
.
createInstance
(
DebugTaskRunner
);
this
.
toDispose
.
push
(
this
.
fileService
.
onFileChanges
(
e
=>
this
.
onFileChanges
(
e
)));
this
.
lifecycleService
.
onShutdown
(
this
.
dispose
,
this
);
this
.
toDispose
.
push
(
this
.
lifecycleService
.
onShutdown
(
this
.
dispose
,
this
)
);
this
.
toDispose
.
push
(
this
.
extensionHostDebugService
.
onAttachSession
(
event
=>
{
const
session
=
this
.
model
.
getSession
(
event
.
sessionId
,
true
);
...
...
@@ -522,7 +521,6 @@ export class DebugService implements IDebugService {
await
this
.
focusStackFrame
(
undefined
,
undefined
,
session
);
}
}
catch
(
err
)
{
session
.
shutdown
();
if
(
this
.
viewModel
.
focusedSession
===
session
)
{
await
this
.
focusStackFrame
(
undefined
);
}
...
...
@@ -567,7 +565,6 @@ export class DebugService implements IDebugService {
this
.
notificationService
.
error
(
err
);
}
}
session
.
shutdown
();
this
.
endInitializingState
();
this
.
_onDidEndSession
.
fire
(
session
);
...
...
src/vs/workbench/contrib/debug/browser/debugSession.ts
浏览文件 @
1a344508
...
...
@@ -33,6 +33,7 @@ import { variableSetEmitter } from 'vs/workbench/contrib/debug/browser/variables
import
{
CancellationTokenSource
,
CancellationToken
}
from
'
vs/base/common/cancellation
'
;
import
{
distinct
}
from
'
vs/base/common/arrays
'
;
import
{
INotificationService
}
from
'
vs/platform/notification/common/notification
'
;
import
{
ILifecycleService
}
from
'
vs/platform/lifecycle/common/lifecycle
'
;
export
class
DebugSession
implements
IDebugSession
{
...
...
@@ -74,7 +75,8 @@ export class DebugSession implements IDebugSession {
@
IProductService
private
readonly
productService
:
IProductService
,
@
IExtensionHostDebugService
private
readonly
extensionHostDebugService
:
IExtensionHostDebugService
,
@
IOpenerService
private
readonly
openerService
:
IOpenerService
,
@
INotificationService
private
readonly
notificationService
:
INotificationService
@
INotificationService
private
readonly
notificationService
:
INotificationService
,
@
ILifecycleService
lifecycleService
:
ILifecycleService
)
{
this
.
id
=
generateUuid
();
this
.
_options
=
options
||
{};
...
...
@@ -83,7 +85,13 @@ export class DebugSession implements IDebugSession {
}
else
{
this
.
repl
=
(
this
.
parentSession
as
DebugSession
).
repl
;
}
this
.
repl
.
onDidChangeElements
(()
=>
this
.
_onDidChangeREPLElements
.
fire
());
const
toDispose
:
IDisposable
[]
=
[];
toDispose
.
push
(
this
.
repl
.
onDidChangeElements
(()
=>
this
.
_onDidChangeREPLElements
.
fire
()));
toDispose
.
push
(
lifecycleService
.
onShutdown
(()
=>
{
this
.
shutdown
();
dispose
(
toDispose
);
}));
}
getId
():
string
{
...
...
@@ -213,6 +221,7 @@ export class DebugSession implements IDebugSession {
}
catch
(
err
)
{
this
.
initialized
=
true
;
this
.
_onDidChangeState
.
fire
();
this
.
shutdown
();
throw
err
;
}
}
...
...
@@ -227,8 +236,12 @@ export class DebugSession implements IDebugSession {
// __sessionID only used for EH debugging (but we add it always for now...)
config
.
__sessionId
=
this
.
getId
();
await
this
.
raw
.
launchOrAttach
(
config
);
try
{
await
this
.
raw
.
launchOrAttach
(
config
);
}
catch
(
err
)
{
this
.
shutdown
();
throw
err
;
}
}
/**
...
...
@@ -892,19 +905,22 @@ export class DebugSession implements IDebugSession {
this
.
rawListeners
.
push
(
this
.
raw
.
onDidExitAdapter
(
event
=>
{
this
.
initialized
=
true
;
this
.
model
.
setBreakpointSessionData
(
this
.
getId
(),
this
.
capabilities
,
undefined
);
this
.
shutdown
();
this
.
_onDidEndAdapter
.
fire
(
event
);
}));
}
shutdown
():
void
{
// Disconnects and clears state. Session can be initialized again for a new connection.
private
shutdown
():
void
{
dispose
(
this
.
rawListeners
);
if
(
this
.
raw
)
{
this
.
raw
.
disconnect
();
this
.
raw
.
dispose
();
}
this
.
raw
=
undefined
;
this
.
fetchThreadsScheduler
=
undefined
;
this
.
model
.
clearThreads
(
this
.
getId
(),
true
);
if
(
this
.
raw
)
{
const
raw
=
this
.
raw
;
this
.
raw
=
undefined
;
raw
.
disconnect
();
raw
.
dispose
();
}
this
.
_onDidChangeState
.
fire
();
}
...
...
src/vs/workbench/contrib/debug/common/debug.ts
浏览文件 @
1a344508
...
...
@@ -200,9 +200,6 @@ export interface IDebugSession extends ITreeElement {
readonly
onDidLoadedSource
:
Event
<
LoadedSourceEvent
>
;
readonly
onDidCustomEvent
:
Event
<
DebugProtocol
.
Event
>
;
// Disconnects and clears state. Session can be initialized again for a new connection.
shutdown
():
void
;
// DAP request
initialize
(
dbgr
:
IDebugger
):
Promise
<
void
>
;
...
...
src/vs/workbench/contrib/debug/common/debugModel.ts
浏览文件 @
1a344508
...
...
@@ -6,7 +6,6 @@
import
*
as
nls
from
'
vs/nls
'
;
import
{
URI
as
uri
}
from
'
vs/base/common/uri
'
;
import
*
as
resources
from
'
vs/base/common/resources
'
;
import
*
as
lifecycle
from
'
vs/base/common/lifecycle
'
;
import
{
Event
,
Emitter
}
from
'
vs/base/common/event
'
;
import
{
generateUuid
}
from
'
vs/base/common/uuid
'
;
import
{
RunOnceScheduler
}
from
'
vs/base/common/async
'
;
...
...
@@ -819,7 +818,6 @@ export class ThreadAndSessionIds implements ITreeElement {
export
class
DebugModel
implements
IDebugModel
{
private
sessions
:
IDebugSession
[];
private
toDispose
:
lifecycle
.
IDisposable
[];
private
schedulers
=
new
Map
<
string
,
RunOnceScheduler
>
();
private
breakpointsActivated
=
true
;
private
readonly
_onDidChangeBreakpoints
=
new
Emitter
<
IBreakpointsChangeEvent
|
undefined
>
();
...
...
@@ -835,7 +833,6 @@ export class DebugModel implements IDebugModel {
private
textFileService
:
ITextFileService
)
{
this
.
sessions
=
[];
this
.
toDispose
=
[];
}
getId
():
string
{
...
...
@@ -1227,10 +1224,4 @@ export class DebugModel implements IDebugModel {
});
this
.
_onDidChangeCallStack
.
fire
(
undefined
);
}
dispose
():
void
{
// Make sure to shutdown each session, such that no debugged process is left laying around
this
.
sessions
.
forEach
(
s
=>
s
.
shutdown
());
this
.
toDispose
=
lifecycle
.
dispose
(
this
.
toDispose
);
}
}
src/vs/workbench/contrib/debug/test/browser/breakpoints.test.ts
浏览文件 @
1a344508
...
...
@@ -19,7 +19,7 @@ import { OverviewRulerLane } from 'vs/editor/common/model';
import
{
MarkdownString
}
from
'
vs/base/common/htmlContent
'
;
function
createMockSession
(
model
:
DebugModel
,
name
=
'
mockSession
'
,
options
?:
IDebugSessionOptions
):
DebugSession
{
return
new
DebugSession
({
resolved
:
{
name
,
type
:
'
node
'
,
request
:
'
launch
'
},
unresolved
:
undefined
},
undefined
!
,
model
,
options
,
undefined
!
,
undefined
!
,
undefined
!
,
undefined
!
,
undefined
!
,
undefined
!
,
undefined
!
,
undefined
!
,
NullOpenerService
,
undefined
!
);
return
new
DebugSession
({
resolved
:
{
name
,
type
:
'
node
'
,
request
:
'
launch
'
},
unresolved
:
undefined
},
undefined
!
,
model
,
options
,
undefined
!
,
undefined
!
,
undefined
!
,
undefined
!
,
undefined
!
,
undefined
!
,
undefined
!
,
undefined
!
,
NullOpenerService
,
undefined
!
,
undefined
!
);
}
function
addBreakpointsAndCheckEvents
(
model
:
DebugModel
,
uri
:
uri
,
data
:
IBreakpointData
[]):
void
{
...
...
src/vs/workbench/contrib/debug/test/browser/callStack.test.ts
浏览文件 @
1a344508
...
...
@@ -18,7 +18,7 @@ import { getContext, getContextForContributedActions } from 'vs/workbench/contri
import
{
getStackFrameThreadAndSessionToFocus
}
from
'
vs/workbench/contrib/debug/browser/debugService
'
;
export
function
createMockSession
(
model
:
DebugModel
,
name
=
'
mockSession
'
,
options
?:
IDebugSessionOptions
):
DebugSession
{
return
new
DebugSession
({
resolved
:
{
name
,
type
:
'
node
'
,
request
:
'
launch
'
},
unresolved
:
undefined
},
undefined
!
,
model
,
options
,
undefined
!
,
undefined
!
,
undefined
!
,
undefined
!
,
undefined
!
,
undefined
!
,
undefined
!
,
undefined
!
,
NullOpenerService
,
undefined
!
);
return
new
DebugSession
({
resolved
:
{
name
,
type
:
'
node
'
,
request
:
'
launch
'
},
unresolved
:
undefined
},
undefined
!
,
model
,
options
,
undefined
!
,
undefined
!
,
undefined
!
,
undefined
!
,
undefined
!
,
undefined
!
,
undefined
!
,
undefined
!
,
NullOpenerService
,
undefined
!
,
undefined
!
);
}
function
createTwoStackFrames
(
session
:
DebugSession
):
{
firstStackFrame
:
StackFrame
,
secondStackFrame
:
StackFrame
}
{
...
...
@@ -363,7 +363,7 @@ suite('Debug - CallStack', () => {
get
state
():
State
{
return
State
.
Stopped
;
}
}({
resolved
:
{
name
:
'
stoppedSession
'
,
type
:
'
node
'
,
request
:
'
launch
'
},
unresolved
:
undefined
},
undefined
!
,
model
,
undefined
,
undefined
!
,
undefined
!
,
undefined
!
,
undefined
!
,
undefined
!
,
undefined
!
,
undefined
!
,
undefined
!
,
NullOpenerService
,
undefined
!
);
}({
resolved
:
{
name
:
'
stoppedSession
'
,
type
:
'
node
'
,
request
:
'
launch
'
},
unresolved
:
undefined
},
undefined
!
,
model
,
undefined
,
undefined
!
,
undefined
!
,
undefined
!
,
undefined
!
,
undefined
!
,
undefined
!
,
undefined
!
,
undefined
!
,
NullOpenerService
,
undefined
!
,
undefined
!
);
const
runningSession
=
createMockSession
(
model
);
model
.
addSession
(
runningSession
);
...
...
src/vs/workbench/contrib/debug/test/common/mockDebug.ts
浏览文件 @
1a344508
...
...
@@ -327,8 +327,6 @@ export class MockSession implements IDebugSession {
goto
(
threadId
:
number
,
targetId
:
number
):
Promise
<
DebugProtocol
.
GotoResponse
>
{
throw
new
Error
(
'
Method not implemented.
'
);
}
shutdown
():
void
{
}
}
export
class
MockRawSession
{
...
...
src/vs/workbench/contrib/debug/test/electron-browser/debugANSIHandling.test.ts
浏览文件 @
1a344508
...
...
@@ -30,7 +30,7 @@ suite('Debug - ANSI Handling', () => {
*/
setup
(()
=>
{
model
=
new
DebugModel
([],
[],
[],
[],
[],
<
any
>
{
isDirty
:
(
e
:
any
)
=>
false
});
session
=
new
DebugSession
({
resolved
:
{
name
:
'
test
'
,
type
:
'
node
'
,
request
:
'
launch
'
},
unresolved
:
undefined
},
undefined
!
,
model
,
undefined
,
undefined
!
,
undefined
!
,
undefined
!
,
undefined
!
,
undefined
!
,
undefined
!
,
undefined
!
,
undefined
!
,
NullOpenerService
,
undefined
!
);
session
=
new
DebugSession
({
resolved
:
{
name
:
'
test
'
,
type
:
'
node
'
,
request
:
'
launch
'
},
unresolved
:
undefined
},
undefined
!
,
model
,
undefined
,
undefined
!
,
undefined
!
,
undefined
!
,
undefined
!
,
undefined
!
,
undefined
!
,
undefined
!
,
undefined
!
,
NullOpenerService
,
undefined
!
,
undefined
!
);
const
instantiationService
:
TestInstantiationService
=
<
TestInstantiationService
>
workbenchInstantiationService
();
linkDetector
=
instantiationService
.
createInstance
(
LinkDetector
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录