Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
HugeYuan
delve
提交
b50052cc
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 搜索 >>
未验证
提交
b50052cc
编写于
9月 25, 2021
作者:
A
Alessandro Arzilli
提交者:
GitHub
9月 24, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
proc/native: support watchpoints on Windows (#2651)
上级
2b306e32
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
88 addition
and
98 deletion
+88
-98
Documentation/backend_test_health.md
Documentation/backend_test_health.md
+1
-2
pkg/proc/native/hwbreak_amd64.go
pkg/proc/native/hwbreak_amd64.go
+39
-0
pkg/proc/native/hwbreak_other.go
pkg/proc/native/hwbreak_other.go
+21
-0
pkg/proc/native/nonative_darwin.go
pkg/proc/native/nonative_darwin.go
+3
-10
pkg/proc/native/threads_darwin.go
pkg/proc/native/threads_darwin.go
+2
-9
pkg/proc/native/threads_freebsd.go
pkg/proc/native/threads_freebsd.go
+2
-9
pkg/proc/native/threads_linux_386.go
pkg/proc/native/threads_linux_386.go
+0
-12
pkg/proc/native/threads_linux_amd64.go
pkg/proc/native/threads_linux_amd64.go
+0
-33
pkg/proc/native/threads_linux_arm64.go
pkg/proc/native/threads_linux_arm64.go
+0
-12
pkg/proc/native/threads_windows.go
pkg/proc/native/threads_windows.go
+20
-8
pkg/proc/proc_test.go
pkg/proc/proc_test.go
+0
-3
未找到文件。
Documentation/backend_test_health.md
浏览文件 @
b50052cc
...
...
@@ -25,7 +25,6 @@ Tests skipped by each supported backend:
*
2 upstream issue - https://github.com/golang/go/issues/29322
*
rr skipped = 3
*
3 not implemented
*
windows skipped =
5
*
windows skipped =
2
*
1 broken
*
3 not implemented
*
1 upstream issue
pkg/proc/native/hwbreak_amd64.go
0 → 100644
浏览文件 @
b50052cc
package
native
import
(
"github.com/go-delve/delve/pkg/proc"
"github.com/go-delve/delve/pkg/proc/amd64util"
)
func
(
t
*
nativeThread
)
writeHardwareBreakpoint
(
addr
uint64
,
wtype
proc
.
WatchType
,
idx
uint8
)
error
{
return
t
.
withDebugRegisters
(
func
(
drs
*
amd64util
.
DebugRegisters
)
error
{
return
drs
.
SetBreakpoint
(
idx
,
addr
,
wtype
.
Read
(),
wtype
.
Write
(),
wtype
.
Size
())
})
}
func
(
t
*
nativeThread
)
clearHardwareBreakpoint
(
addr
uint64
,
wtype
proc
.
WatchType
,
idx
uint8
)
error
{
return
t
.
withDebugRegisters
(
func
(
drs
*
amd64util
.
DebugRegisters
)
error
{
drs
.
ClearBreakpoint
(
idx
)
return
nil
})
}
func
(
t
*
nativeThread
)
findHardwareBreakpoint
()
(
*
proc
.
Breakpoint
,
error
)
{
var
retbp
*
proc
.
Breakpoint
err
:=
t
.
withDebugRegisters
(
func
(
drs
*
amd64util
.
DebugRegisters
)
error
{
ok
,
idx
:=
drs
.
GetActiveBreakpoint
()
if
ok
{
for
_
,
bp
:=
range
t
.
dbp
.
Breakpoints
()
.
M
{
if
bp
.
WatchType
!=
0
&&
bp
.
HWBreakIndex
==
idx
{
retbp
=
bp
break
}
}
}
return
nil
})
if
err
!=
nil
{
return
nil
,
err
}
return
retbp
,
nil
}
pkg/proc/native/hwbreak_other.go
0 → 100644
浏览文件 @
b50052cc
// +build !amd64
package
native
import
(
"errors"
"github.com/go-delve/delve/pkg/proc"
)
func
(
t
*
nativeThread
)
findHardwareBreakpoint
()
(
*
proc
.
Breakpoint
,
error
)
{
return
nil
,
errors
.
New
(
"hardware breakpoints not supported"
)
}
func
(
t
*
nativeThread
)
writeHardwareBreakpoint
(
addr
uint64
,
wtype
proc
.
WatchType
,
idx
uint8
)
error
{
return
errors
.
New
(
"hardware breakpoints not supported"
)
}
func
(
t
*
nativeThread
)
clearHardwareBreakpoint
(
addr
uint64
,
wtype
proc
.
WatchType
,
idx
uint8
)
error
{
return
errors
.
New
(
"hardware breakpoints not supported"
)
}
pkg/proc/native/nonative_darwin.go
浏览文件 @
b50052cc
...
...
@@ -9,6 +9,7 @@ import (
"github.com/go-delve/delve/pkg/dwarf/op"
"github.com/go-delve/delve/pkg/proc"
"github.com/go-delve/delve/pkg/proc/amd64util"
"github.com/go-delve/delve/pkg/proc/internal/ebpf"
)
...
...
@@ -130,16 +131,8 @@ func (t *nativeThread) restoreRegisters(sr proc.Registers) error {
panic
(
ErrNativeBackendDisabled
)
}
func
(
t
*
nativeThread
)
findHardwareBreakpoint
()
(
*
proc
.
Breakpoint
,
error
)
{
panic
(
ErrNativeBackendDisabled
)
}
func
(
t
*
nativeThread
)
writeHardwareBreakpoint
(
addr
uint64
,
wtype
proc
.
WatchType
,
idx
uint8
)
error
{
panic
(
ErrNativeBackendDisabled
)
}
func
(
t
*
nativeThread
)
clearHardwareBreakpoint
(
addr
uint64
,
wtype
proc
.
WatchType
,
idx
uint8
)
error
{
panic
(
ErrNativeBackendDisabled
)
func
(
t
*
nativeThread
)
withDebugRegisters
(
f
func
(
*
amd64util
.
DebugRegisters
)
error
)
error
{
return
proc
.
ErrHWBreakUnsupported
}
// Stopped returns whether the thread is stopped at
...
...
pkg/proc/native/threads_darwin.go
浏览文件 @
b50052cc
...
...
@@ -13,6 +13,7 @@ import (
sys
"golang.org/x/sys/unix"
"github.com/go-delve/delve/pkg/proc"
"github.com/go-delve/delve/pkg/proc/amd64util"
)
// waitStatus is a synonym for the platform-specific WaitStatus
...
...
@@ -133,14 +134,6 @@ func (t *nativeThread) restoreRegisters(sr proc.Registers) error {
return
errors
.
New
(
"not implemented"
)
}
func
(
t
*
nativeThread
)
w
riteHardwareBreakpoint
(
addr
uint64
,
wtype
proc
.
WatchType
,
idx
uint8
)
error
{
func
(
t
*
nativeThread
)
w
ithDebugRegisters
(
f
func
(
*
amd64util
.
DebugRegisters
)
error
)
error
{
return
proc
.
ErrHWBreakUnsupported
}
func
(
t
*
nativeThread
)
clearHardwareBreakpoint
(
addr
uint64
,
wtype
proc
.
WatchType
,
idx
uint8
)
error
{
return
proc
.
ErrHWBreakUnsupported
}
func
(
t
*
nativeThread
)
findHardwareBreakpoint
()
(
*
proc
.
Breakpoint
,
error
)
{
return
nil
,
nil
}
pkg/proc/native/threads_freebsd.go
浏览文件 @
b50052cc
...
...
@@ -11,6 +11,7 @@ import (
sys
"golang.org/x/sys/unix"
"github.com/go-delve/delve/pkg/proc"
"github.com/go-delve/delve/pkg/proc/amd64util"
)
type
waitStatus
sys
.
WaitStatus
...
...
@@ -121,14 +122,6 @@ func (t *nativeThread) ReadMemory(data []byte, addr uint64) (n int, err error) {
return
n
,
err
}
func
(
t
*
nativeThread
)
w
riteHardwareBreakpoint
(
addr
uint64
,
wtype
proc
.
WatchType
,
idx
uint8
)
error
{
func
(
t
*
nativeThread
)
w
ithDebugRegisters
(
f
func
(
*
amd64util
.
DebugRegisters
)
error
)
error
{
return
proc
.
ErrHWBreakUnsupported
}
func
(
t
*
nativeThread
)
clearHardwareBreakpoint
(
addr
uint64
,
wtype
proc
.
WatchType
,
idx
uint8
)
error
{
return
proc
.
ErrHWBreakUnsupported
}
func
(
t
*
nativeThread
)
findHardwareBreakpoint
()
(
*
proc
.
Breakpoint
,
error
)
{
return
nil
,
nil
}
pkg/proc/native/threads_linux_386.go
浏览文件 @
b50052cc
...
...
@@ -8,15 +8,3 @@ import (
func
(
t
*
nativeThread
)
restoreRegisters
(
savedRegs
proc
.
Registers
)
error
{
return
fmt
.
Errorf
(
"restore regs not supported on i386"
)
}
func
(
t
*
nativeThread
)
writeHardwareBreakpoint
(
addr
uint64
,
wtype
proc
.
WatchType
,
idx
uint8
)
error
{
return
proc
.
ErrHWBreakUnsupported
}
func
(
t
*
nativeThread
)
clearHardwareBreakpoint
(
addr
uint64
,
wtype
proc
.
WatchType
,
idx
uint8
)
error
{
return
proc
.
ErrHWBreakUnsupported
}
func
(
t
*
nativeThread
)
findHardwareBreakpoint
()
(
*
proc
.
Breakpoint
,
error
)
{
return
nil
,
nil
}
pkg/proc/native/threads_linux_amd64.go
浏览文件 @
b50052cc
...
...
@@ -86,36 +86,3 @@ func (t *nativeThread) withDebugRegisters(f func(*amd64util.DebugRegisters) erro
}
return
err
}
func
(
t
*
nativeThread
)
writeHardwareBreakpoint
(
addr
uint64
,
wtype
proc
.
WatchType
,
idx
uint8
)
error
{
return
t
.
withDebugRegisters
(
func
(
drs
*
amd64util
.
DebugRegisters
)
error
{
return
drs
.
SetBreakpoint
(
idx
,
addr
,
wtype
.
Read
(),
wtype
.
Write
(),
wtype
.
Size
())
})
}
func
(
t
*
nativeThread
)
clearHardwareBreakpoint
(
addr
uint64
,
wtype
proc
.
WatchType
,
idx
uint8
)
error
{
return
t
.
withDebugRegisters
(
func
(
drs
*
amd64util
.
DebugRegisters
)
error
{
drs
.
ClearBreakpoint
(
idx
)
return
nil
})
}
func
(
t
*
nativeThread
)
findHardwareBreakpoint
()
(
*
proc
.
Breakpoint
,
error
)
{
var
retbp
*
proc
.
Breakpoint
err
:=
t
.
withDebugRegisters
(
func
(
drs
*
amd64util
.
DebugRegisters
)
error
{
ok
,
idx
:=
drs
.
GetActiveBreakpoint
()
if
ok
{
for
_
,
bp
:=
range
t
.
dbp
.
Breakpoints
()
.
M
{
if
bp
.
WatchType
!=
0
&&
bp
.
HWBreakIndex
==
idx
{
retbp
=
bp
break
}
}
}
return
nil
})
if
err
!=
nil
{
return
nil
,
err
}
return
retbp
,
nil
}
pkg/proc/native/threads_linux_arm64.go
浏览文件 @
b50052cc
...
...
@@ -42,15 +42,3 @@ func (t *nativeThread) restoreRegisters(savedRegs proc.Registers) error {
}
return
restoreRegistersErr
}
func
(
t
*
nativeThread
)
writeHardwareBreakpoint
(
addr
uint64
,
wtype
proc
.
WatchType
,
idx
uint8
)
error
{
return
proc
.
ErrHWBreakUnsupported
}
func
(
t
*
nativeThread
)
clearHardwareBreakpoint
(
addr
uint64
,
wtype
proc
.
WatchType
,
idx
uint8
)
error
{
return
proc
.
ErrHWBreakUnsupported
}
func
(
t
*
nativeThread
)
findHardwareBreakpoint
()
(
*
proc
.
Breakpoint
,
error
)
{
return
nil
,
nil
}
pkg/proc/native/threads_windows.go
浏览文件 @
b50052cc
...
...
@@ -7,6 +7,7 @@ import (
sys
"golang.org/x/sys/windows"
"github.com/go-delve/delve/pkg/proc"
"github.com/go-delve/delve/pkg/proc/amd64util"
"github.com/go-delve/delve/pkg/proc/winutil"
)
...
...
@@ -157,14 +158,25 @@ func (t *nativeThread) restoreRegisters(savedRegs proc.Registers) error {
return
_SetThreadContext
(
t
.
os
.
hThread
,
savedRegs
.
(
*
winutil
.
AMD64Registers
)
.
Context
)
}
func
(
t
*
nativeThread
)
w
riteHardwareBreakpoint
(
addr
uint64
,
wtype
proc
.
WatchType
,
idx
uint8
)
error
{
return
proc
.
ErrHWBreakUnsupported
}
func
(
t
*
nativeThread
)
w
ithDebugRegisters
(
f
func
(
*
amd64util
.
DebugRegisters
)
error
)
error
{
context
:=
winutil
.
NewCONTEXT
()
context
.
ContextFlags
=
_CONTEXT_DEBUG_REGISTERS
func
(
t
*
nativeThread
)
clearHardwareBreakpoint
(
addr
uint64
,
wtype
proc
.
WatchType
,
idx
uint8
)
error
{
return
proc
.
ErrHWBreakUnsupported
}
err
:=
_GetThreadContext
(
t
.
os
.
hThread
,
context
)
if
err
!=
nil
{
return
err
}
drs
:=
amd64util
.
NewDebugRegisters
(
&
context
.
Dr0
,
&
context
.
Dr1
,
&
context
.
Dr2
,
&
context
.
Dr3
,
&
context
.
Dr6
,
&
context
.
Dr7
)
err
=
f
(
drs
)
if
err
!=
nil
{
return
err
}
if
drs
.
Dirty
{
return
_SetThreadContext
(
t
.
os
.
hThread
,
context
)
}
func
(
t
*
nativeThread
)
findHardwareBreakpoint
()
(
*
proc
.
Breakpoint
,
error
)
{
return
nil
,
nil
return
nil
}
pkg/proc/proc_test.go
浏览文件 @
b50052cc
...
...
@@ -5332,7 +5332,6 @@ func TestVariablesWithExternalLinking(t *testing.T) {
}
func
TestWatchpointsBasic
(
t
*
testing
.
T
)
{
skipOn
(
t
,
"not implemented"
,
"windows"
)
skipOn
(
t
,
"not implemented"
,
"freebsd"
)
skipOn
(
t
,
"not implemented"
,
"darwin"
)
skipOn
(
t
,
"not implemented"
,
"386"
)
...
...
@@ -5378,7 +5377,6 @@ func TestWatchpointsBasic(t *testing.T) {
}
func
TestWatchpointCounts
(
t
*
testing
.
T
)
{
skipOn
(
t
,
"not implemented"
,
"windows"
)
skipOn
(
t
,
"not implemented"
,
"freebsd"
)
skipOn
(
t
,
"not implemented"
,
"darwin"
)
skipOn
(
t
,
"not implemented"
,
"386"
)
...
...
@@ -5496,7 +5494,6 @@ func TestDwrapStartLocation(t *testing.T) {
}
func
TestWatchpointStack
(
t
*
testing
.
T
)
{
skipOn
(
t
,
"not implemented"
,
"windows"
)
skipOn
(
t
,
"not implemented"
,
"freebsd"
)
skipOn
(
t
,
"not implemented"
,
"darwin"
)
skipOn
(
t
,
"not implemented"
,
"386"
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录