Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
pubx
delve
提交
5d109cb1
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,发现更多精彩内容 >>
提交
5d109cb1
编写于
3月 28, 2020
作者:
D
Derek Parker
提交者:
Alessandro Arzilli
3月 28, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
*: Add some more documentation to exported types and methods
上级
5177c247
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
37 addition
and
4 deletion
+37
-4
pkg/dwarf/op/op.go
pkg/dwarf/op/op.go
+3
-1
pkg/dwarf/op/regs.go
pkg/dwarf/op/regs.go
+1
-0
pkg/proc/amd64_arch.go
pkg/proc/amd64_arch.go
+4
-3
pkg/proc/arch.go
pkg/proc/arch.go
+23
-0
pkg/proc/i386_disasm.go
pkg/proc/i386_disasm.go
+2
-0
pkg/proc/registers.go
pkg/proc/registers.go
+4
-0
未找到文件。
pkg/dwarf/op/op.go
浏览文件 @
5d109cb1
...
...
@@ -10,6 +10,8 @@ import (
"github.com/go-delve/delve/pkg/dwarf/util"
)
// Opcode represent a DWARF stack program instruction.
// See ./opcodes.go for a full list.
type
Opcode
byte
//go:generate go run ../../../scripts/gen-opcodes.go opcodes.table opcodes.go
...
...
@@ -76,7 +78,7 @@ func ExecuteStackProgram(regs DwarfRegisters, instructions []byte, ptrSize int)
return
ctxt
.
stack
[
len
(
ctxt
.
stack
)
-
1
],
nil
,
nil
}
// PrettyPrint prints
instructions to out
.
// PrettyPrint prints
the DWARF stack program instructions to `out`
.
func
PrettyPrint
(
out
io
.
Writer
,
instructions
[]
byte
)
{
in
:=
bytes
.
NewBuffer
(
instructions
)
...
...
pkg/dwarf/op/regs.go
浏览文件 @
5d109cb1
...
...
@@ -5,6 +5,7 @@ import (
"encoding/binary"
)
// DwarfRegisters holds the value of stack program registers.
type
DwarfRegisters
struct
{
StaticBase
uint64
...
...
pkg/proc/amd64_arch.go
浏览文件 @
5d109cb1
...
...
@@ -110,15 +110,15 @@ func (a *AMD64) FixFrameUnwindContext(fctxt *frame.FrameContext, pc uint64, bi *
return
&
frame
.
FrameContext
{
RetAddrReg
:
amd64DwarfIPRegNum
,
Regs
:
map
[
uint64
]
frame
.
DWRule
{
amd64DwarfIPRegNum
:
frame
.
DWRule
{
amd64DwarfIPRegNum
:
{
Rule
:
frame
.
RuleOffset
,
Offset
:
int64
(
-
a
.
PtrSize
()),
},
amd64DwarfBPRegNum
:
frame
.
DWRule
{
amd64DwarfBPRegNum
:
{
Rule
:
frame
.
RuleOffset
,
Offset
:
int64
(
-
2
*
a
.
PtrSize
()),
},
amd64DwarfSPRegNum
:
frame
.
DWRule
{
amd64DwarfSPRegNum
:
{
Rule
:
frame
.
RuleValOffset
,
Offset
:
0
,
},
...
...
@@ -426,6 +426,7 @@ func (a *AMD64) AddrAndStackRegsToDwarfRegisters(staticBase, pc, sp, bp, lr uint
}
}
// DwarfRegisterToString returns the name and value representation of the given register.
func
(
a
*
AMD64
)
DwarfRegisterToString
(
i
int
,
reg
*
op
.
DwarfRegister
)
(
name
string
,
floatingPoint
bool
,
repr
string
)
{
name
,
ok
:=
amd64DwarfToName
[
i
]
if
!
ok
{
...
...
pkg/proc/arch.go
浏览文件 @
5d109cb1
...
...
@@ -8,20 +8,43 @@ import (
// Arch defines an interface for representing a
// CPU architecture.
type
Arch
interface
{
// PtrSize returns the size of a pointer for the architecture.
PtrSize
()
int
// MaxInstructionLength is the maximum size in bytes of an instruction.
MaxInstructionLength
()
int
// AsmDecode decodes the assembly instruction starting at mem[0:] into asmInst.
// It assumes that the Loc and AtPC fields of asmInst have already been filled.
AsmDecode
(
asmInst
*
AsmInstruction
,
mem
[]
byte
,
regs
Registers
,
memrw
MemoryReadWriter
,
bi
*
BinaryInfo
)
error
// Prologues returns a list of stack split prologues
// that are inserted at function entry.
Prologues
()
[]
opcodeSeq
// BreakpointInstruction is the instruction that will trigger a breakpoint trap for
// the given architecture.
BreakpointInstruction
()
[]
byte
// BreakInstrMovesPC is true if hitting the breakpoint instruction advances the
// instruction counter by the size of the breakpoint instruction.
BreakInstrMovesPC
()
bool
// BreakpointSize is the size of the breakpoint instruction for the given architecture.
BreakpointSize
()
int
// DerefTLS is true if the G struct stored in the TLS section is a pointer
// and the address must be dereferenced to find to actual G struct.
DerefTLS
()
bool
// FixFrameUnwindContext applies architecture specific rules for unwinding a stack frame
// on the given arch.
FixFrameUnwindContext
(
*
frame
.
FrameContext
,
uint64
,
*
BinaryInfo
)
*
frame
.
FrameContext
// SwitchStack will use the current frame to determine if it's time to
// switch between the system stack and the goroutine stack or vice versa.
SwitchStack
(
it
*
stackIterator
,
callFrameRegs
*
op
.
DwarfRegisters
)
bool
// RegSize returns the size (in bytes) of register regnum.
RegSize
(
uint64
)
int
// RegistersToDwarfRegisters maps hardware registers to DWARF registers.
RegistersToDwarfRegisters
(
uint64
,
Registers
)
op
.
DwarfRegisters
// AddrAndStackRegsToDwarfRegisters returns DWARF registers from the passed in
// PC, SP, and BP registers in the format used by the DWARF expression interpreter.
AddrAndStackRegsToDwarfRegisters
(
uint64
,
uint64
,
uint64
,
uint64
,
uint64
)
op
.
DwarfRegisters
// DwarfRegisterToString returns the name and value representation of the given register.
DwarfRegisterToString
(
int
,
*
op
.
DwarfRegister
)
(
string
,
bool
,
string
)
// InhibitStepInto returns whether StepBreakpoint can be set at pc.
InhibitStepInto
(
bi
*
BinaryInfo
,
pc
uint64
)
bool
}
...
...
pkg/proc/i386_disasm.go
浏览文件 @
5d109cb1
...
...
@@ -14,6 +14,8 @@ func (i *I386) AsmDecode(asmInst *AsmInstruction, mem []byte, regs Registers, me
return
x86AsmDecode
(
asmInst
,
mem
,
regs
,
memrw
,
bi
,
32
)
}
// Prologues returns a list of stack split prologues
// that are inserted at function entry.
func
(
i
*
I386
)
Prologues
()
[]
opcodeSeq
{
return
prologuesI386
}
...
...
pkg/proc/registers.go
浏览文件 @
5d109cb1
...
...
@@ -33,10 +33,14 @@ type Register struct {
Reg
*
op
.
DwarfRegister
}
// AppendUint64Register will create a new Register struct with the name and value
// specified and append it to the `regs` slice.
func
AppendUint64Register
(
regs
[]
Register
,
name
string
,
value
uint64
)
[]
Register
{
return
append
(
regs
,
Register
{
name
,
op
.
DwarfRegisterFromUint64
(
value
)})
}
// AppendBytesRegister will create a new Register struct with the name and value
// specified and append it to the `regs` slice.
func
AppendBytesRegister
(
regs
[]
Register
,
name
string
,
value
[]
byte
)
[]
Register
{
return
append
(
regs
,
Register
{
name
,
op
.
DwarfRegisterFromBytes
(
value
)})
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录