Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
HugeYuan
delve
提交
09798471
D
delve
项目概览
HugeYuan
/
delve
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
delve
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
未验证
提交
09798471
编写于
9月 09, 2021
作者:
S
Suzy Mueller
提交者:
GitHub
9月 09, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
service/dap: do not send a halt request if the debuggee is not running (#2686)
updates go-delve/delve#2685
上级
5d158820
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
64 addition
and
4 deletion
+64
-4
service/dap/server.go
service/dap/server.go
+6
-4
service/dap/server_test.go
service/dap/server_test.go
+58
-0
未找到文件。
service/dap/server.go
浏览文件 @
09798471
...
...
@@ -1568,10 +1568,12 @@ func (s *Server) doStepCommand(command string, threadId int, asyncSetupDone chan
// onPauseRequest handles 'pause' request.
// This is a mandatory request to support.
func
(
s
*
Server
)
onPauseRequest
(
request
*
dap
.
PauseRequest
)
{
_
,
err
:=
s
.
debugger
.
Command
(
&
api
.
DebuggerCommand
{
Name
:
api
.
Halt
},
nil
)
if
err
!=
nil
{
s
.
sendErrorResponse
(
request
.
Request
,
UnableToHalt
,
"Unable to halt execution"
,
err
.
Error
())
return
if
s
.
debugger
.
IsRunning
()
{
_
,
err
:=
s
.
debugger
.
Command
(
&
api
.
DebuggerCommand
{
Name
:
api
.
Halt
},
nil
)
if
err
!=
nil
{
s
.
sendErrorResponse
(
request
.
Request
,
UnableToHalt
,
"Unable to halt execution"
,
err
.
Error
())
return
}
}
s
.
send
(
&
dap
.
PauseResponse
{
Response
:
*
newResponse
(
request
.
Request
)})
// No need to send any event here.
...
...
service/dap/server_test.go
浏览文件 @
09798471
...
...
@@ -2296,6 +2296,64 @@ func TestSetBreakpoint(t *testing.T) {
})
}
func
TestPauseAtStop
(
t
*
testing
.
T
)
{
runTest
(
t
,
"loopprog"
,
func
(
client
*
daptest
.
Client
,
fixture
protest
.
Fixture
)
{
runDebugSessionWithBPs
(
t
,
client
,
"launch"
,
// Launch
func
()
{
client
.
LaunchRequest
(
"exec"
,
fixture
.
Path
,
!
stopOnEntry
)
},
// Set breakpoints
fixture
.
Source
,
[]
int
{
16
},
[]
onBreakpoint
{{
execute
:
func
()
{
checkStop
(
t
,
client
,
1
,
"main.main"
,
16
)
client
.
SetBreakpointsRequest
(
fixture
.
Source
,
[]
int
{
6
,
8
})
expectSetBreakpointsResponse
(
t
,
client
,
[]
Breakpoint
{{
6
,
fixture
.
Source
,
true
,
""
},
{
8
,
fixture
.
Source
,
true
,
""
}})
// Send a pause request while stopped on a cleared breakpoint.
client
.
PauseRequest
(
1
)
client
.
ExpectPauseResponse
(
t
)
client
.
ContinueRequest
(
1
)
client
.
ExpectContinueResponse
(
t
)
client
.
ExpectStoppedEvent
(
t
)
checkStop
(
t
,
client
,
1
,
"main.loop"
,
6
)
// Send a pause request while stopped on a breakpoint.
client
.
PauseRequest
(
1
)
client
.
ExpectPauseResponse
(
t
)
client
.
ContinueRequest
(
1
)
client
.
ExpectContinueResponse
(
t
)
se
:=
client
.
ExpectStoppedEvent
(
t
)
if
se
.
Body
.
Reason
!=
"breakpoint"
{
t
.
Errorf
(
"got %#v, expected breakpoint"
,
se
)
}
checkStop
(
t
,
client
,
1
,
"main.loop"
,
8
)
// Send a pause request while stopped after stepping.
client
.
NextRequest
(
1
)
client
.
ExpectNextResponse
(
t
)
client
.
ExpectStoppedEvent
(
t
)
checkStop
(
t
,
client
,
1
,
"main.loop"
,
9
)
client
.
PauseRequest
(
1
)
client
.
ExpectPauseResponse
(
t
)
client
.
ContinueRequest
(
1
)
client
.
ExpectContinueResponse
(
t
)
client
.
ExpectStoppedEvent
(
t
)
checkStop
(
t
,
client
,
1
,
"main.loop"
,
8
)
},
// The program has an infinite loop, so we must kill it by disconnecting.
disconnect
:
true
,
}})
})
}
func
checkHitBreakpointIds
(
t
*
testing
.
T
,
se
*
dap
.
StoppedEvent
,
reason
string
,
id
int
)
{
if
se
.
Body
.
ThreadId
!=
1
||
se
.
Body
.
Reason
!=
reason
||
len
(
se
.
Body
.
HitBreakpointIds
)
!=
1
||
se
.
Body
.
HitBreakpointIds
[
0
]
!=
id
{
t
.
Errorf
(
"got %#v, want Reason=%q, ThreadId=1, HitBreakpointIds=[]int{%d}"
,
se
,
reason
,
id
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录