1 Star 1 Fork 1

mjun1833/delve

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
auxv.go 841 Bytes
一键复制 编辑 原始数据 按行查看 历史
chainhelen 提交于 2020-03-11 00:34 +08:00 . pkg/proc,service: support linux/386 (#1884)
package linutil
import (
"bytes"
"encoding/binary"
)
const (
_AT_NULL = 0
_AT_ENTRY = 9
)
// EntryPointFromAuxv searches the elf auxiliary vector for the entry point
// address.
// For a description of the auxiliary vector (auxv) format see:
// System V Application Binary Interface, AMD64 Architecture Processor
// Supplement, section 3.4.3.
// System V Application Binary Interface, Intel386 Architecture Processor
// Supplement (fourth edition), section 3-28.
func EntryPointFromAuxv(auxv []byte, ptrSize int) uint64 {
rd := bytes.NewBuffer(auxv)
for {
tag, err := readUintRaw(rd, binary.LittleEndian, ptrSize)
if err != nil {
return 0
}
val, err := readUintRaw(rd, binary.LittleEndian, ptrSize)
if err != nil {
return 0
}
switch tag {
case _AT_NULL:
return 0
case _AT_ENTRY:
return val
}
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/mjun1833/delve.git
git@gitee.com:mjun1833/delve.git
mjun1833
delve
delve
v1.21.1

搜索帮助