-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
proc: adds pointer pinning to call injection #3787
base: master
Are you sure you want to change the base?
Conversation
This commit adds a new mode to call injection. If the runtime.debugPinner function is available in the target executable it obtains a pinner by calling it and then uses it to pin the pointers in the results of call injection. This allows the code for call injection to be refactored to execute the calls in the normal order, since it doesn't need to be concerned with having space on the target's memory to store intermediate values. Updates go-delve#3310
dc74e97
to
93bdc6d
Compare
@@ -182,9 +182,17 @@ func GoroutineScope(t *Target, thread Thread) (*EvalScope, error) { | |||
return FrameToScope(t, thread.ProcessMemory(), g, threadID, locations...), nil | |||
} | |||
|
|||
func (scope *EvalScope) evalopFlags() evalop.Flags { | |||
flags := evalop.Flags(0) | |||
if scope.BinInfo.lookupOneFunc(evalop.DebugPinnerFunctionName) != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May be worth memoizing this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, this is the same as calling BinInfo.HasDebugPinner()
.
fncall.undoInjection = nil | ||
regs, err := curthread.Registers() | ||
if err == nil { | ||
callInjectionComplete2(scope, scope.BinInfo, stack.fncallPeek(), regs, curthread) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could replace the extra call to stack.fncallPeek
with the fncall
local, no?
This commit adds a new mode to call injection. If the runtime.debugPinner
function is available in the target executable it obtains a pinner by
calling it and then uses it to pin the pointers in the results of call
injection.
This allows the code for call injection to be refactored to execute the
calls in the normal order, since it doesn't need to be concerned with having
space on the target's memory to store intermediate values.
Updates #3310