Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
HugeYuan
delve
提交
4729ae82
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,发现更多精彩内容 >>
提交
4729ae82
编写于
3月 13, 2015
作者:
D
Derek Parker
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Allow arbitrary switching between threads
上级
9f70f43f
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
30 addition
and
0 deletion
+30
-0
README.md
README.md
+2
-0
command/command.go
command/command.go
+18
-0
proctl/proctl.go
proctl/proctl.go
+10
-0
未找到文件。
README.md
浏览文件 @
4729ae82
...
@@ -89,6 +89,8 @@ Once inside a debugging session, the following commands may be used:
...
@@ -89,6 +89,8 @@ Once inside a debugging session, the following commands may be used:
*
`threads`
- Print status of all traced threads.
*
`threads`
- Print status of all traced threads.
*
`thread $tid`
- Switch to another thread.
*
`goroutines`
- Print status of all goroutines.
*
`goroutines`
- Print status of all goroutines.
*
`breakpoints`
- Print information on all active breakpoints.
*
`breakpoints`
- Print information on all active breakpoints.
...
...
command/command.go
浏览文件 @
4729ae82
...
@@ -9,6 +9,7 @@ import (
...
@@ -9,6 +9,7 @@ import (
"os"
"os"
"regexp"
"regexp"
"sort"
"sort"
"strconv"
"strings"
"strings"
"github.com/derekparker/delve/proctl"
"github.com/derekparker/delve/proctl"
...
@@ -48,6 +49,7 @@ func DebugCommands() *Commands {
...
@@ -48,6 +49,7 @@ func DebugCommands() *Commands {
command
{
aliases
:
[]
string
{
"step"
,
"si"
},
cmdFn
:
step
,
helpMsg
:
"Single step through program."
},
command
{
aliases
:
[]
string
{
"step"
,
"si"
},
cmdFn
:
step
,
helpMsg
:
"Single step through program."
},
command
{
aliases
:
[]
string
{
"next"
,
"n"
},
cmdFn
:
next
,
helpMsg
:
"Step over to next source line."
},
command
{
aliases
:
[]
string
{
"next"
,
"n"
},
cmdFn
:
next
,
helpMsg
:
"Step over to next source line."
},
command
{
aliases
:
[]
string
{
"threads"
},
cmdFn
:
threads
,
helpMsg
:
"Print out info for every traced thread."
},
command
{
aliases
:
[]
string
{
"threads"
},
cmdFn
:
threads
,
helpMsg
:
"Print out info for every traced thread."
},
command
{
aliases
:
[]
string
{
"thread"
,
"t"
},
cmdFn
:
thread
,
helpMsg
:
"Switch to the specified thread."
},
command
{
aliases
:
[]
string
{
"clear"
},
cmdFn
:
clear
,
helpMsg
:
"Deletes breakpoint."
},
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
{
"goroutines"
},
cmdFn
:
goroutines
,
helpMsg
:
"Print out info for every goroutine."
},
command
{
aliases
:
[]
string
{
"breakpoints"
,
"bp"
},
cmdFn
:
breakpoints
,
helpMsg
:
"Print out info for active breakpoints."
},
command
{
aliases
:
[]
string
{
"breakpoints"
,
"bp"
},
cmdFn
:
breakpoints
,
helpMsg
:
"Print out info for active breakpoints."
},
...
@@ -136,6 +138,22 @@ func threads(p *proctl.DebuggedProcess, ars ...string) error {
...
@@ -136,6 +138,22 @@ func threads(p *proctl.DebuggedProcess, ars ...string) error {
return
nil
return
nil
}
}
func
thread
(
p
*
proctl
.
DebuggedProcess
,
ars
...
string
)
error
{
oldTid
:=
p
.
CurrentThread
.
Id
tid
,
err
:=
strconv
.
Atoi
(
ars
[
0
])
if
err
!=
nil
{
return
err
}
err
=
p
.
SwitchThread
(
tid
)
if
err
!=
nil
{
return
err
}
fmt
.
Printf
(
"Switched from %d to %d
\n
"
,
oldTid
,
tid
)
return
nil
}
func
goroutines
(
p
*
proctl
.
DebuggedProcess
,
ars
...
string
)
error
{
func
goroutines
(
p
*
proctl
.
DebuggedProcess
,
ars
...
string
)
error
{
return
p
.
PrintGoroutinesInfo
()
return
p
.
PrintGoroutinesInfo
()
}
}
...
...
proctl/proctl.go
浏览文件 @
4729ae82
...
@@ -311,12 +311,22 @@ func (dbp *DebuggedProcess) Step() (err error) {
...
@@ -311,12 +311,22 @@ func (dbp *DebuggedProcess) Step() (err error) {
return
dbp
.
run
(
fn
)
return
dbp
.
run
(
fn
)
}
}
// Change from current thread to the thread specified by `tid`.
func
(
dbp
*
DebuggedProcess
)
SwitchThread
(
tid
int
)
error
{
if
th
,
ok
:=
dbp
.
Threads
[
tid
];
ok
{
dbp
.
CurrentThread
=
th
return
nil
}
return
fmt
.
Errorf
(
"thread %d does not exist"
,
tid
)
}
// Obtains register values from what Delve considers to be the current
// Obtains register values from what Delve considers to be the current
// thread of the traced process.
// thread of the traced process.
func
(
dbp
*
DebuggedProcess
)
Registers
()
(
Registers
,
error
)
{
func
(
dbp
*
DebuggedProcess
)
Registers
()
(
Registers
,
error
)
{
return
dbp
.
CurrentThread
.
Registers
()
return
dbp
.
CurrentThread
.
Registers
()
}
}
// Returns the PC of the current thread.
func
(
dbp
*
DebuggedProcess
)
CurrentPC
()
(
uint64
,
error
)
{
func
(
dbp
*
DebuggedProcess
)
CurrentPC
()
(
uint64
,
error
)
{
return
dbp
.
CurrentThread
.
CurrentPC
()
return
dbp
.
CurrentThread
.
CurrentPC
()
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录