Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
HugeYuan
delve
提交
f1ceba09
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,发现更多精彩内容 >>
提交
f1ceba09
编写于
10月 26, 2014
作者:
D
Derek Parker
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Support 32 bit floats
上级
6af32b40
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
19 addition
and
8 deletion
+19
-8
_fixtures/testvariables.go
_fixtures/testvariables.go
+2
-1
proctl/variables_linux_amd64.go
proctl/variables_linux_amd64.go
+15
-6
proctl/variables_test.go
proctl/variables_test.go
+2
-1
未找到文件。
_fixtures/testvariables.go
浏览文件 @
f1ceba09
...
@@ -18,9 +18,10 @@ func foobar(baz string) {
...
@@ -18,9 +18,10 @@ func foobar(baz string) {
a7
=
&
FooBar
{
Baz
:
5
,
Bur
:
"strum"
}
a7
=
&
FooBar
{
Baz
:
5
,
Bur
:
"strum"
}
neg
=
-
1
neg
=
-
1
i8
=
int8
(
1
)
i8
=
int8
(
1
)
f32
=
float32
(
1.2
)
)
)
fmt
.
Println
(
a1
,
a2
,
a3
,
a4
,
a5
,
a6
,
a7
,
baz
,
neg
,
i8
)
fmt
.
Println
(
a1
,
a2
,
a3
,
a4
,
a5
,
a6
,
a7
,
baz
,
neg
,
i8
,
f32
)
}
}
func
main
()
{
func
main
()
{
...
...
proctl/variables_linux_amd64.go
浏览文件 @
f1ceba09
...
@@ -141,7 +141,7 @@ func (thread *ThreadContext) extractValue(instructions []byte, off int64, typ in
...
@@ -141,7 +141,7 @@ func (thread *ThreadContext) extractValue(instructions []byte, off int64, typ in
case
*
dwarf
.
IntType
:
case
*
dwarf
.
IntType
:
return
thread
.
readInt
(
offaddr
,
t
.
ByteSize
)
return
thread
.
readInt
(
offaddr
,
t
.
ByteSize
)
case
*
dwarf
.
FloatType
:
case
*
dwarf
.
FloatType
:
return
thread
.
readFloat
64
(
offaddr
)
return
thread
.
readFloat
(
offaddr
,
t
.
ByteSize
)
}
}
return
""
,
fmt
.
Errorf
(
"could not find value for type %s"
,
typ
)
return
""
,
fmt
.
Errorf
(
"could not find value for type %s"
,
typ
)
...
@@ -242,16 +242,25 @@ func (thread *ThreadContext) readInt(addr uintptr, size int64) (string, error) {
...
@@ -242,16 +242,25 @@ func (thread *ThreadContext) readInt(addr uintptr, size int64) (string, error) {
return
strconv
.
Itoa
(
n
),
nil
return
strconv
.
Itoa
(
n
),
nil
}
}
func
(
thread
*
ThreadContext
)
readFloat64
(
addr
uintptr
)
(
string
,
error
)
{
func
(
thread
*
ThreadContext
)
readFloat
(
addr
uintptr
,
size
int64
)
(
string
,
error
)
{
var
n
float64
val
,
err
:=
thread
.
readMemory
(
addr
,
uintptr
(
size
))
val
,
err
:=
thread
.
readMemory
(
addr
,
8
)
if
err
!=
nil
{
if
err
!=
nil
{
return
""
,
err
return
""
,
err
}
}
buf
:=
bytes
.
NewBuffer
(
val
)
buf
:=
bytes
.
NewBuffer
(
val
)
switch
size
{
case
4
:
n
:=
float32
(
0
)
binary
.
Read
(
buf
,
binary
.
LittleEndian
,
&
n
)
return
strconv
.
FormatFloat
(
float64
(
n
),
'f'
,
-
1
,
int
(
size
)
*
8
),
nil
case
8
:
n
:=
float64
(
0
)
binary
.
Read
(
buf
,
binary
.
LittleEndian
,
&
n
)
binary
.
Read
(
buf
,
binary
.
LittleEndian
,
&
n
)
return
strconv
.
FormatFloat
(
n
,
'f'
,
-
1
,
int
(
size
)
*
8
),
nil
}
return
strconv
.
FormatFloat
(
n
,
'f'
,
-
1
,
64
),
nil
return
""
,
fmt
.
Errorf
(
"could not read float"
)
}
}
func
(
thread
*
ThreadContext
)
readMemory
(
addr
uintptr
,
size
uintptr
)
([]
byte
,
error
)
{
func
(
thread
*
ThreadContext
)
readMemory
(
addr
uintptr
,
size
uintptr
)
([]
byte
,
error
)
{
...
...
proctl/variables_test.go
浏览文件 @
f1ceba09
...
@@ -31,10 +31,11 @@ func TestVariableEvaluation(t *testing.T) {
...
@@ -31,10 +31,11 @@ func TestVariableEvaluation(t *testing.T) {
{
"baz"
,
"bazburzum"
,
"struct string"
},
{
"baz"
,
"bazburzum"
,
"struct string"
},
{
"neg"
,
"-1"
,
"int"
},
{
"neg"
,
"-1"
,
"int"
},
{
"i8"
,
"1"
,
"int8"
},
{
"i8"
,
"1"
,
"int8"
},
{
"f32"
,
"1.2"
,
"float32"
},
}
}
helper
.
WithTestProcess
(
executablePath
,
t
,
func
(
p
*
proctl
.
DebuggedProcess
)
{
helper
.
WithTestProcess
(
executablePath
,
t
,
func
(
p
*
proctl
.
DebuggedProcess
)
{
pc
,
_
,
_
:=
p
.
GoSymTable
.
LineToPC
(
fp
,
2
3
)
pc
,
_
,
_
:=
p
.
GoSymTable
.
LineToPC
(
fp
,
2
4
)
_
,
err
:=
p
.
Break
(
uintptr
(
pc
))
_
,
err
:=
p
.
Break
(
uintptr
(
pc
))
assertNoError
(
err
,
t
,
"Break() returned an error"
)
assertNoError
(
err
,
t
,
"Break() returned an error"
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录