Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
pubx
delve
提交
0b3cf1cd
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,发现更多精彩内容 >>
提交
0b3cf1cd
编写于
3月 06, 2015
作者:
D
Derek Parker
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add command to print active breakpoints
上级
464a6b96
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
42 addition
and
4 deletion
+42
-4
README.md
README.md
+2
-0
command/command.go
command/command.go
+32
-0
proctl/breakpoints.go
proctl/breakpoints.go
+5
-1
proctl/proctl.go
proctl/proctl.go
+2
-2
proctl/threads.go
proctl/threads.go
+1
-1
未找到文件。
README.md
浏览文件 @
0b3cf1cd
...
...
@@ -85,6 +85,8 @@ Once inside a debugging session, the following commands may be used:
*
`goroutines`
- Print status of all goroutines.
*
`breakpoints`
- Print information on all active breakpoints.
*
`print $var`
- Evaluate a variable.
*
`info $type [regex]`
- Outputs information about the symbol table. An optional regex filters the list. Example
`info funcs unicode`
. Valid types are:
...
...
command/command.go
浏览文件 @
0b3cf1cd
...
...
@@ -50,6 +50,7 @@ func DebugCommands() *Commands {
command
{
aliases
:
[]
string
{
"threads"
},
cmdFn
:
threads
,
helpMsg
:
"Print out info for every traced thread."
},
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
{
"breakpoints"
,
"bp"
},
cmdFn
:
breakpoints
,
helpMsg
:
"Print out info for active breakpoints."
},
command
{
aliases
:
[]
string
{
"print"
,
"p"
},
cmdFn
:
printVar
,
helpMsg
:
"Evaluate a variable."
},
command
{
aliases
:
[]
string
{
"info"
},
cmdFn
:
info
,
helpMsg
:
"Provides info about args, funcs, locals, sources, or vars."
},
command
{
aliases
:
[]
string
{
"exit"
},
cmdFn
:
nullCommand
,
helpMsg
:
"Exit the debugger."
},
...
...
@@ -165,6 +166,37 @@ func clear(p *proctl.DebuggedProcess, args ...string) error {
return
nil
}
type
ById
[]
*
proctl
.
BreakPoint
func
(
a
ById
)
Len
()
int
{
return
len
(
a
)
}
func
(
a
ById
)
Swap
(
i
,
j
int
)
{
a
[
i
],
a
[
j
]
=
a
[
j
],
a
[
i
]
}
func
(
a
ById
)
Less
(
i
,
j
int
)
bool
{
return
a
[
i
]
.
ID
<
a
[
j
]
.
ID
}
func
breakpoints
(
p
*
proctl
.
DebuggedProcess
,
args
...
string
)
error
{
bps
:=
make
([]
*
proctl
.
BreakPoint
,
0
,
len
(
p
.
BreakPoints
)
+
4
)
for
_
,
bp
:=
range
p
.
HWBreakPoints
{
if
bp
==
nil
{
continue
}
bps
=
append
(
bps
,
bp
)
}
for
_
,
bp
:=
range
p
.
BreakPoints
{
if
bp
.
Temp
{
continue
}
bps
=
append
(
bps
,
bp
)
}
sort
.
Sort
(
ById
(
bps
))
for
_
,
bp
:=
range
bps
{
fmt
.
Println
(
bp
)
}
return
nil
}
func
breakpoint
(
p
*
proctl
.
DebuggedProcess
,
args
...
string
)
error
{
if
len
(
args
)
==
0
{
return
fmt
.
Errorf
(
"not enough arguments"
)
...
...
proctl/breakpoints.go
浏览文件 @
0b3cf1cd
...
...
@@ -15,7 +15,11 @@ type BreakPoint struct {
Addr
uint64
OriginalData
[]
byte
ID
int
temp
bool
Temp
bool
}
func
(
bp
*
BreakPoint
)
String
()
string
{
return
fmt
.
Sprintf
(
"Breakpoint %d at %#v %s:%d"
,
bp
.
ID
,
bp
.
Addr
,
bp
.
File
,
bp
.
Line
)
}
// Returned when trying to set a breakpoint at
...
...
proctl/proctl.go
浏览文件 @
0b3cf1cd
...
...
@@ -274,7 +274,7 @@ func (dbp *DebuggedProcess) Continue() error {
// Check for hardware breakpoint
for
_
,
bp
:=
range
dbp
.
HWBreakPoints
{
if
bp
!=
nil
&&
bp
.
Addr
==
pc
{
if
!
bp
.
t
emp
{
if
!
bp
.
T
emp
{
return
dbp
.
Halt
()
}
return
nil
...
...
@@ -282,7 +282,7 @@ func (dbp *DebuggedProcess) Continue() error {
}
// Check to see if we have hit a software breakpoint.
if
bp
,
ok
:=
dbp
.
BreakPoints
[
pc
-
1
];
ok
{
if
!
bp
.
t
emp
{
if
!
bp
.
T
emp
{
return
dbp
.
Halt
()
}
return
nil
...
...
proctl/threads.go
浏览文件 @
0b3cf1cd
...
...
@@ -185,7 +185,7 @@ func (thread *ThreadContext) continueToReturnAddress(pc uint64, fde *frame.Frame
return
err
}
}
bp
.
t
emp
=
true
bp
.
T
emp
=
true
// Ensure we cleanup after ourselves no matter what.
defer
thread
.
clearTempBreakpoint
(
bp
.
Addr
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录