Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
HugeYuan
delve
提交
a0cffab8
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,发现更多精彩内容 >>
提交
a0cffab8
编写于
8月 28, 2015
作者:
D
Derek Parker
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Collect errors from defer in proc.next
上级
cf105863
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
24 addition
and
14 deletion
+24
-14
proc/proc.go
proc/proc.go
+24
-14
未找到文件。
proc/proc.go
浏览文件 @
a0cffab8
...
@@ -253,15 +253,30 @@ func (dbp *Process) Next() error {
...
@@ -253,15 +253,30 @@ func (dbp *Process) Next() error {
}
}
func
(
dbp
*
Process
)
next
()
(
err
error
)
{
func
(
dbp
*
Process
)
next
()
(
err
error
)
{
// Make sure we clean up the temp breakpoints created by thread.Next
defer
func
()
{
defer
dbp
.
clearTempBreakpoints
()
// Always halt process at end of this function.
herr
:=
dbp
.
Halt
()
// Make sure we clean up the temp breakpoints.
cerr
:=
dbp
.
clearTempBreakpoints
()
// If we already had an error, return it.
if
err
!=
nil
{
return
}
if
herr
!=
nil
{
err
=
herr
return
}
if
cerr
!=
nil
{
err
=
cerr
}
}()
// Set breakpoints for any goroutine that is currently
// Set breakpoints for any goroutine that is currently
// blocked trying to read from a channel. This is so that
// blocked trying to read from a channel. This is so that
// if control flow switches to that goroutine, we end up
// if control flow switches to that goroutine, we end up
// somewhere useful instead of in runtime code.
// somewhere useful instead of in runtime code.
if
_
,
err
:
=
dbp
.
setChanRecvBreakpoints
();
err
!=
nil
{
if
_
,
err
=
dbp
.
setChanRecvBreakpoints
();
err
!=
nil
{
return
err
return
}
}
// Get the goroutine for the current thread. We will
// Get the goroutine for the current thread. We will
...
@@ -272,11 +287,6 @@ func (dbp *Process) next() (err error) {
...
@@ -272,11 +287,6 @@ func (dbp *Process) next() (err error) {
return
err
return
err
}
}
// Make sure that we halt the process at the end of this
// function. We could get into a situation where we have
// started some, but not all threads.
defer
func
()
{
err
=
dbp
.
Halt
()
}()
var
goroutineExiting
bool
var
goroutineExiting
bool
if
err
=
dbp
.
CurrentThread
.
setNextBreakpoints
();
err
!=
nil
{
if
err
=
dbp
.
CurrentThread
.
setNextBreakpoints
();
err
!=
nil
{
switch
t
:=
err
.
(
type
)
{
switch
t
:=
err
.
(
type
)
{
...
@@ -284,13 +294,13 @@ func (dbp *Process) next() (err error) {
...
@@ -284,13 +294,13 @@ func (dbp *Process) next() (err error) {
case
GoroutineExitingError
:
case
GoroutineExitingError
:
goroutineExiting
=
t
.
goid
==
g
.
Id
goroutineExiting
=
t
.
goid
==
g
.
Id
default
:
default
:
return
err
return
}
}
}
}
for
_
,
th
:=
range
dbp
.
Threads
{
for
_
,
th
:=
range
dbp
.
Threads
{
if
err
:
=
th
.
Continue
();
err
!=
nil
{
if
err
=
th
.
Continue
();
err
!=
nil
{
return
err
return
}
}
}
}
...
@@ -308,7 +318,7 @@ func (dbp *Process) next() (err error) {
...
@@ -308,7 +318,7 @@ func (dbp *Process) next() (err error) {
// Check to see if the goroutine has switched to another
// Check to see if the goroutine has switched to another
// thread, if so make it the current thread.
// thread, if so make it the current thread.
if
dbp
.
CurrentThread
.
Id
!=
th
.
Id
{
if
dbp
.
CurrentThread
.
Id
!=
th
.
Id
{
if
err
:
=
dbp
.
SwitchThread
(
th
.
Id
);
err
!=
nil
{
if
err
=
dbp
.
SwitchThread
(
th
.
Id
);
err
!=
nil
{
return
err
return
err
}
}
}
}
...
@@ -317,7 +327,7 @@ func (dbp *Process) next() (err error) {
...
@@ -317,7 +327,7 @@ func (dbp *Process) next() (err error) {
// This thread was not running our goroutine.
// This thread was not running our goroutine.
// We continue it since our goroutine could
// We continue it since our goroutine could
// potentially be on this threads queue.
// potentially be on this threads queue.
if
err
:
=
th
.
Continue
();
err
!=
nil
{
if
err
=
th
.
Continue
();
err
!=
nil
{
return
err
return
err
}
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录