提交 bb9fbe10 编写于 作者: D Derek Parker

Refactor: Use arch specific address sizes

上级 e4fc5e32
...@@ -35,7 +35,7 @@ func (n NullAddrError) Error() string { ...@@ -35,7 +35,7 @@ func (n NullAddrError) Error() string {
func (dbp *DebuggedProcess) stacktrace(pc, sp uint64, depth int) ([]stackLocation, error) { func (dbp *DebuggedProcess) stacktrace(pc, sp uint64, depth int) ([]stackLocation, error) {
var ( var (
ret = pc ret = pc
data = make([]byte, 8) data = make([]byte, dbp.arch.PtrSize())
btoffset int64 btoffset int64
locations []stackLocation locations []stackLocation
retaddr uintptr retaddr uintptr
...@@ -46,7 +46,7 @@ func (dbp *DebuggedProcess) stacktrace(pc, sp uint64, depth int) ([]stackLocatio ...@@ -46,7 +46,7 @@ func (dbp *DebuggedProcess) stacktrace(pc, sp uint64, depth int) ([]stackLocatio
return nil, err return nil, err
} }
btoffset += fde.ReturnAddressOffset(ret) btoffset += fde.ReturnAddressOffset(ret)
retaddr = uintptr(int64(sp) + btoffset + (i * 8)) retaddr = uintptr(int64(sp) + btoffset + (i * int64(dbp.arch.PtrSize())))
if retaddr == 0 { if retaddr == 0 {
return nil, NullAddrError{} return nil, NullAddrError{}
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册