Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
HugeYuan
delve
提交
b21686e6
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 搜索 >>
提交
b21686e6
编写于
11月 10, 2015
作者:
A
aarzilli
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
proc: Continue does not work with breakpoints set on NOP (OSX)
Fixes #262
上级
708cf2f2
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
58 addition
and
5 deletion
+58
-5
_fixtures/bpcountstest.go
_fixtures/bpcountstest.go
+1
-1
_fixtures/issue262.go
_fixtures/issue262.go
+16
-0
proc/proc_darwin.go
proc/proc_darwin.go
+8
-0
proc/proc_test.go
proc/proc_test.go
+22
-2
proc/threads_darwin.go
proc/threads_darwin.go
+11
-2
未找到文件。
_fixtures/bpcountstest.go
浏览文件 @
b21686e6
...
...
@@ -11,7 +11,7 @@ func demo(id int, wait *sync.WaitGroup) {
for
i
:=
0
;
i
<
100
;
i
++
{
sleep
:=
rand
.
Intn
(
10
)
+
1
fmt
.
Printf
(
"id: %d step: %d sleeping %d
\n
"
,
id
,
i
,
sleep
)
time
.
Sleep
(
time
.
Duration
(
sleep
)
*
time
.
Millisecond
)
time
.
Sleep
(
time
.
Duration
(
sleep
)
*
time
.
Millisecond
)
}
wait
.
Done
()
...
...
_fixtures/issue262.go
0 → 100644
浏览文件 @
b21686e6
package
main
import
"fmt"
func
typicalFunction
()
(
res
int
)
{
defer
func
()
{
res
=
2
return
}()
res
=
10
return
// setup breakpoint here
}
func
main
()
{
fmt
.
Println
(
typicalFunction
())
}
proc/proc_darwin.go
浏览文件 @
b21686e6
...
...
@@ -329,5 +329,13 @@ func (dbp *Process) wait(pid, options int) (int, *sys.WaitStatus, error) {
}
func
(
dbp
*
Process
)
exitGuard
(
err
error
)
error
{
if
err
!=
ErrContinueThread
{
return
err
}
_
,
status
,
werr
:=
dbp
.
wait
(
dbp
.
Pid
,
sys
.
WNOHANG
)
if
werr
==
nil
&&
status
.
Exited
()
{
dbp
.
postExit
()
return
ProcessExitedError
{
Pid
:
dbp
.
Pid
,
Status
:
status
.
ExitStatus
()}
}
return
err
}
proc/proc_test.go
浏览文件 @
b21686e6
...
...
@@ -953,7 +953,7 @@ func TestFrameEvaluation(t *testing.T) {
assertNoError
(
err
,
t
,
"setFunctionBreakpoint"
)
assertNoError
(
p
.
Continue
(),
t
,
"Continue()"
)
/
**** Testing evaluation on goroutines ****/
/
/ Testing evaluation on goroutines
gs
,
err
:=
p
.
GoroutinesInfo
()
assertNoError
(
err
,
t
,
"GoroutinesInfo"
)
found
:=
make
([]
bool
,
10
)
...
...
@@ -992,7 +992,7 @@ func TestFrameEvaluation(t *testing.T) {
}
}
/
**** Testing evaluation on frames ****/
/
/ Testing evaluation on frames
assertNoError
(
p
.
Continue
(),
t
,
"Continue() 2"
)
g
,
err
:=
p
.
CurrentThread
.
GetG
()
assertNoError
(
err
,
t
,
"GetG()"
)
...
...
@@ -1129,3 +1129,23 @@ func TestBreakpointCounts(t *testing.T) {
}
})
}
func
TestIssue262
(
t
*
testing
.
T
)
{
// Continue does not work when the current breakpoint is set on a NOP instruction
withTestProcess
(
"issue262"
,
t
,
func
(
p
*
Process
,
fixture
protest
.
Fixture
)
{
addr
,
_
,
err
:=
p
.
goSymTable
.
LineToPC
(
fixture
.
Source
,
11
)
assertNoError
(
err
,
t
,
"LineToPC"
)
_
,
err
=
p
.
SetBreakpoint
(
addr
)
assertNoError
(
err
,
t
,
"SetBreakpoint()"
)
assertNoError
(
p
.
Continue
(),
t
,
"Continue()"
)
err
=
p
.
Continue
()
if
err
==
nil
{
t
.
Fatalf
(
"No error on second continue"
)
}
_
,
exited
:=
err
.
(
ProcessExitedError
)
if
!
exited
{
t
.
Fatalf
(
"Process did not exit after second continue: %v"
,
err
)
}
})
}
proc/threads_darwin.go
浏览文件 @
b21686e6
package
proc
// #include "threads_darwin.h"
// #include "proc_darwin.h"
import
"C"
import
(
"fmt"
...
...
@@ -12,6 +13,8 @@ type OSSpecificDetails struct {
registers
C
.
x86_thread_state64_t
}
var
ErrContinueThread
=
fmt
.
Errorf
(
"could not continue thread"
)
func
(
t
*
Thread
)
halt
()
(
err
error
)
{
kret
:=
C
.
thread_suspend
(
t
.
os
.
thread_act
)
if
kret
!=
C
.
KERN_SUCCESS
{
...
...
@@ -27,7 +30,13 @@ func (t *Thread) singleStep() error {
if
kret
!=
C
.
KERN_SUCCESS
{
return
fmt
.
Errorf
(
"could not single step"
)
}
t
.
dbp
.
trapWait
(
0
)
for
{
port
:=
C
.
mach_port_wait
(
t
.
dbp
.
os
.
portSet
)
if
port
==
C
.
mach_port_t
(
t
.
Id
)
{
break
}
}
kret
=
C
.
clear_trap_flag
(
t
.
os
.
thread_act
)
if
kret
!=
C
.
KERN_SUCCESS
{
return
fmt
.
Errorf
(
"could not clear CPU trap flag"
)
...
...
@@ -45,7 +54,7 @@ func (t *Thread) resume() error {
}
kret
:=
C
.
resume_thread
(
t
.
os
.
thread_act
)
if
kret
!=
C
.
KERN_SUCCESS
{
return
fmt
.
Errorf
(
"could not continue thread"
)
return
ErrContinueThread
}
return
nil
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录