forked from pkujhd/goloader
-
Notifications
You must be signed in to change notification settings - Fork 0
/
func.1.8.go
53 lines (43 loc) · 1.15 KB
/
func.1.8.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
//go:build go1.8 && !go1.12
// +build go1.8,!go1.12
package goloader
import "github.com/pkujhd/goloader/obj"
type _func struct {
entry uintptr // start pc
nameoff int32 // function name
args int32 // in/out args size
_ int32 // previously legacy frame size; kept for layout compatibility
pcsp int32
pcfile int32
pcln int32
npcdata int32
nfuncdata int32
}
func initfunc(symbol *obj.ObjSymbol, nameOff, spOff, pcfileOff, pclnOff, cuOff int) _func {
fdata := _func{
entry: uintptr(0),
nameoff: int32(nameOff),
args: int32(symbol.Func.Args),
pcsp: int32(spOff),
pcfile: int32(pcfileOff),
pcln: int32(pclnOff),
npcdata: int32(len(symbol.Func.PCData)),
nfuncdata: int32(len(symbol.Func.FuncData)),
}
return fdata
}
func setfuncentry(f *_func, entry uintptr, text uintptr) {
f.entry = entry
}
func getfuncentry(f *_func, text uintptr) uintptr {
return f.entry
}
func getfuncname(f *_func, md *moduledata) string {
if f.nameoff <= 0 || f.nameoff >= int32(len(md.pclntable)) {
return EmptyString
}
return gostringnocopy(&(md.pclntable[f.nameoff]))
}
func getfuncID(f *_func) uint8 {
return 0
}