mirror of
https://github.com/go-delve/delve.git
synced 2025-10-31 02:36:18 +08:00
proc: adds pointer pinning to call injection (#3787)
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
This commit is contained in:
committed by
GitHub
parent
52405ba86b
commit
025d47c6e9
@ -89,6 +89,8 @@ const (
|
||||
// variableTrustLen means that when this variable is loaded its length
|
||||
// should be trusted and used instead of MaxArrayValues
|
||||
variableTrustLen
|
||||
|
||||
variableSaved
|
||||
)
|
||||
|
||||
// Variable represents a variable. It contains the address, name,
|
||||
@ -1235,7 +1237,7 @@ func (v *Variable) maybeDereference() *Variable {
|
||||
|
||||
switch t := v.RealType.(type) {
|
||||
case *godwarf.PtrType:
|
||||
if v.Addr == 0 && len(v.Children) == 1 && v.loaded {
|
||||
if (v.Addr == 0 || v.Flags&VariableFakeAddress != 0) && len(v.Children) == 1 && v.loaded {
|
||||
// fake pointer variable constructed by casting an integer to a pointer type
|
||||
return &v.Children[0]
|
||||
}
|
||||
@ -1469,7 +1471,7 @@ func convertToEface(srcv, dstv *Variable) error {
|
||||
}
|
||||
typeAddr, typeKind, runtimeTypeFound, err := dwarfToRuntimeType(srcv.bi, srcv.mem, srcv.RealType)
|
||||
if err != nil {
|
||||
return err
|
||||
return fmt.Errorf("can not convert value of type %s to %s: %v", srcv.DwarfType.String(), dstv.DwarfType.String(), err)
|
||||
}
|
||||
if !runtimeTypeFound || typeKind&kindDirectIface == 0 {
|
||||
return &typeConvErr{srcv.DwarfType, dstv.RealType}
|
||||
|
||||
Reference in New Issue
Block a user