Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
HugeYuan
delve
提交
8a1f36a1
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 搜索 >>
提交
8a1f36a1
编写于
1月 27, 2016
作者:
D
Derek Parker
提交者:
aarzilli
2月 01, 2016
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
dlv: Flag to print stacktrace on trace subcommand
上级
62870df1
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
15 addition
and
37 deletion
+15
-37
cmd/dlv/main.go
cmd/dlv/main.go
+10
-35
terminal/command.go
terminal/command.go
+5
-2
未找到文件。
cmd/dlv/main.go
浏览文件 @
8a1f36a1
...
...
@@ -10,7 +10,6 @@ import (
"path/filepath"
"runtime"
"strconv"
"strings"
"syscall"
"github.com/derekparker/delve/config"
...
...
@@ -137,7 +136,7 @@ starts and attaches to it, and enables you to immediately begin debugging your p
rootCommand
.
AddCommand
(
execCommand
)
// 'trace' subcommand.
var
traceAttachPid
int
var
traceAttachPid
,
traceStackDepth
int
traceCommand
:=
&
cobra
.
Command
{
Use
:
"trace [regexp]"
,
Short
:
"Compile and begin tracing program."
,
...
...
@@ -193,50 +192,26 @@ starts and attaches to it, and enables you to immediately begin debugging your p
return
1
}
for
i
:=
range
funcs
{
_
,
err
:=
client
.
CreateBreakpoint
(
&
api
.
Breakpoint
{
FunctionName
:
funcs
[
i
],
Line
:
-
1
,
Tracepoint
:
true
})
_
,
err
:=
client
.
CreateBreakpoint
(
&
api
.
Breakpoint
{
FunctionName
:
funcs
[
i
],
Line
:
-
1
,
Tracepoint
:
true
,
Stacktrace
:
traceStackDepth
})
if
err
!=
nil
{
fmt
.
Fprintln
(
os
.
Stderr
,
err
)
return
1
}
}
stateChan
:=
client
.
Continue
()
for
{
select
{
case
state
:=
<-
stateChan
:
if
state
==
nil
{
return
0
}
if
state
.
Err
!=
nil
{
fmt
.
Fprintln
(
os
.
Stderr
,
state
.
Err
)
return
0
}
for
i
:=
range
state
.
Threads
{
th
:=
state
.
Threads
[
i
]
if
th
.
Breakpoint
==
nil
{
continue
}
var
args
[]
string
var
fname
string
if
th
.
Function
!=
nil
{
fname
=
th
.
Function
.
Name
}
if
th
.
BreakpointInfo
!=
nil
{
for
_
,
arg
:=
range
th
.
BreakpointInfo
.
Arguments
{
args
=
append
(
args
,
arg
.
SinglelineString
())
}
}
fmt
.
Printf
(
"%s(%s) %s:%d
\n
"
,
fname
,
strings
.
Join
(
args
,
", "
),
terminal
.
ShortenFilePath
(
th
.
File
),
th
.
Line
)
}
case
<-
sigChan
:
server
.
Stop
(
traceAttachPid
==
0
)
return
1
}
cmds
:=
terminal
.
DebugCommands
(
client
)
cmd
:=
cmds
.
Find
(
"continue"
)
err
=
cmd
(
terminal
.
New
(
client
,
nil
),
""
)
if
err
!=
nil
{
fmt
.
Fprintln
(
os
.
Stderr
,
err
)
return
1
}
return
0
}()
os
.
Exit
(
status
)
},
}
traceCommand
.
Flags
()
.
IntVarP
(
&
traceAttachPid
,
"pid"
,
"p"
,
0
,
"Pid to attach to."
)
traceCommand
.
Flags
()
.
IntVarP
(
&
traceStackDepth
,
"stack"
,
"s"
,
0
,
"Show stack trace with given depth."
)
rootCommand
.
AddCommand
(
traceCommand
)
// 'test' subcommand.
...
...
terminal/command.go
浏览文件 @
8a1f36a1
...
...
@@ -826,6 +826,9 @@ func digits(n int) int {
}
func
printStack
(
stack
[]
api
.
Stackframe
,
ind
string
)
{
if
len
(
stack
)
==
0
{
return
}
d
:=
digits
(
len
(
stack
)
-
1
)
fmtstr
:=
"%s%"
+
strconv
.
Itoa
(
d
)
+
"d 0x%016x in %s
\n
"
s
:=
strings
.
Repeat
(
" "
,
d
+
2
+
len
(
ind
))
...
...
@@ -884,9 +887,9 @@ func printcontextThread(t *Term, th *api.Thread) {
}
args
:=
""
if
th
.
Breakpoint
.
Tracepoint
&&
fn
!=
nil
{
if
th
.
Breakpoint
.
Tracepoint
{
var
arg
[]
string
for
_
,
ar
:=
range
fn
.
Arg
s
{
for
_
,
ar
:=
range
th
.
BreakpointInfo
.
Argument
s
{
arg
=
append
(
arg
,
ar
.
SinglelineString
())
}
args
=
strings
.
Join
(
arg
,
", "
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录