Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
pubx
delve
提交
af9e97b6
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,发现更多精彩内容 >>
提交
af9e97b6
编写于
9月 05, 2015
作者:
D
Derek Parker
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
service/debugger: Use PC instead of scope in Location.Find
上级
3fc823b7
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
10 addition
and
17 deletion
+10
-17
service/debugger/debugger.go
service/debugger/debugger.go
+2
-2
service/debugger/locations.go
service/debugger/locations.go
+8
-15
未找到文件。
service/debugger/debugger.go
浏览文件 @
af9e97b6
...
@@ -502,12 +502,12 @@ func (d *Debugger) FindLocation(scope api.EvalScope, locStr string) ([]api.Locat
...
@@ -502,12 +502,12 @@ func (d *Debugger) FindLocation(scope api.EvalScope, locStr string) ([]api.Locat
return
nil
,
err
return
nil
,
err
}
}
s
,
err
:=
d
.
process
.
ConvertEvalScope
(
scope
.
GoroutineID
,
scope
.
Frame
)
pc
,
err
:=
d
.
process
.
PC
(
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
locs
,
err
:=
loc
.
Find
(
d
,
s
,
locStr
)
locs
,
err
:=
loc
.
Find
(
d
,
pc
,
locStr
)
for
i
:=
range
locs
{
for
i
:=
range
locs
{
file
,
line
,
fn
:=
d
.
process
.
PCToLine
(
locs
[
i
]
.
PC
)
file
,
line
,
fn
:=
d
.
process
.
PCToLine
(
locs
[
i
]
.
PC
)
locs
[
i
]
.
File
=
file
locs
[
i
]
.
File
=
file
...
...
service/debugger/locations.go
浏览文件 @
af9e97b6
...
@@ -7,14 +7,13 @@ import (
...
@@ -7,14 +7,13 @@ import (
"strconv"
"strconv"
"strings"
"strings"
"github.com/derekparker/delve/proc"
"github.com/derekparker/delve/service/api"
"github.com/derekparker/delve/service/api"
)
)
const
maxFindLocationCandidates
=
5
const
maxFindLocationCandidates
=
5
type
LocationSpec
interface
{
type
LocationSpec
interface
{
Find
(
d
*
Debugger
,
scope
*
proc
.
EvalScope
,
locStr
string
)
([]
api
.
Location
,
error
)
Find
(
d
*
Debugger
,
pc
uint64
,
locStr
string
)
([]
api
.
Location
,
error
)
}
}
type
NormalLocationSpec
struct
{
type
NormalLocationSpec
struct
{
...
@@ -205,7 +204,7 @@ func (spec *FuncLocationSpec) Match(sym *gosym.Sym) bool {
...
@@ -205,7 +204,7 @@ func (spec *FuncLocationSpec) Match(sym *gosym.Sym) bool {
return
true
return
true
}
}
func
(
loc
*
RegexLocationSpec
)
Find
(
d
*
Debugger
,
scope
*
proc
.
EvalScope
,
locStr
string
)
([]
api
.
Location
,
error
)
{
func
(
loc
*
RegexLocationSpec
)
Find
(
d
*
Debugger
,
pc
uint64
,
locStr
string
)
([]
api
.
Location
,
error
)
{
funcs
:=
d
.
process
.
Funcs
()
funcs
:=
d
.
process
.
Funcs
()
matches
,
err
:=
regexFilterFuncs
(
loc
.
FuncRegex
,
funcs
)
matches
,
err
:=
regexFilterFuncs
(
loc
.
FuncRegex
,
funcs
)
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -221,7 +220,7 @@ func (loc *RegexLocationSpec) Find(d *Debugger, scope *proc.EvalScope, locStr st
...
@@ -221,7 +220,7 @@ func (loc *RegexLocationSpec) Find(d *Debugger, scope *proc.EvalScope, locStr st
return
r
,
nil
return
r
,
nil
}
}
func
(
loc
*
AddrLocationSpec
)
Find
(
d
*
Debugger
,
scope
*
proc
.
EvalScope
,
locStr
string
)
([]
api
.
Location
,
error
)
{
func
(
loc
*
AddrLocationSpec
)
Find
(
d
*
Debugger
,
pc
uint64
,
locStr
string
)
([]
api
.
Location
,
error
)
{
return
[]
api
.
Location
{{
PC
:
loc
.
Addr
}},
nil
return
[]
api
.
Location
{{
PC
:
loc
.
Addr
}},
nil
}
}
...
@@ -248,7 +247,7 @@ func (ale AmbiguousLocationError) Error() string {
...
@@ -248,7 +247,7 @@ func (ale AmbiguousLocationError) Error() string {
return
fmt
.
Sprintf
(
"Location
\"
%s
\"
ambiguous: %s…"
,
ale
.
Location
,
strings
.
Join
(
candidates
,
", "
))
return
fmt
.
Sprintf
(
"Location
\"
%s
\"
ambiguous: %s…"
,
ale
.
Location
,
strings
.
Join
(
candidates
,
", "
))
}
}
func
(
loc
*
NormalLocationSpec
)
Find
(
d
*
Debugger
,
scope
*
proc
.
EvalScope
,
locStr
string
)
([]
api
.
Location
,
error
)
{
func
(
loc
*
NormalLocationSpec
)
Find
(
d
*
Debugger
,
pc
uint64
,
locStr
string
)
([]
api
.
Location
,
error
)
{
funcs
:=
d
.
process
.
Funcs
()
funcs
:=
d
.
process
.
Funcs
()
files
:=
d
.
process
.
Sources
()
files
:=
d
.
process
.
Sources
()
...
@@ -304,11 +303,8 @@ func (loc *NormalLocationSpec) Find(d *Debugger, scope *proc.EvalScope, locStr s
...
@@ -304,11 +303,8 @@ func (loc *NormalLocationSpec) Find(d *Debugger, scope *proc.EvalScope, locStr s
}
}
}
}
func
(
loc
*
OffsetLocationSpec
)
Find
(
d
*
Debugger
,
scope
*
proc
.
EvalScope
,
locStr
string
)
([]
api
.
Location
,
error
)
{
func
(
loc
*
OffsetLocationSpec
)
Find
(
d
*
Debugger
,
pc
uint64
,
locStr
string
)
([]
api
.
Location
,
error
)
{
if
scope
==
nil
{
file
,
line
,
fn
:=
d
.
process
.
PCToLine
(
pc
)
return
nil
,
fmt
.
Errorf
(
"could not determine current location (scope is nil)"
)
}
file
,
line
,
fn
:=
d
.
process
.
PCToLine
(
scope
.
PC
)
if
fn
==
nil
{
if
fn
==
nil
{
return
nil
,
fmt
.
Errorf
(
"could not determine current location"
)
return
nil
,
fmt
.
Errorf
(
"could not determine current location"
)
}
}
...
@@ -316,11 +312,8 @@ func (loc *OffsetLocationSpec) Find(d *Debugger, scope *proc.EvalScope, locStr s
...
@@ -316,11 +312,8 @@ func (loc *OffsetLocationSpec) Find(d *Debugger, scope *proc.EvalScope, locStr s
return
[]
api
.
Location
{{
PC
:
addr
}},
err
return
[]
api
.
Location
{{
PC
:
addr
}},
err
}
}
func
(
loc
*
LineLocationSpec
)
Find
(
d
*
Debugger
,
scope
*
proc
.
EvalScope
,
locStr
string
)
([]
api
.
Location
,
error
)
{
func
(
loc
*
LineLocationSpec
)
Find
(
d
*
Debugger
,
pc
uint64
,
locStr
string
)
([]
api
.
Location
,
error
)
{
if
scope
==
nil
{
file
,
_
,
fn
:=
d
.
process
.
PCToLine
(
pc
)
return
nil
,
fmt
.
Errorf
(
"could not determine current location (scope is nil)"
)
}
file
,
_
,
fn
:=
d
.
process
.
PCToLine
(
scope
.
PC
)
if
fn
==
nil
{
if
fn
==
nil
{
return
nil
,
fmt
.
Errorf
(
"could not determine current location"
)
return
nil
,
fmt
.
Errorf
(
"could not determine current location"
)
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录