Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
HugeYuan
delve
提交
142d8827
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 搜索 >>
提交
142d8827
编写于
7月 05, 2016
作者:
A
Alessandro Arzilli
提交者:
Derek Parker
7月 05, 2016
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
debugger/locations: Fixed bug parsing remote package paths (#586)
上级
372869c9
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
79 addition
and
1 deletion
+79
-1
service/debugger/locations.go
service/debugger/locations.go
+11
-1
service/debugger/locations_test.go
service/debugger/locations_test.go
+68
-0
未找到文件。
service/debugger/locations.go
浏览文件 @
142d8827
...
...
@@ -157,7 +157,17 @@ func readRegex(in string) (rx string, rest string) {
}
func
parseFuncLocationSpec
(
in
string
)
*
FuncLocationSpec
{
v
:=
strings
.
Split
(
in
,
"."
)
var
v
[]
string
pathend
:=
strings
.
LastIndex
(
in
,
"/"
)
if
pathend
<
0
{
v
=
strings
.
Split
(
in
,
"."
)
}
else
{
v
=
strings
.
Split
(
in
[
pathend
:
],
"."
)
if
len
(
v
)
>
0
{
v
[
0
]
=
in
[
:
pathend
]
+
v
[
0
]
}
}
var
spec
FuncLocationSpec
switch
len
(
v
)
{
case
1
:
...
...
service/debugger/locations_test.go
0 → 100644
浏览文件 @
142d8827
package
debugger
import
(
"testing"
)
func
parseLocationSpecNoError
(
t
*
testing
.
T
,
locstr
string
)
LocationSpec
{
spec
,
err
:=
parseLocationSpec
(
locstr
)
if
err
!=
nil
{
t
.
Fatalf
(
"Error parsing %q: %v"
,
locstr
,
err
)
}
return
spec
}
func
assertNormalLocationSpec
(
t
*
testing
.
T
,
locstr
string
,
tgt
NormalLocationSpec
)
{
spec
:=
parseLocationSpecNoError
(
t
,
locstr
)
nls
,
ok
:=
spec
.
(
*
NormalLocationSpec
)
if
!
ok
{
t
.
Fatalf
(
"Location %q: expected NormalLocationSpec got %#v"
,
locstr
,
spec
)
}
if
nls
.
Base
!=
tgt
.
Base
{
t
.
Fatalf
(
"Location %q: expected 'Base' %q got %q"
,
locstr
,
tgt
.
Base
,
nls
.
Base
)
}
if
nls
.
LineOffset
!=
tgt
.
LineOffset
{
t
.
Fatalf
(
"Location %q: expected 'LineOffset' %d got %d"
,
locstr
,
tgt
.
LineOffset
,
nls
.
LineOffset
)
}
if
tgt
.
FuncBase
==
nil
{
return
}
if
nls
.
FuncBase
==
nil
{
t
.
Fatalf
(
"Location %q: expected non-nil 'FuncBase'"
,
locstr
)
}
if
*
(
tgt
.
FuncBase
)
!=
*
(
nls
.
FuncBase
)
{
t
.
Fatalf
(
"Location %q: expected 'FuncBase':
\n
%#v
\n
got:
\n
%#v"
,
locstr
,
tgt
.
FuncBase
,
nls
.
FuncBase
)
}
}
func
TestFunctionLocationParsing
(
t
*
testing
.
T
)
{
// Function locations, simple package names, no line offset
assertNormalLocationSpec
(
t
,
"proc.(*Process).Continue"
,
NormalLocationSpec
{
"proc.(*Process).Continue"
,
&
FuncLocationSpec
{
PackageName
:
"proc"
,
ReceiverName
:
"Process"
,
BaseName
:
"Continue"
},
-
1
})
assertNormalLocationSpec
(
t
,
"proc.Process.Continue"
,
NormalLocationSpec
{
"proc.Process.Continue"
,
&
FuncLocationSpec
{
PackageName
:
"proc"
,
ReceiverName
:
"Process"
,
BaseName
:
"Continue"
},
-
1
})
assertNormalLocationSpec
(
t
,
"proc.Continue"
,
NormalLocationSpec
{
"proc.Continue"
,
&
FuncLocationSpec
{
PackageOrReceiverName
:
"proc"
,
BaseName
:
"Continue"
},
-
1
})
assertNormalLocationSpec
(
t
,
"(*Process).Continue"
,
NormalLocationSpec
{
"(*Process).Continue"
,
&
FuncLocationSpec
{
ReceiverName
:
"Process"
,
BaseName
:
"Continue"
},
-
1
})
assertNormalLocationSpec
(
t
,
"Continue"
,
NormalLocationSpec
{
"Continue"
,
&
FuncLocationSpec
{
BaseName
:
"Continue"
},
-
1
})
// Function locations, simple package names, line offsets
assertNormalLocationSpec
(
t
,
"proc.(*Process).Continue:10"
,
NormalLocationSpec
{
"proc.(*Process).Continue"
,
&
FuncLocationSpec
{
PackageName
:
"proc"
,
ReceiverName
:
"Process"
,
BaseName
:
"Continue"
},
10
})
assertNormalLocationSpec
(
t
,
"proc.Process.Continue:10"
,
NormalLocationSpec
{
"proc.Process.Continue"
,
&
FuncLocationSpec
{
PackageName
:
"proc"
,
ReceiverName
:
"Process"
,
BaseName
:
"Continue"
},
10
})
assertNormalLocationSpec
(
t
,
"proc.Continue:10"
,
NormalLocationSpec
{
"proc.Continue"
,
&
FuncLocationSpec
{
PackageOrReceiverName
:
"proc"
,
BaseName
:
"Continue"
},
10
})
assertNormalLocationSpec
(
t
,
"(*Process).Continue:10"
,
NormalLocationSpec
{
"(*Process).Continue"
,
&
FuncLocationSpec
{
ReceiverName
:
"Process"
,
BaseName
:
"Continue"
},
10
})
assertNormalLocationSpec
(
t
,
"Continue:10"
,
NormalLocationSpec
{
"Continue"
,
&
FuncLocationSpec
{
BaseName
:
"Continue"
},
10
})
// Function locations, package paths, no line offsets
assertNormalLocationSpec
(
t
,
"github.com/derekparker/delve/proc.(*Process).Continue"
,
NormalLocationSpec
{
"github.com/derekparker/delve/proc.(*Process).Continue"
,
&
FuncLocationSpec
{
PackageName
:
"github.com/derekparker/delve/proc"
,
ReceiverName
:
"Process"
,
BaseName
:
"Continue"
},
-
1
})
assertNormalLocationSpec
(
t
,
"github.com/derekparker/delve/proc.Process.Continue"
,
NormalLocationSpec
{
"github.com/derekparker/delve/proc.Process.Continue"
,
&
FuncLocationSpec
{
PackageName
:
"github.com/derekparker/delve/proc"
,
ReceiverName
:
"Process"
,
BaseName
:
"Continue"
},
-
1
})
assertNormalLocationSpec
(
t
,
"github.com/derekparker/delve/proc.Continue"
,
NormalLocationSpec
{
"github.com/derekparker/delve/proc.Continue"
,
&
FuncLocationSpec
{
PackageName
:
"github.com/derekparker/delve/proc"
,
BaseName
:
"Continue"
},
-
1
})
// Function locations, package paths, line offsets
assertNormalLocationSpec
(
t
,
"github.com/derekparker/delve/proc.(*Process).Continue:10"
,
NormalLocationSpec
{
"github.com/derekparker/delve/proc.(*Process).Continue"
,
&
FuncLocationSpec
{
PackageName
:
"github.com/derekparker/delve/proc"
,
ReceiverName
:
"Process"
,
BaseName
:
"Continue"
},
10
})
assertNormalLocationSpec
(
t
,
"github.com/derekparker/delve/proc.Process.Continue:10"
,
NormalLocationSpec
{
"github.com/derekparker/delve/proc.Process.Continue"
,
&
FuncLocationSpec
{
PackageName
:
"github.com/derekparker/delve/proc"
,
ReceiverName
:
"Process"
,
BaseName
:
"Continue"
},
10
})
assertNormalLocationSpec
(
t
,
"github.com/derekparker/delve/proc.Continue:10"
,
NormalLocationSpec
{
"github.com/derekparker/delve/proc.Continue"
,
&
FuncLocationSpec
{
PackageName
:
"github.com/derekparker/delve/proc"
,
BaseName
:
"Continue"
},
10
})
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录