Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
pubx
delve
提交
148d6083
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,发现更多精彩内容 >>
提交
148d6083
编写于
12月 28, 2014
作者:
E
epipho
提交者:
Derek Parker
12月 28, 2014
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Adding info sources
上级
623ec5e5
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
39 addition
and
0 deletion
+39
-0
command/command.go
command/command.go
+39
-0
未找到文件。
command/command.go
浏览文件 @
148d6083
...
...
@@ -9,6 +9,8 @@ import (
"io"
"os"
"path/filepath"
"regexp"
"sort"
"strconv"
"strings"
...
...
@@ -52,6 +54,7 @@ func DebugCommands() *Commands {
command
{
aliases
:
[]
string
{
"clear"
},
cmdFn
:
clear
,
helpMsg
:
"Deletes breakpoint."
},
command
{
aliases
:
[]
string
{
"goroutines"
},
cmdFn
:
goroutines
,
helpMsg
:
"Print out info for every goroutine."
},
command
{
aliases
:
[]
string
{
"print"
,
"p"
},
cmdFn
:
printVar
,
helpMsg
:
"Evaluate a variable."
},
command
{
aliases
:
[]
string
{
"info"
},
cmdFn
:
info
,
helpMsg
:
"Provides list of source files with symbols."
},
command
{
aliases
:
[]
string
{
"exit"
},
cmdFn
:
nullCommand
,
helpMsg
:
"Exit the debugger."
},
}
...
...
@@ -258,6 +261,42 @@ func printVar(p *proctl.DebuggedProcess, args ...string) error {
return
nil
}
func
info
(
p
*
proctl
.
DebuggedProcess
,
args
...
string
)
error
{
if
len
(
args
)
==
0
{
return
fmt
.
Errorf
(
"not enough arguments"
)
}
// Allow for optional regex
var
filter
*
regexp
.
Regexp
if
len
(
args
)
>=
2
{
var
err
error
if
filter
,
err
=
regexp
.
Compile
(
args
[
1
]);
err
!=
nil
{
return
fmt
.
Errorf
(
"invalid filter argument: %s"
,
err
.
Error
())
}
}
switch
args
[
0
]
{
case
"sources"
:
files
:=
make
([]
string
,
0
,
len
(
p
.
GoSymTable
.
Files
))
for
f
:=
range
p
.
GoSymTable
.
Files
{
if
filter
==
nil
||
filter
.
Match
([]
byte
(
f
))
{
files
=
append
(
files
,
f
)
}
}
sort
.
Sort
(
sort
.
StringSlice
(
files
))
for
_
,
f
:=
range
files
{
fmt
.
Printf
(
"%s
\n
"
,
f
)
}
default
:
return
fmt
.
Errorf
(
"unsupported info type, must be sources"
)
}
return
nil
}
func
printcontext
(
p
*
proctl
.
DebuggedProcess
)
error
{
var
context
[]
string
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录