Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
HugeYuan
delve
提交
14aeea2b
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,发现更多精彩内容 >>
提交
14aeea2b
编写于
2月 26, 2019
作者:
A
Alessandro Arzilli
提交者:
Derek Parker
2月 26, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
proc/gdbserial: do not return floating point regs when not requested (#1497)
Fixes #1493
上级
0e1c7427
变更
11
显示空白变更内容
内联
并排
Showing
11 changed file
with
47 addition
and
18 deletion
+47
-18
pkg/proc/arch.go
pkg/proc/arch.go
+1
-1
pkg/proc/core/core_test.go
pkg/proc/core/core_test.go
+3
-3
pkg/proc/gdbserial/gdbserver.go
pkg/proc/gdbserial/gdbserver.go
+11
-3
pkg/proc/gdbserial/gdbserver_conn.go
pkg/proc/gdbserial/gdbserver_conn.go
+2
-1
pkg/proc/linutil/regs.go
pkg/proc/linutil/regs.go
+4
-2
pkg/proc/native/registers_darwin_amd64.go
pkg/proc/native/registers_darwin_amd64.go
+4
-2
pkg/proc/registers.go
pkg/proc/registers.go
+1
-1
pkg/proc/registers_amd64.go
pkg/proc/registers_amd64.go
+1
-1
pkg/proc/winutil/regs.go
pkg/proc/winutil/regs.go
+3
-3
pkg/terminal/command_test.go
pkg/terminal/command_test.go
+16
-0
service/debugger/debugger.go
service/debugger/debugger.go
+1
-1
未找到文件。
pkg/proc/arch.go
浏览文件 @
14aeea2b
...
...
@@ -284,7 +284,7 @@ func (a *AMD64) RegistersToDwarfRegisters(regs Registers, staticBase uint64) op.
}
}
for
_
,
reg
:=
range
regs
.
Slice
()
{
for
_
,
reg
:=
range
regs
.
Slice
(
true
)
{
for
dwarfReg
,
regName
:=
range
amd64DwarfToName
{
if
regName
==
reg
.
Name
{
dregs
[
dwarfReg
]
=
op
.
DwarfRegisterFromBytes
(
reg
.
Bytes
)
...
...
pkg/proc/core/core_test.go
浏览文件 @
14aeea2b
...
...
@@ -242,7 +242,7 @@ func TestCore(t *testing.T) {
if
err
!=
nil
{
t
.
Fatalf
(
"Couldn't get current thread registers: %v"
,
err
)
}
regslice
:=
regs
.
Slice
()
regslice
:=
regs
.
Slice
(
true
)
for
_
,
reg
:=
range
regslice
{
t
.
Logf
(
"%s = %s"
,
reg
.
Name
,
reg
.
Value
)
}
...
...
@@ -311,13 +311,13 @@ func TestCoreFpRegisters(t *testing.T) {
{
"XMM8"
,
"0x4059999a404ccccd4059999a404ccccd"
},
}
for
_
,
reg
:=
range
regs
.
Slice
()
{
for
_
,
reg
:=
range
regs
.
Slice
(
true
)
{
t
.
Logf
(
"%s = %s"
,
reg
.
Name
,
reg
.
Value
)
}
for
_
,
regtest
:=
range
regtests
{
found
:=
false
for
_
,
reg
:=
range
regs
.
Slice
()
{
for
_
,
reg
:=
range
regs
.
Slice
(
true
)
{
if
reg
.
Name
==
regtest
.
name
{
found
=
true
if
!
strings
.
HasPrefix
(
reg
.
Value
,
regtest
.
value
)
{
...
...
pkg/proc/gdbserial/gdbserver.go
浏览文件 @
14aeea2b
...
...
@@ -1826,9 +1826,12 @@ func (t *Thread) SetDX(dx uint64) error {
return
t
.
p
.
conn
.
writeRegister
(
t
.
strID
,
reg
.
regnum
,
reg
.
value
)
}
func
(
regs
*
gdbRegisters
)
Slice
()
[]
proc
.
Register
{
func
(
regs
*
gdbRegisters
)
Slice
(
floatingPoint
bool
)
[]
proc
.
Register
{
r
:=
make
([]
proc
.
Register
,
0
,
len
(
regs
.
regsInfo
))
for
_
,
reginfo
:=
range
regs
.
regsInfo
{
if
reginfo
.
Group
==
"float"
&&
!
floatingPoint
{
continue
}
switch
{
case
reginfo
.
Name
==
"eflags"
:
r
=
proc
.
AppendEflagReg
(
r
,
reginfo
.
Name
,
uint64
(
binary
.
LittleEndian
.
Uint32
(
regs
.
regs
[
reginfo
.
Name
]
.
value
)))
...
...
@@ -1841,6 +1844,9 @@ func (regs *gdbRegisters) Slice() []proc.Register {
case
reginfo
.
Bitsize
==
64
:
r
=
proc
.
AppendQwordReg
(
r
,
reginfo
.
Name
,
binary
.
LittleEndian
.
Uint64
(
regs
.
regs
[
reginfo
.
Name
]
.
value
))
case
reginfo
.
Bitsize
==
80
:
if
!
floatingPoint
{
continue
}
idx
:=
0
for
_
,
stprefix
:=
range
[]
string
{
"stmm"
,
"st"
}
{
if
strings
.
HasPrefix
(
reginfo
.
Name
,
stprefix
)
{
...
...
@@ -1852,10 +1858,12 @@ func (regs *gdbRegisters) Slice() []proc.Register {
r
=
proc
.
AppendX87Reg
(
r
,
idx
,
binary
.
LittleEndian
.
Uint16
(
value
[
8
:
]),
binary
.
LittleEndian
.
Uint64
(
value
[
:
8
]))
case
reginfo
.
Bitsize
==
128
:
if
floatingPoint
{
r
=
proc
.
AppendSSEReg
(
r
,
strings
.
ToUpper
(
reginfo
.
Name
),
regs
.
regs
[
reginfo
.
Name
]
.
value
)
}
case
reginfo
.
Bitsize
==
256
:
if
!
strings
.
HasPrefix
(
strings
.
ToLower
(
reginfo
.
Name
),
"ymm"
)
{
if
!
strings
.
HasPrefix
(
strings
.
ToLower
(
reginfo
.
Name
),
"ymm"
)
||
!
floatingPoint
{
continue
}
...
...
pkg/proc/gdbserial/gdbserver_conn.go
浏览文件 @
14aeea2b
...
...
@@ -228,6 +228,7 @@ type gdbRegisterInfo struct {
Bitsize
int
`xml:"bitsize,attr"`
Offset
int
Regnum
int
`xml:"regnum,attr"`
Group
string
`xml:"group,attr"`
}
// readTargetXml reads target.xml file from stub using qXfer:features:read,
...
...
pkg/proc/linutil/regs.go
浏览文件 @
14aeea2b
...
...
@@ -51,7 +51,7 @@ type AMD64PtraceRegs struct {
}
// Slice returns the registers as a list of (name, value) pairs.
func
(
r
*
AMD64Registers
)
Slice
()
[]
proc
.
Register
{
func
(
r
*
AMD64Registers
)
Slice
(
floatingPoint
bool
)
[]
proc
.
Register
{
var
regs
=
[]
struct
{
k
string
v
uint64
...
...
@@ -92,7 +92,9 @@ func (r *AMD64Registers) Slice() []proc.Register {
out
=
proc
.
AppendQwordReg
(
out
,
reg
.
k
,
reg
.
v
)
}
}
if
floatingPoint
{
out
=
append
(
out
,
r
.
Fpregs
...
)
}
return
out
}
...
...
pkg/proc/native/registers_darwin_amd64.go
浏览文件 @
14aeea2b
...
...
@@ -42,7 +42,7 @@ type Regs struct {
fpregs
[]
proc
.
Register
}
func
(
r
*
Regs
)
Slice
()
[]
proc
.
Register
{
func
(
r
*
Regs
)
Slice
(
floatingPoint
bool
)
[]
proc
.
Register
{
var
regs
=
[]
struct
{
k
string
v
uint64
...
...
@@ -78,7 +78,9 @@ func (r *Regs) Slice() []proc.Register {
out
=
proc
.
AppendQwordReg
(
out
,
reg
.
k
,
reg
.
v
)
}
}
if
floatingPoint
{
out
=
append
(
out
,
r
.
fpregs
...
)
}
return
out
}
...
...
pkg/proc/registers.go
浏览文件 @
14aeea2b
...
...
@@ -23,7 +23,7 @@ type Registers interface {
// GAddr returns the address of the G variable if it is known, 0 and false otherwise
GAddr
()
(
uint64
,
bool
)
Get
(
int
)
(
uint64
,
error
)
Slice
()
[]
Register
Slice
(
floatingPoint
bool
)
[]
Register
// Copy returns a copy of the registers that is guaranteed not to change
// when the registers of the associated thread change.
Copy
()
Registers
...
...
pkg/proc/registers_amd64.go
浏览文件 @
14aeea2b
...
...
@@ -79,7 +79,7 @@ func GetDwarfRegister(regs Registers, i int) []byte {
return
buf
.
Bytes
()
}
if
regname
,
ok
:=
dwarfToName
[
i
];
ok
{
regslice
:=
regs
.
Slice
()
regslice
:=
regs
.
Slice
(
true
)
for
_
,
reg
:=
range
regslice
{
if
reg
.
Name
==
regname
{
return
reg
.
Bytes
...
...
pkg/proc/winutil/regs.go
浏览文件 @
14aeea2b
...
...
@@ -74,7 +74,7 @@ func NewAMD64Registers(context *CONTEXT, TebBaseAddress uint64, floatingPoint bo
}
// Slice returns the registers as a list of (name, value) pairs.
func
(
r
*
AMD64Registers
)
Slice
()
[]
proc
.
Register
{
func
(
r
*
AMD64Registers
)
Slice
(
floatingPoint
bool
)
[]
proc
.
Register
{
var
regs
=
[]
struct
{
k
string
v
uint64
...
...
@@ -103,7 +103,7 @@ func (r *AMD64Registers) Slice() []proc.Register {
{
"TLS"
,
r
.
tls
},
}
outlen
:=
len
(
regs
)
if
r
.
fltSave
!=
nil
{
if
r
.
fltSave
!=
nil
&&
floatingPoint
{
outlen
+=
6
+
8
+
2
+
16
}
out
:=
make
([]
proc
.
Register
,
0
,
outlen
)
...
...
@@ -114,7 +114,7 @@ func (r *AMD64Registers) Slice() []proc.Register {
out
=
proc
.
AppendQwordReg
(
out
,
reg
.
k
,
reg
.
v
)
}
}
if
r
.
fltSave
!=
nil
{
if
r
.
fltSave
!=
nil
&&
floatingPoint
{
out
=
proc
.
AppendWordReg
(
out
,
"CW"
,
r
.
fltSave
.
ControlWord
)
out
=
proc
.
AppendWordReg
(
out
,
"SW"
,
r
.
fltSave
.
StatusWord
)
out
=
proc
.
AppendWordReg
(
out
,
"TW"
,
uint16
(
r
.
fltSave
.
TagWord
))
...
...
pkg/terminal/command_test.go
浏览文件 @
14aeea2b
...
...
@@ -847,3 +847,19 @@ func TestTruncateStacktrace(t *testing.T) {
}
})
}
func
TestIssue1493
(
t
*
testing
.
T
)
{
// The 'regs' command without the '-a' option should only return
// general purpose registers.
withTestTerminal
(
"continuetestprog"
,
t
,
func
(
term
*
FakeTerminal
)
{
r
:=
term
.
MustExec
(
"regs"
)
nr
:=
len
(
strings
.
Split
(
r
,
"
\n
"
))
t
.
Logf
(
"regs: %s"
,
r
)
ra
:=
term
.
MustExec
(
"regs -a"
)
nra
:=
len
(
strings
.
Split
(
ra
,
"
\n
"
))
t
.
Logf
(
"regs -a: %s"
,
ra
)
if
nr
>
nra
/
2
{
t
.
Fatalf
(
"'regs' returned too many registers (%d) compared to 'regs -a' (%d)"
,
nr
,
nra
)
}
})
}
service/debugger/debugger.go
浏览文件 @
14aeea2b
...
...
@@ -830,7 +830,7 @@ func (d *Debugger) Registers(threadID int, floatingPoint bool) (api.Registers, e
if
err
!=
nil
{
return
nil
,
err
}
return
api
.
ConvertRegisters
(
regs
.
Slice
()),
err
return
api
.
ConvertRegisters
(
regs
.
Slice
(
floatingPoint
)),
err
}
func
convertVars
(
pv
[]
*
proc
.
Variable
)
[]
api
.
Variable
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录