Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
pubx
delve
提交
5714aa54
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,发现更多精彩内容 >>
提交
5714aa54
编写于
6月 21, 2016
作者:
A
aarzilli
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
proc: cleanup: attach FDE to Stackframe structure
上级
9d70adf5
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
12 addition
and
17 deletion
+12
-17
proc/stack.go
proc/stack.go
+5
-1
proc/threads.go
proc/threads.go
+7
-16
未找到文件。
proc/stack.go
浏览文件 @
5714aa54
...
@@ -23,7 +23,11 @@ type Stackframe struct {
...
@@ -23,7 +23,11 @@ type Stackframe struct {
Current
Location
Current
Location
// Address of the call instruction for the function above on the call stack.
// Address of the call instruction for the function above on the call stack.
Call
Location
Call
Location
// Start address of the stack frame.
CFA
int64
CFA
int64
// Description of the stack frame.
FDE
*
frame
.
FrameDescriptionEntry
// Return address for this stack frame (as read from the stack frame itself).
Ret
uint64
Ret
uint64
}
}
...
@@ -179,7 +183,7 @@ func (dbp *Process) frameInfo(pc, sp uint64, top bool) (Stackframe, error) {
...
@@ -179,7 +183,7 @@ func (dbp *Process) frameInfo(pc, sp uint64, top bool) (Stackframe, error) {
if
err
!=
nil
{
if
err
!=
nil
{
return
Stackframe
{},
err
return
Stackframe
{},
err
}
}
r
:=
Stackframe
{
Current
:
Location
{
PC
:
pc
,
File
:
f
,
Line
:
l
,
Fn
:
fn
},
CFA
:
cfa
,
Ret
:
binary
.
LittleEndian
.
Uint64
(
data
)}
r
:=
Stackframe
{
Current
:
Location
{
PC
:
pc
,
File
:
f
,
Line
:
l
,
Fn
:
fn
},
CFA
:
cfa
,
FDE
:
fde
,
Ret
:
binary
.
LittleEndian
.
Uint64
(
data
)}
if
!
top
{
if
!
top
{
r
.
Call
.
File
,
r
.
Call
.
Line
,
r
.
Call
.
Fn
=
dbp
.
PCToLine
(
pc
-
1
)
r
.
Call
.
File
,
r
.
Call
.
Line
,
r
.
Call
.
Fn
=
dbp
.
PCToLine
(
pc
-
1
)
r
.
Call
.
PC
,
_
,
_
=
dbp
.
goSymTable
.
LineToPC
(
r
.
Call
.
File
,
r
.
Call
.
Line
)
r
.
Call
.
PC
,
_
,
_
=
dbp
.
goSymTable
.
LineToPC
(
r
.
Call
.
File
,
r
.
Call
.
Line
)
...
...
proc/threads.go
浏览文件 @
5714aa54
...
@@ -11,7 +11,6 @@ import (
...
@@ -11,7 +11,6 @@ import (
"runtime"
"runtime"
"github.com/derekparker/delve/dwarf/debug/dwarf"
"github.com/derekparker/delve/dwarf/debug/dwarf"
"github.com/derekparker/delve/dwarf/frame"
)
)
// Thread represents a single thread in the traced process
// Thread represents a single thread in the traced process
...
@@ -153,25 +152,17 @@ func (dbp *Process) setNextBreakpoints() (err error) {
...
@@ -153,25 +152,17 @@ func (dbp *Process) setNextBreakpoints() (err error) {
return
err
return
err
}
}
// Grab info on our current stack frame. Used to determine
// whether we may be stepping outside of the current function.
fde
,
err
:=
dbp
.
frameEntries
.
FDEForPC
(
topframe
.
Current
.
PC
)
if
err
!=
nil
{
return
err
}
if
filepath
.
Ext
(
topframe
.
Current
.
File
)
!=
".go"
{
if
filepath
.
Ext
(
topframe
.
Current
.
File
)
!=
".go"
{
return
dbp
.
cnext
(
topframe
,
fde
)
return
dbp
.
cnext
(
topframe
)
}
}
return
dbp
.
next
(
dbp
.
SelectedGoroutine
,
topframe
,
fde
)
return
dbp
.
next
(
dbp
.
SelectedGoroutine
,
topframe
)
}
}
// Set breakpoints at every line, and the return address. Also look for
// Set breakpoints at every line, and the return address. Also look for
// a deferred function and set a breakpoint there too.
// a deferred function and set a breakpoint there too.
// The first return value is set to true if the goroutine is in the process of exiting
func
(
dbp
*
Process
)
next
(
g
*
G
,
topframe
Stackframe
)
error
{
func
(
dbp
*
Process
)
next
(
g
*
G
,
topframe
Stackframe
,
fde
*
frame
.
FrameDescriptionEntry
)
error
{
pcs
:=
dbp
.
lineInfo
.
AllPCsBetween
(
topframe
.
FDE
.
Begin
(),
topframe
.
FDE
.
End
()
-
1
,
topframe
.
Current
.
File
)
pcs
:=
dbp
.
lineInfo
.
AllPCsBetween
(
fde
.
Begin
(),
fde
.
End
()
-
1
,
topframe
.
Current
.
File
)
var
deferpc
uint64
=
0
var
deferpc
uint64
=
0
if
g
!=
nil
&&
g
.
DeferPC
!=
0
{
if
g
!=
nil
&&
g
.
DeferPC
!=
0
{
...
@@ -185,7 +176,7 @@ func (dbp *Process) next(g *G, topframe Stackframe, fde *frame.FrameDescriptionE
...
@@ -185,7 +176,7 @@ func (dbp *Process) next(g *G, topframe Stackframe, fde *frame.FrameDescriptionE
var
covered
bool
var
covered
bool
for
i
:=
range
pcs
{
for
i
:=
range
pcs
{
if
fde
.
Cover
(
pcs
[
i
])
{
if
topframe
.
FDE
.
Cover
(
pcs
[
i
])
{
covered
=
true
covered
=
true
break
break
}
}
...
@@ -207,8 +198,8 @@ func (dbp *Process) next(g *G, topframe Stackframe, fde *frame.FrameDescriptionE
...
@@ -207,8 +198,8 @@ func (dbp *Process) next(g *G, topframe Stackframe, fde *frame.FrameDescriptionE
// Set a breakpoint at every reachable location, as well as the return address. Without
// Set a breakpoint at every reachable location, as well as the return address. Without
// the benefit of an AST we can't be sure we're not at a branching statement and thus
// the benefit of an AST we can't be sure we're not at a branching statement and thus
// cannot accurately predict where we may end up.
// cannot accurately predict where we may end up.
func
(
dbp
*
Process
)
cnext
(
topframe
Stackframe
,
fde
*
frame
.
FrameDescriptionEntry
)
error
{
func
(
dbp
*
Process
)
cnext
(
topframe
Stackframe
)
error
{
pcs
:=
dbp
.
lineInfo
.
AllPCsBetween
(
fde
.
Begin
(),
fde
.
End
(),
topframe
.
Current
.
File
)
pcs
:=
dbp
.
lineInfo
.
AllPCsBetween
(
topframe
.
FDE
.
Begin
(),
topframe
.
FDE
.
End
(),
topframe
.
Current
.
File
)
pcs
=
append
(
pcs
,
topframe
.
Ret
)
pcs
=
append
(
pcs
,
topframe
.
Ret
)
return
dbp
.
setTempBreakpoints
(
topframe
.
Current
.
PC
,
pcs
,
sameGoroutineCondition
(
dbp
.
SelectedGoroutine
))
return
dbp
.
setTempBreakpoints
(
topframe
.
Current
.
PC
,
pcs
,
sameGoroutineCondition
(
dbp
.
SelectedGoroutine
))
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录