Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
pubx
delve
提交
017ce2ae
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,发现更多精彩内容 >>
提交
017ce2ae
编写于
9月 08, 2015
作者:
A
aarzilli
提交者:
Derek Parker
9月 09, 2015
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix: absolute path confused for regexp in FindLocation
上级
c0a0e0bd
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
45 addition
and
28 deletion
+45
-28
service/debugger/locations.go
service/debugger/locations.go
+44
-28
service/test/integration_test.go
service/test/integration_test.go
+1
-0
未找到文件。
service/debugger/locations.go
浏览文件 @
017ce2ae
...
...
@@ -65,14 +65,18 @@ func parseLocationSpec(locStr string) (LocationSpec, error) {
return
&
OffsetLocationSpec
{
offset
},
nil
case
'/'
:
rx
,
rest
:=
readRegex
(
rest
[
1
:
])
if
len
(
rest
)
<
0
{
return
nil
,
malformed
(
"non-terminated regular expression"
)
}
if
len
(
rest
)
>
1
{
return
nil
,
malformed
(
"no line offset can be specified for regular expression locations"
)
if
rest
[
len
(
rest
)
-
1
]
==
'/'
{
rx
,
rest
:=
readRegex
(
rest
[
1
:
])
if
len
(
rest
)
<
0
{
return
nil
,
malformed
(
"non-terminated regular expression"
)
}
if
len
(
rest
)
>
1
{
return
nil
,
malformed
(
"no line offset can be specified for regular expression locations"
)
}
return
&
RegexLocationSpec
{
rx
},
nil
}
else
{
return
parseLocationSpecDefault
(
locStr
,
rest
)
}
return
&
RegexLocationSpec
{
rx
},
nil
case
'*'
:
rest
=
rest
[
1
:
]
...
...
@@ -86,35 +90,43 @@ func parseLocationSpec(locStr string) (LocationSpec, error) {
return
&
AddrLocationSpec
{
uint64
(
addr
)},
nil
default
:
v
:=
strings
.
SplitN
(
rest
,
":"
,
2
)
if
len
(
v
)
==
1
{
n
,
err
:=
strconv
.
ParseInt
(
v
[
0
],
0
,
64
)
if
err
==
nil
{
return
&
LineLocationSpec
{
int
(
n
)},
nil
}
}
return
parseLocationSpecDefault
(
locStr
,
rest
)
}
}
spec
:=
&
NormalLocationSpec
{}
func
parseLocationSpecDefault
(
locStr
,
rest
string
)
(
LocationSpec
,
error
)
{
malformed
:=
func
(
reason
string
)
error
{
return
fmt
.
Errorf
(
"Malformed breakpoint location
\"
%s
\"
at %d: %s"
,
locStr
,
len
(
locStr
)
-
len
(
rest
),
reason
)
}
spec
.
Base
=
v
[
0
]
spec
.
FuncBase
=
parseFuncLocationSpec
(
spec
.
Base
)
v
:=
strings
.
SplitN
(
rest
,
":"
,
2
)
if
len
(
v
)
<
2
{
spec
.
LineOffset
=
-
1
return
spec
,
nil
if
len
(
v
)
==
1
{
n
,
err
:=
strconv
.
ParseInt
(
v
[
0
],
0
,
64
)
if
err
==
nil
{
return
&
LineLocationSpec
{
int
(
n
)},
nil
}
}
rest
=
v
[
1
]
spec
:=
&
NormalLocationSpec
{}
var
err
error
spec
.
LineOffset
,
err
=
strconv
.
Atoi
(
rest
)
if
err
!=
nil
||
spec
.
LineOffset
<
0
{
return
nil
,
malformed
(
"line offset negative or not a number"
)
}
spec
.
Base
=
v
[
0
]
spec
.
FuncBase
=
parseFuncLocationSpec
(
spec
.
Base
)
if
len
(
v
)
<
2
{
spec
.
LineOffset
=
-
1
return
spec
,
nil
}
rest
=
v
[
1
]
var
err
error
spec
.
LineOffset
,
err
=
strconv
.
Atoi
(
rest
)
if
err
!=
nil
||
spec
.
LineOffset
<
0
{
return
nil
,
malformed
(
"line offset negative or not a number"
)
}
return
spec
,
nil
}
func
readRegex
(
in
string
)
(
rx
string
,
rest
string
)
{
...
...
@@ -225,7 +237,11 @@ func (loc *AddrLocationSpec) Find(d *Debugger, pc uint64, locStr string) ([]api.
}
func
(
loc
*
NormalLocationSpec
)
FileMatch
(
path
string
)
bool
{
return
strings
.
HasSuffix
(
path
,
loc
.
Base
)
&&
(
path
[
len
(
path
)
-
len
(
loc
.
Base
)
-
1
]
==
filepath
.
Separator
)
if
len
(
loc
.
Base
)
<
len
(
path
)
-
1
{
return
strings
.
HasSuffix
(
path
,
loc
.
Base
)
&&
(
path
[
len
(
path
)
-
len
(
loc
.
Base
)
-
1
]
==
filepath
.
Separator
)
}
else
{
return
loc
.
Base
==
path
}
}
type
AmbiguousLocationError
struct
{
...
...
service/test/integration_test.go
浏览文件 @
017ce2ae
...
...
@@ -586,6 +586,7 @@ func TestClientServer_FindLocations(t *testing.T) {
<-
c
.
Continue
()
locationsprog34Addr
:=
findLocationHelper
(
t
,
c
,
"locationsprog.go:34"
,
false
,
1
,
0
)[
0
]
findLocationHelper
(
t
,
c
,
fmt
.
Sprintf
(
"%s:34"
,
testProgPath
(
t
,
"locationsprog"
)),
false
,
1
,
locationsprog34Addr
)
findLocationHelper
(
t
,
c
,
"+1"
,
false
,
1
,
locationsprog34Addr
)
findLocationHelper
(
t
,
c
,
"34"
,
false
,
1
,
locationsprog34Addr
)
findLocationHelper
(
t
,
c
,
"-1"
,
false
,
1
,
findLocationHelper
(
t
,
c
,
"locationsprog.go:32"
,
false
,
1
,
0
)[
0
])
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录