-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
71 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,13 @@ | ||
package obj | ||
|
||
import ( | ||
"unsafe" | ||
) | ||
|
||
const ( | ||
InvalidOffset = int(-1) | ||
InvalidIndex = uint32(0xFFFFFFFF) | ||
EmptyPkgPath = `""` | ||
EmptyString = "" | ||
InvalidOffset = int(-1) | ||
InvalidIndex = uint32(0xFFFFFFFF) | ||
InlinedCallSize = int(unsafe.Sizeof(InlinedCall{})) | ||
EmptyPkgPath = `""` | ||
EmptyString = "" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
//go:build go1.8 && !go1.9 | ||
// +build go1.8,!go1.9 | ||
|
||
package obj | ||
|
||
//golang 1.8 not support inline | ||
type InlinedCall struct { | ||
} | ||
|
||
func InitInlinedCall(inl InlTreeNode, funcid uint8, namemap map[string]int, filetab []uint32) InlinedCall { | ||
return InlinedCall{} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,20 @@ | ||
//go:build go1.9 && !go1.12 | ||
// +build go1.9,!go1.12 | ||
|
||
package goloader | ||
|
||
import ( | ||
"github.com/pkujhd/goloader/obj" | ||
) | ||
package obj | ||
|
||
// inlinedCall is the encoding of entries in the FUNCDATA_InlTree table. | ||
type inlinedCall struct { | ||
type InlinedCall struct { | ||
parent int32 // index of parent in the inltree, or < 0 | ||
file int32 // fileno index into filetab | ||
line int32 // line number of the call site | ||
func_ int32 // offset into pclntab for name of called function | ||
} | ||
|
||
func (linker *Linker) initInlinedCall(inl obj.InlTreeNode, _func *_func) inlinedCall { | ||
return inlinedCall{ | ||
func InitInlinedCall(inl InlTreeNode, funcid uint8, namemap map[string]int, filetab []uint32) InlinedCall { | ||
return InlinedCall{ | ||
parent: int32(inl.Parent), | ||
file: findFileTab(linker, inl.File), | ||
file: findFileTab(inl.File, namemap, filetab), | ||
line: int32(inl.Line), | ||
func_: int32(linker.namemap[inl.Func])} | ||
func_: int32(namemap[inl.Func])} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package obj | ||
|
||
func findFileTab(filename string, namemap map[string]int, filetab []uint32) int32 { | ||
tab := namemap[filename] | ||
for index, value := range filetab { | ||
if uint32(tab) == value { | ||
return int32(index) | ||
} | ||
} | ||
return -1 | ||
} | ||
|
||
func grow(bytes *[]byte, size int) { | ||
if len(*bytes) < size { | ||
*bytes = append(*bytes, make([]byte, size-len(*bytes))...) | ||
} | ||
} |