Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
pubx
delve
提交
047a91af
D
delve
项目概览
pubx
/
delve
通知
0
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
delve
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
047a91af
编写于
4月 24, 2015
作者:
D
Derek Parker
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Improve 'next' algorithm
上级
16064ce6
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
18 addition
and
14 deletion
+18
-14
proctl/proctl.go
proctl/proctl.go
+18
-14
未找到文件。
proctl/proctl.go
浏览文件 @
047a91af
...
@@ -240,9 +240,6 @@ func (dbp *DebuggedProcess) Status() *sys.WaitStatus {
...
@@ -240,9 +240,6 @@ func (dbp *DebuggedProcess) Status() *sys.WaitStatus {
// Step over function calls.
// Step over function calls.
func
(
dbp
*
DebuggedProcess
)
Next
()
error
{
func
(
dbp
*
DebuggedProcess
)
Next
()
error
{
if
err
:=
dbp
.
setChanRecvBreakpoints
();
err
!=
nil
{
return
err
}
return
dbp
.
run
(
dbp
.
next
)
return
dbp
.
run
(
dbp
.
next
)
}
}
...
@@ -250,12 +247,18 @@ func (dbp *DebuggedProcess) next() error {
...
@@ -250,12 +247,18 @@ func (dbp *DebuggedProcess) next() error {
// Make sure we clean up the temp breakpoints created by thread.Next
// Make sure we clean up the temp breakpoints created by thread.Next
defer
dbp
.
clearTempBreakpoints
()
defer
dbp
.
clearTempBreakpoints
()
chanRecvCount
,
err
:=
dbp
.
setChanRecvBreakpoints
()
if
err
!=
nil
{
return
err
}
curg
,
err
:=
dbp
.
CurrentThread
.
curG
()
curg
,
err
:=
dbp
.
CurrentThread
.
curG
()
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
}
}
var
goroutineExiting
bool
var
goroutineExiting
bool
var
waitCount
int
for
_
,
th
:=
range
dbp
.
Threads
{
for
_
,
th
:=
range
dbp
.
Threads
{
if
th
.
blocked
()
{
// Continue threads that aren't running go code.
if
th
.
blocked
()
{
// Continue threads that aren't running go code.
if
err
=
th
.
Continue
();
err
!=
nil
{
if
err
=
th
.
Continue
();
err
!=
nil
{
...
@@ -263,8 +266,10 @@ func (dbp *DebuggedProcess) next() error {
...
@@ -263,8 +266,10 @@ func (dbp *DebuggedProcess) next() error {
}
}
continue
continue
}
}
waitCount
++
if
err
=
th
.
Next
();
err
!=
nil
{
if
err
=
th
.
Next
();
err
!=
nil
{
if
err
,
ok
:=
err
.
(
GoroutineExitingError
);
ok
{
if
err
,
ok
:=
err
.
(
GoroutineExitingError
);
ok
{
waitCount
=
waitCount
-
1
+
chanRecvCount
if
err
.
goid
==
curg
.
Id
{
if
err
.
goid
==
curg
.
Id
{
goroutineExiting
=
true
goroutineExiting
=
true
}
}
...
@@ -277,7 +282,7 @@ func (dbp *DebuggedProcess) next() error {
...
@@ -277,7 +282,7 @@ func (dbp *DebuggedProcess) next() error {
}
}
}
}
for
{
for
waitCount
>
0
{
thread
,
err
:=
dbp
.
trapWait
(
-
1
)
thread
,
err
:=
dbp
.
trapWait
(
-
1
)
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
...
@@ -291,32 +296,31 @@ func (dbp *DebuggedProcess) next() error {
...
@@ -291,32 +296,31 @@ func (dbp *DebuggedProcess) next() error {
if
dbp
.
CurrentThread
!=
thread
{
if
dbp
.
CurrentThread
!=
thread
{
dbp
.
SwitchThread
(
thread
.
Id
)
dbp
.
SwitchThread
(
thread
.
Id
)
}
}
if
err
=
dbp
.
Halt
();
err
!=
nil
{
return
err
}
break
}
}
waitCount
--
}
}
return
nil
return
dbp
.
Halt
()
}
}
func
(
dbp
*
DebuggedProcess
)
setChanRecvBreakpoints
()
error
{
func
(
dbp
*
DebuggedProcess
)
setChanRecvBreakpoints
()
(
int
,
error
)
{
var
count
int
allg
,
err
:=
dbp
.
GoroutinesInfo
()
allg
,
err
:=
dbp
.
GoroutinesInfo
()
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
0
,
err
}
}
for
_
,
g
:=
range
allg
{
for
_
,
g
:=
range
allg
{
if
g
.
ChanRecvBlocked
()
{
if
g
.
ChanRecvBlocked
()
{
ret
,
err
:=
g
.
chanRecvReturnAddr
(
dbp
)
ret
,
err
:=
g
.
chanRecvReturnAddr
(
dbp
)
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
0
,
err
}
}
if
_
,
err
=
dbp
.
TempBreak
(
ret
);
err
!=
nil
{
if
_
,
err
=
dbp
.
TempBreak
(
ret
);
err
!=
nil
{
return
err
return
0
,
err
}
}
count
++
}
}
}
}
return
nil
return
count
,
nil
}
}
// Resume process.
// Resume process.
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录