Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
HugeYuan
delve
提交
1d99e03f
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 搜索 >>
提交
1d99e03f
编写于
4月 03, 2015
作者:
D
Derek Parker
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Reduce exported members of DebuggedProcess struct
上级
ccad114e
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
65 addition
and
53 deletion
+65
-53
command/command.go
command/command.go
+6
-6
proctl/breakpoints.go
proctl/breakpoints.go
+1
-1
proctl/proctl.go
proctl/proctl.go
+20
-8
proctl/proctl_darwin.go
proctl/proctl_darwin.go
+4
-4
proctl/proctl_linux.go
proctl/proctl_linux.go
+4
-4
proctl/proctl_test.go
proctl/proctl_test.go
+13
-13
proctl/threads.go
proctl/threads.go
+5
-5
proctl/threads_darwin.go
proctl/threads_darwin.go
+1
-1
proctl/threads_linux.go
proctl/threads_linux.go
+1
-1
proctl/variables.go
proctl/variables.go
+6
-6
proctl/variables_test.go
proctl/variables_test.go
+4
-4
未找到文件。
command/command.go
浏览文件 @
1d99e03f
...
...
@@ -128,7 +128,7 @@ func threads(p *proctl.DebuggedProcess, args ...string) error {
if
err
!=
nil
{
return
err
}
f
,
l
,
fn
:=
th
.
Process
.
GoSymTable
.
PCToLine
(
pc
)
f
,
l
,
fn
:=
th
.
Process
.
PCToLine
(
pc
)
if
fn
!=
nil
{
fmt
.
Printf
(
"%sThread %d at %#v %s:%d %s
\n
"
,
prefix
,
th
.
Id
,
pc
,
f
,
l
,
fn
.
Name
)
}
else
{
...
...
@@ -294,16 +294,16 @@ func info(p *proctl.DebuggedProcess, args ...string) error {
switch
args
[
0
]
{
case
"sources"
:
data
=
make
([]
string
,
0
,
len
(
p
.
GoSymTable
.
Files
))
for
f
:=
range
p
.
GoSymTable
.
Files
{
data
=
make
([]
string
,
0
,
len
(
p
.
Sources
()
))
for
f
:=
range
p
.
Sources
()
{
if
filter
==
nil
||
filter
.
Match
([]
byte
(
f
))
{
data
=
append
(
data
,
f
)
}
}
case
"funcs"
:
data
=
make
([]
string
,
0
,
len
(
p
.
GoSymTable
.
Funcs
))
for
_
,
f
:=
range
p
.
GoSymTable
.
Funcs
{
data
=
make
([]
string
,
0
,
len
(
p
.
Funcs
()
))
for
_
,
f
:=
range
p
.
Funcs
()
{
if
f
.
Sym
!=
nil
&&
(
filter
==
nil
||
filter
.
Match
([]
byte
(
f
.
Name
)))
{
data
=
append
(
data
,
f
.
Name
)
}
...
...
@@ -352,7 +352,7 @@ func printcontext(p *proctl.DebuggedProcess) error {
return
err
}
f
,
l
,
fn
:=
p
.
GoSymTable
.
PCToLine
(
regs
.
PC
())
f
,
l
,
fn
:=
p
.
PCToLine
(
regs
.
PC
())
if
fn
!=
nil
{
fmt
.
Printf
(
"current loc: %s %s:%d
\n
"
,
fn
.
Name
,
f
,
l
)
...
...
proctl/breakpoints.go
浏览文件 @
1d99e03f
...
...
@@ -72,7 +72,7 @@ func (dbp *DebuggedProcess) newBreakpoint(fn, f string, l int, addr uint64, data
}
func
(
dbp
*
DebuggedProcess
)
setBreakpoint
(
tid
int
,
addr
uint64
)
(
*
BreakPoint
,
error
)
{
var
f
,
l
,
fn
=
dbp
.
G
oSymTable
.
PCToLine
(
uint64
(
addr
))
var
f
,
l
,
fn
=
dbp
.
g
oSymTable
.
PCToLine
(
uint64
(
addr
))
if
fn
==
nil
{
return
nil
,
InvalidAddressError
{
address
:
addr
}
}
...
...
proctl/proctl.go
浏览文件 @
1d99e03f
...
...
@@ -27,14 +27,14 @@ import (
type
DebuggedProcess
struct
{
Pid
int
Process
*
os
.
Process
Dwarf
*
dwarf
.
Data
GoSymTable
*
gosym
.
Table
FrameEntries
frame
.
FrameDescriptionEntries
LineInfo
*
line
.
DebugLineInfo
HWBreakPoints
[
4
]
*
BreakPoint
BreakPoints
map
[
uint64
]
*
BreakPoint
Threads
map
[
int
]
*
ThreadContext
CurrentThread
*
ThreadContext
dwarf
*
dwarf
.
Data
goSymTable
*
gosym
.
Table
frameEntries
frame
.
FrameDescriptionEntries
lineInfo
*
line
.
DebugLineInfo
os
*
OSProcessDetails
ast
*
source
.
Searcher
breakpointIDCounter
int
...
...
@@ -143,7 +143,7 @@ func (dbp *DebuggedProcess) FindLocation(str string) (uint64, error) {
return
0
,
err
}
pc
,
_
,
err
:=
dbp
.
G
oSymTable
.
LineToPC
(
fileName
,
line
)
pc
,
_
,
err
:=
dbp
.
g
oSymTable
.
LineToPC
(
fileName
,
line
)
if
err
!=
nil
{
return
0
,
err
}
...
...
@@ -151,7 +151,7 @@ func (dbp *DebuggedProcess) FindLocation(str string) (uint64, error) {
}
// Try to lookup by function name
fn
:=
dbp
.
G
oSymTable
.
LookupFunc
(
str
)
fn
:=
dbp
.
g
oSymTable
.
LookupFunc
(
str
)
if
fn
!=
nil
{
return
fn
.
Entry
,
nil
}
...
...
@@ -335,7 +335,7 @@ func (dbp *DebuggedProcess) resume() error {
}
}
// Check to see if we hit a runtime.breakpoint
fn
:=
dbp
.
G
oSymTable
.
PCToFunc
(
pc
)
fn
:=
dbp
.
g
oSymTable
.
PCToFunc
(
pc
)
if
fn
!=
nil
&&
fn
.
Name
==
"runtime.breakpoint"
{
// step twice to get back to user code
for
i
:=
0
;
i
<
2
;
i
++
{
...
...
@@ -399,7 +399,19 @@ func (dbp *DebuggedProcess) CallFn(name string, fn func(*ThreadContext) error) e
// Returns a reader for the dwarf data
func
(
dbp
*
DebuggedProcess
)
DwarfReader
()
*
reader
.
Reader
{
return
reader
.
New
(
dbp
.
Dwarf
)
return
reader
.
New
(
dbp
.
dwarf
)
}
func
(
dbp
*
DebuggedProcess
)
Sources
()
map
[
string
]
*
gosym
.
Obj
{
return
dbp
.
goSymTable
.
Files
}
func
(
dbp
*
DebuggedProcess
)
Funcs
()
[]
gosym
.
Func
{
return
dbp
.
goSymTable
.
Funcs
}
func
(
dbp
*
DebuggedProcess
)
PCToLine
(
pc
uint64
)
(
string
,
int
,
*
gosym
.
Func
)
{
return
dbp
.
goSymTable
.
PCToLine
(
pc
)
}
// Finds the breakpoint for the given pc.
...
...
proctl/proctl_darwin.go
浏览文件 @
1d99e03f
...
...
@@ -92,7 +92,7 @@ func (dbp *DebuggedProcess) parseDebugFrame(exe *macho.File, wg *sync.WaitGroup)
fmt
.
Println
(
"could not get __debug_frame section"
,
err
)
os
.
Exit
(
1
)
}
dbp
.
F
rameEntries
=
frame
.
Parse
(
debugFrame
)
dbp
.
f
rameEntries
=
frame
.
Parse
(
debugFrame
)
}
else
{
fmt
.
Println
(
"could not find __debug_frame section in binary"
)
os
.
Exit
(
1
)
...
...
@@ -131,7 +131,7 @@ func (dbp *DebuggedProcess) obtainGoSymbols(exe *macho.File, wg *sync.WaitGroup)
os
.
Exit
(
1
)
}
dbp
.
G
oSymTable
=
tab
dbp
.
g
oSymTable
=
tab
}
func
(
dbp
*
DebuggedProcess
)
parseDebugLineInfo
(
exe
*
macho
.
File
,
wg
*
sync
.
WaitGroup
)
{
...
...
@@ -143,7 +143,7 @@ func (dbp *DebuggedProcess) parseDebugLineInfo(exe *macho.File, wg *sync.WaitGro
fmt
.
Println
(
"could not get __debug_line section"
,
err
)
os
.
Exit
(
1
)
}
dbp
.
L
ineInfo
=
line
.
Parse
(
debugLine
)
dbp
.
l
ineInfo
=
line
.
Parse
(
debugLine
)
}
else
{
fmt
.
Println
(
"could not find __debug_line section in binary"
)
os
.
Exit
(
1
)
...
...
@@ -167,7 +167,7 @@ func (dbp *DebuggedProcess) findExecutable() (*macho.File, error) {
if
err
!=
nil
{
return
nil
,
err
}
dbp
.
D
warf
=
data
dbp
.
d
warf
=
data
return
exe
,
nil
}
...
...
proctl/proctl_linux.go
浏览文件 @
1d99e03f
...
...
@@ -125,7 +125,7 @@ func (dbp *DebuggedProcess) findExecutable() (*elf.File, error) {
if
err
!=
nil
{
return
nil
,
err
}
dbp
.
D
warf
=
data
dbp
.
d
warf
=
data
return
elffile
,
nil
}
...
...
@@ -139,7 +139,7 @@ func (dbp *DebuggedProcess) parseDebugFrame(exe *elf.File, wg *sync.WaitGroup) {
fmt
.
Println
(
"could not get .debug_frame section"
,
err
)
os
.
Exit
(
1
)
}
dbp
.
F
rameEntries
=
frame
.
Parse
(
debugFrame
)
dbp
.
f
rameEntries
=
frame
.
Parse
(
debugFrame
)
}
else
{
fmt
.
Println
(
"could not find .debug_frame section in binary"
)
os
.
Exit
(
1
)
...
...
@@ -178,7 +178,7 @@ func (dbp *DebuggedProcess) obtainGoSymbols(exe *elf.File, wg *sync.WaitGroup) {
os
.
Exit
(
1
)
}
dbp
.
G
oSymTable
=
tab
dbp
.
g
oSymTable
=
tab
}
func
(
dbp
*
DebuggedProcess
)
parseDebugLineInfo
(
exe
*
elf
.
File
,
wg
*
sync
.
WaitGroup
)
{
...
...
@@ -190,7 +190,7 @@ func (dbp *DebuggedProcess) parseDebugLineInfo(exe *elf.File, wg *sync.WaitGroup
fmt
.
Println
(
"could not get .debug_line section"
,
err
)
os
.
Exit
(
1
)
}
dbp
.
L
ineInfo
=
line
.
Parse
(
debugLine
)
dbp
.
l
ineInfo
=
line
.
Parse
(
debugLine
)
}
else
{
fmt
.
Println
(
"could not find .debug_line section in binary"
)
os
.
Exit
(
1
)
...
...
proctl/proctl_test.go
浏览文件 @
1d99e03f
...
...
@@ -66,7 +66,7 @@ func currentPC(p *DebuggedProcess, t *testing.T) uint64 {
func
currentLineNumber
(
p
*
DebuggedProcess
,
t
*
testing
.
T
)
(
string
,
int
)
{
pc
:=
currentPC
(
p
,
t
)
f
,
l
,
_
:=
p
.
G
oSymTable
.
PCToLine
(
pc
)
f
,
l
,
_
:=
p
.
g
oSymTable
.
PCToLine
(
pc
)
return
f
,
l
}
...
...
@@ -89,7 +89,7 @@ func TestExit(t *testing.T) {
func
TestStep
(
t
*
testing
.
T
)
{
withTestProcess
(
"../_fixtures/testprog"
,
t
,
func
(
p
*
DebuggedProcess
)
{
helloworldfunc
:=
p
.
G
oSymTable
.
LookupFunc
(
"main.helloworld"
)
helloworldfunc
:=
p
.
g
oSymTable
.
LookupFunc
(
"main.helloworld"
)
helloworldaddr
:=
helloworldfunc
.
Entry
_
,
err
:=
p
.
Break
(
helloworldaddr
)
...
...
@@ -111,7 +111,7 @@ func TestStep(t *testing.T) {
func
TestBreakPoint
(
t
*
testing
.
T
)
{
withTestProcess
(
"../_fixtures/testprog"
,
t
,
func
(
p
*
DebuggedProcess
)
{
helloworldfunc
:=
p
.
G
oSymTable
.
LookupFunc
(
"main.helloworld"
)
helloworldfunc
:=
p
.
g
oSymTable
.
LookupFunc
(
"main.helloworld"
)
helloworldaddr
:=
helloworldfunc
.
Entry
bp
,
err
:=
p
.
Break
(
helloworldaddr
)
...
...
@@ -124,7 +124,7 @@ func TestBreakPoint(t *testing.T) {
}
if
pc
-
1
!=
bp
.
Addr
&&
pc
!=
bp
.
Addr
{
f
,
l
,
_
:=
p
.
G
oSymTable
.
PCToLine
(
pc
)
f
,
l
,
_
:=
p
.
g
oSymTable
.
PCToLine
(
pc
)
t
.
Fatalf
(
"Break not respected:
\n
PC:%#v %s:%d
\n
FN:%#v
\n
"
,
pc
,
f
,
l
,
bp
.
Addr
)
}
})
...
...
@@ -132,7 +132,7 @@ func TestBreakPoint(t *testing.T) {
func
TestBreakPointInSeperateGoRoutine
(
t
*
testing
.
T
)
{
withTestProcess
(
"../_fixtures/testthreads"
,
t
,
func
(
p
*
DebuggedProcess
)
{
fn
:=
p
.
G
oSymTable
.
LookupFunc
(
"main.anotherthread"
)
fn
:=
p
.
g
oSymTable
.
LookupFunc
(
"main.anotherthread"
)
if
fn
==
nil
{
t
.
Fatal
(
"No fn exists"
)
}
...
...
@@ -152,7 +152,7 @@ func TestBreakPointInSeperateGoRoutine(t *testing.T) {
t
.
Fatal
(
err
)
}
f
,
l
,
_
:=
p
.
G
oSymTable
.
PCToLine
(
pc
)
f
,
l
,
_
:=
p
.
g
oSymTable
.
PCToLine
(
pc
)
if
f
!=
"testthreads.go"
&&
l
!=
8
{
t
.
Fatal
(
"Program did not hit breakpoint"
)
}
...
...
@@ -170,7 +170,7 @@ func TestBreakPointWithNonExistantFunction(t *testing.T) {
func
TestClearBreakPoint
(
t
*
testing
.
T
)
{
withTestProcess
(
"../_fixtures/testprog"
,
t
,
func
(
p
*
DebuggedProcess
)
{
fn
:=
p
.
G
oSymTable
.
LookupFunc
(
"main.sleepytime"
)
fn
:=
p
.
g
oSymTable
.
LookupFunc
(
"main.sleepytime"
)
bp
,
err
:=
p
.
Break
(
fn
.
Entry
)
assertNoError
(
err
,
t
,
"Break()"
)
...
...
@@ -227,7 +227,7 @@ func TestNext(t *testing.T) {
}
withTestProcess
(
executablePath
,
t
,
func
(
p
*
DebuggedProcess
)
{
pc
,
_
,
_
:=
p
.
G
oSymTable
.
LineToPC
(
fp
,
testcases
[
0
]
.
begin
)
pc
,
_
,
_
:=
p
.
g
oSymTable
.
LineToPC
(
fp
,
testcases
[
0
]
.
begin
)
_
,
err
:=
p
.
Break
(
pc
)
assertNoError
(
err
,
t
,
"Break()"
)
assertNoError
(
p
.
Continue
(),
t
,
"Continue()"
)
...
...
@@ -264,8 +264,8 @@ func TestFindReturnAddress(t *testing.T) {
withTestProcess
(
testfile
,
t
,
func
(
p
*
DebuggedProcess
)
{
var
(
fdes
=
p
.
F
rameEntries
gsd
=
p
.
G
oSymTable
fdes
=
p
.
f
rameEntries
gsd
=
p
.
g
oSymTable
)
testsourcefile
:=
testfile
+
".go"
...
...
@@ -376,7 +376,7 @@ func TestFunctionCall(t *testing.T) {
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
fn
:=
p
.
G
oSymTable
.
PCToFunc
(
pc
)
fn
:=
p
.
g
oSymTable
.
PCToFunc
(
pc
)
if
fn
==
nil
{
t
.
Fatalf
(
"Could not find func for PC: %#v"
,
pc
)
}
...
...
@@ -388,7 +388,7 @@ func TestFunctionCall(t *testing.T) {
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
f
:=
th
.
Process
.
G
oSymTable
.
LookupFunc
(
"runtime.getg"
)
f
:=
th
.
Process
.
g
oSymTable
.
LookupFunc
(
"runtime.getg"
)
if
f
==
nil
{
t
.
Fatalf
(
"could not find function %s"
,
"runtime.getg"
)
}
...
...
@@ -403,7 +403,7 @@ func TestFunctionCall(t *testing.T) {
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
fn
=
p
.
G
oSymTable
.
PCToFunc
(
pc
)
fn
=
p
.
g
oSymTable
.
PCToFunc
(
pc
)
if
fn
==
nil
{
t
.
Fatalf
(
"Could not find func for PC: %#v"
,
pc
)
}
...
...
proctl/threads.go
浏览文件 @
1d99e03f
...
...
@@ -109,7 +109,7 @@ func (thread *ThreadContext) Step() (err error) {
// Call a function named `name`. This is currently _NOT_ safe.
func
(
thread
*
ThreadContext
)
CallFn
(
name
string
,
fn
func
(
*
ThreadContext
)
error
)
error
{
f
:=
thread
.
Process
.
G
oSymTable
.
LookupFunc
(
name
)
f
:=
thread
.
Process
.
g
oSymTable
.
LookupFunc
(
name
)
if
f
==
nil
{
return
fmt
.
Errorf
(
"could not find function %s"
,
name
)
}
...
...
@@ -159,13 +159,13 @@ func (thread *ThreadContext) Next() (err error) {
// Grab info on our current stack frame. Used to determine
// whether we may be stepping outside of the current function.
fde
,
err
:=
thread
.
Process
.
F
rameEntries
.
FDEForPC
(
curpc
)
fde
,
err
:=
thread
.
Process
.
f
rameEntries
.
FDEForPC
(
curpc
)
if
err
!=
nil
{
return
err
}
// Get current file/line.
f
,
l
,
_
:=
thread
.
Process
.
G
oSymTable
.
PCToLine
(
curpc
)
f
,
l
,
_
:=
thread
.
Process
.
g
oSymTable
.
PCToLine
(
curpc
)
// Find any line we could potentially get to.
lines
,
err
:=
thread
.
Process
.
ast
.
NextLines
(
f
,
l
)
...
...
@@ -175,7 +175,7 @@ func (thread *ThreadContext) Next() (err error) {
// Set a breakpoint at every line reachable from our location.
for
_
,
l
:=
range
lines
{
pcs
:=
thread
.
Process
.
L
ineInfo
.
AllPCsForFileLine
(
f
,
l
)
pcs
:=
thread
.
Process
.
l
ineInfo
.
AllPCsForFileLine
(
f
,
l
)
for
_
,
pc
:=
range
pcs
{
if
pc
==
curpc
{
continue
...
...
@@ -243,7 +243,7 @@ func (thread *ThreadContext) curG() (*G, error) {
if
err
!=
nil
{
return
err
}
reader
:=
t
.
Process
.
D
warf
.
Reader
()
reader
:=
t
.
Process
.
d
warf
.
Reader
()
g
,
err
=
parseG
(
t
.
Process
,
regs
.
SP
()
+
uint64
(
ptrsize
),
reader
)
return
err
})
...
...
proctl/threads_darwin.go
浏览文件 @
1d99e03f
...
...
@@ -49,7 +49,7 @@ func (t *ThreadContext) resume() error {
func
(
t
*
ThreadContext
)
blocked
()
bool
{
// TODO(dp) cache the func pc to remove this lookup
pc
,
_
:=
t
.
CurrentPC
()
fn
:=
t
.
Process
.
G
oSymTable
.
PCToFunc
(
pc
)
fn
:=
t
.
Process
.
g
oSymTable
.
PCToFunc
(
pc
)
if
fn
!=
nil
&&
((
fn
.
Name
==
"runtime.mach_semaphore_wait"
)
||
(
fn
.
Name
==
"runtime.usleep"
))
{
return
true
}
...
...
proctl/threads_linux.go
浏览文件 @
1d99e03f
...
...
@@ -43,7 +43,7 @@ func (t *ThreadContext) singleStep() error {
func
(
t
*
ThreadContext
)
blocked
()
bool
{
// TODO(dp) cache the func pc to remove this lookup
pc
,
_
:=
t
.
CurrentPC
()
fn
:=
t
.
Process
.
G
oSymTable
.
PCToFunc
(
pc
)
fn
:=
t
.
Process
.
g
oSymTable
.
PCToFunc
(
pc
)
if
fn
!=
nil
&&
((
fn
.
Name
==
"runtime.futex"
)
||
(
fn
.
Name
==
"runtime.usleep"
)
||
(
fn
.
Name
==
"runtime.clone"
))
{
return
true
}
...
...
proctl/variables.go
浏览文件 @
1d99e03f
...
...
@@ -41,7 +41,7 @@ const ptrsize uintptr = unsafe.Sizeof(int(1))
// Parses and returns select info on the internal M
// data structures used by the Go scheduler.
func
(
thread
*
ThreadContext
)
AllM
()
([]
*
M
,
error
)
{
reader
:=
thread
.
Process
.
D
warf
.
Reader
()
reader
:=
thread
.
Process
.
d
warf
.
Reader
()
allmaddr
,
err
:=
parseAllMPtr
(
thread
.
Process
,
reader
)
if
err
!=
nil
{
...
...
@@ -206,7 +206,7 @@ func parseAllMPtr(dbp *DebuggedProcess, reader *dwarf.Reader) (uint64, error) {
}
func
(
dbp
*
DebuggedProcess
)
PrintGoroutinesInfo
()
error
{
reader
:=
dbp
.
D
warf
.
Reader
()
reader
:=
dbp
.
d
warf
.
Reader
()
allglen
,
err
:=
allglenval
(
dbp
,
reader
)
if
err
!=
nil
{
...
...
@@ -226,7 +226,7 @@ func (dbp *DebuggedProcess) PrintGoroutinesInfo() error {
if
err
!=
nil
{
return
err
}
f
,
l
,
fn
:=
dbp
.
G
oSymTable
.
PCToLine
(
g
.
pc
)
f
,
l
,
fn
:=
dbp
.
g
oSymTable
.
PCToLine
(
g
.
pc
)
fname
:=
""
if
fn
!=
nil
{
fname
=
fn
.
Name
...
...
@@ -479,7 +479,7 @@ func (thread *ThreadContext) evaluateStructMember(parentEntry *dwarf.Entry, read
return
nil
,
fmt
.
Errorf
(
"type assertion failed"
)
}
data
:=
thread
.
Process
.
D
warf
data
:=
thread
.
Process
.
d
warf
t
,
err
:=
data
.
Type
(
offset
)
if
err
!=
nil
{
return
nil
,
err
...
...
@@ -520,7 +520,7 @@ func (thread *ThreadContext) extractVariableFromEntry(entry *dwarf.Entry) (*Vari
return
nil
,
fmt
.
Errorf
(
"type assertion failed"
)
}
data
:=
thread
.
Process
.
D
warf
data
:=
thread
.
Process
.
d
warf
t
,
err
:=
data
.
Type
(
offset
)
if
err
!=
nil
{
return
nil
,
err
...
...
@@ -546,7 +546,7 @@ func (thread *ThreadContext) executeStackProgram(instructions []byte) (int64, er
return
0
,
err
}
fde
,
err
:=
thread
.
Process
.
F
rameEntries
.
FDEForPC
(
regs
.
PC
())
fde
,
err
:=
thread
.
Process
.
f
rameEntries
.
FDEForPC
(
regs
.
PC
())
if
err
!=
nil
{
return
0
,
err
}
...
...
proctl/variables_test.go
浏览文件 @
1d99e03f
...
...
@@ -74,7 +74,7 @@ func TestVariableEvaluation(t *testing.T) {
}
withTestProcess
(
executablePath
,
t
,
func
(
p
*
DebuggedProcess
)
{
pc
,
_
,
_
:=
p
.
G
oSymTable
.
LineToPC
(
fp
,
57
)
pc
,
_
,
_
:=
p
.
g
oSymTable
.
LineToPC
(
fp
,
57
)
_
,
err
:=
p
.
Break
(
pc
)
assertNoError
(
err
,
t
,
"Break() returned an error"
)
...
...
@@ -105,7 +105,7 @@ func TestVariableFunctionScoping(t *testing.T) {
}
withTestProcess
(
executablePath
,
t
,
func
(
p
*
DebuggedProcess
)
{
pc
,
_
,
_
:=
p
.
G
oSymTable
.
LineToPC
(
fp
,
57
)
pc
,
_
,
_
:=
p
.
g
oSymTable
.
LineToPC
(
fp
,
57
)
_
,
err
:=
p
.
Break
(
pc
)
assertNoError
(
err
,
t
,
"Break() returned an error"
)
...
...
@@ -120,7 +120,7 @@ func TestVariableFunctionScoping(t *testing.T) {
assertNoError
(
err
,
t
,
"Unable to find variable a1"
)
// Move scopes, a1 exists here by a2 does not
pc
,
_
,
_
=
p
.
G
oSymTable
.
LineToPC
(
fp
,
23
)
pc
,
_
,
_
=
p
.
g
oSymTable
.
LineToPC
(
fp
,
23
)
_
,
err
=
p
.
Break
(
pc
)
assertNoError
(
err
,
t
,
"Break() returned an error"
)
...
...
@@ -203,7 +203,7 @@ func TestLocalVariables(t *testing.T) {
}
withTestProcess
(
executablePath
,
t
,
func
(
p
*
DebuggedProcess
)
{
pc
,
_
,
_
:=
p
.
G
oSymTable
.
LineToPC
(
fp
,
57
)
pc
,
_
,
_
:=
p
.
g
oSymTable
.
LineToPC
(
fp
,
57
)
_
,
err
:=
p
.
Break
(
pc
)
assertNoError
(
err
,
t
,
"Break() returned an error"
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录