Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
HugeYuan
delve
提交
9e588fef
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 搜索 >>
提交
9e588fef
编写于
2月 13, 2016
作者:
A
aarzilli
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
terminal: Next does not fill BreakpointInfo
Fixes #411
上级
1efc4940
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
90 addition
and
2 deletion
+90
-2
_fixtures/math.go
_fixtures/math.go
+10
-0
terminal/command.go
terminal/command.go
+2
-2
terminal/command_test.go
terminal/command_test.go
+78
-0
未找到文件。
_fixtures/math.go
0 → 100644
浏览文件 @
9e588fef
package
main
import
"math"
var
f
=
1.5
func
main
()
{
_
=
math
.
Floor
(
f
)
_
=
float64
(
int
(
f
))
}
terminal/command.go
浏览文件 @
9e588fef
...
...
@@ -940,7 +940,7 @@ func printcontext(t *Term, state *api.DebuggerState) error {
printcontextThread
(
t
,
state
.
CurrentThread
)
if
state
.
CurrentThread
.
Breakpoint
==
nil
||
!
state
.
CurrentThread
.
Breakpoint
.
Tracepoint
{
if
state
.
CurrentThread
.
Breakpoint
==
nil
||
!
state
.
CurrentThread
.
Breakpoint
.
Tracepoint
||
state
.
CurrentThread
.
BreakpointInfo
==
nil
{
return
printfile
(
t
,
state
.
CurrentThread
.
File
,
state
.
CurrentThread
.
Line
,
true
)
}
return
nil
...
...
@@ -955,7 +955,7 @@ func printcontextThread(t *Term, th *api.Thread) {
}
args
:=
""
if
th
.
Breakpoint
.
Tracepoint
{
if
th
.
Breakpoint
.
Tracepoint
&&
th
.
BreakpointInfo
!=
nil
{
var
arg
[]
string
for
_
,
ar
:=
range
th
.
BreakpointInfo
.
Arguments
{
arg
=
append
(
arg
,
ar
.
SinglelineString
())
...
...
terminal/command_test.go
浏览文件 @
9e588fef
...
...
@@ -2,13 +2,79 @@ package terminal
import
(
"fmt"
"io/ioutil"
"net"
"os"
"path/filepath"
"strings"
"testing"
"github.com/derekparker/delve/proc/test"
"github.com/derekparker/delve/service"
"github.com/derekparker/delve/service/api"
"github.com/derekparker/delve/service/rpc"
)
type
FakeTerminal
struct
{
t
testing
.
TB
client
service
.
Client
cmds
*
Commands
term
*
Term
}
func
(
term
*
FakeTerminal
)
Exec
(
cmdstr
string
)
(
outstr
string
,
err
error
)
{
cmdstr
,
args
:=
parseCommand
(
cmdstr
)
cmd
:=
term
.
cmds
.
Find
(
cmdstr
)
outfh
,
err
:=
ioutil
.
TempFile
(
""
,
"cmdtestout"
)
if
err
!=
nil
{
term
.
t
.
Fatalf
(
"could not create temporary file: %v"
,
err
)
}
stdout
,
stderr
:=
os
.
Stdout
,
os
.
Stderr
os
.
Stdout
,
os
.
Stderr
=
outfh
,
outfh
defer
func
()
{
os
.
Stdout
,
os
.
Stderr
=
stdout
,
stderr
outfh
.
Close
()
outbs
,
err1
:=
ioutil
.
ReadFile
(
outfh
.
Name
())
if
err1
!=
nil
{
term
.
t
.
Fatalf
(
"could not read temporary output file: %v"
,
err
)
}
outstr
=
string
(
outbs
)
os
.
Remove
(
outfh
.
Name
())
}()
err
=
cmd
(
term
.
term
,
args
)
return
}
func
(
term
*
FakeTerminal
)
MustExec
(
cmdstr
string
)
string
{
outstr
,
err
:=
term
.
Exec
(
cmdstr
)
if
err
!=
nil
{
term
.
t
.
Fatalf
(
"Error executing <%s>: %v"
,
cmdstr
,
err
)
}
return
outstr
}
func
withTestTerminal
(
name
string
,
t
testing
.
TB
,
fn
func
(
*
FakeTerminal
))
{
listener
,
err
:=
net
.
Listen
(
"tcp"
,
"localhost:0"
)
if
err
!=
nil
{
t
.
Fatalf
(
"couldn't start listener: %s
\n
"
,
err
)
}
defer
listener
.
Close
()
server
:=
rpc
.
NewServer
(
&
service
.
Config
{
Listener
:
listener
,
ProcessArgs
:
[]
string
{
test
.
BuildFixture
(
name
)
.
Path
},
},
false
)
if
err
:=
server
.
Run
();
err
!=
nil
{
t
.
Fatal
(
err
)
}
client
:=
rpc
.
NewClient
(
listener
.
Addr
()
.
String
())
defer
func
()
{
client
.
Detach
(
true
)
}()
fn
(
&
FakeTerminal
{
t
,
client
,
DebugCommands
(
client
),
New
(
client
,
nil
)})
}
func
TestCommandDefault
(
t
*
testing
.
T
)
{
var
(
cmds
=
Commands
{}
...
...
@@ -104,3 +170,15 @@ func TestIssue354(t *testing.T) {
printStack
([]
api
.
Stackframe
{},
""
)
printStack
([]
api
.
Stackframe
{{
api
.
Location
{
PC
:
0
,
File
:
"irrelevant.go"
,
Line
:
10
,
Function
:
nil
},
nil
,
nil
}},
""
)
}
func
TestIssue411
(
t
*
testing
.
T
)
{
withTestTerminal
(
"math"
,
t
,
func
(
term
*
FakeTerminal
)
{
term
.
MustExec
(
"break math.go:8"
)
term
.
MustExec
(
"trace math.go:9"
)
term
.
MustExec
(
"continue"
)
out
:=
term
.
MustExec
(
"next"
)
if
!
strings
.
HasPrefix
(
out
,
"> main.main()"
)
{
t
.
Fatalf
(
"Wrong output for next: <%s>"
,
out
)
}
})
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录