github.com/Rookout/GoSDK@v0.1.48/pkg/augs/breakpoint.go (about)

     1  package augs
     2  
     3  import (
     4  	"unsafe"
     5  
     6  	"github.com/Rookout/GoSDK/pkg/services/collection/variable"
     7  )
     8  
     9  
    10  
    11  type Breakpoint struct {
    12  	
    13  	Name string `json:"name"`
    14  	
    15  	File string `json:"file"`
    16  	
    17  	Line int `json:"line"`
    18  
    19  	
    20  	Stacktrace int `json:"stacktrace"`
    21  	Instances  []*BreakpointInstance
    22  }
    23  
    24  type BreakpointInstance struct {
    25  	Addr             uint64
    26  	VariableLocators []*variable.VariableLocator
    27  	Breakpoint       *Breakpoint
    28  	Function         *Function
    29  	FailedCounter    *uint64
    30  }
    31  
    32  func NewBreakpointInstance(addr uint64, breakpoint *Breakpoint, function *Function) *BreakpointInstance {
    33  	b := &BreakpointInstance{
    34  		Addr:       addr,
    35  		Breakpoint: breakpoint,
    36  		Function:   function,
    37  	}
    38  	return b
    39  }
    40  
    41  type Function struct {
    42  	Entry                   uint64
    43  	End                     uint64
    44  	StackFrameSize          int32
    45  	GetBreakpointInstances  func() []*BreakpointInstance
    46  	MiddleTrampolineAddress unsafe.Pointer
    47  	FinalTrampolinePointer  *uint64
    48  	PatchedBytes            []byte
    49  	Hooked                  bool
    50  	Prologue                []byte
    51  	FunctionCopyStateID     int
    52  }
    53  
    54  func NewFunction(entry uint64, end uint64, stackFrameSize int32, middleTrampolineAddress unsafe.Pointer, finalTrampolinePointer *uint64) *Function {
    55  	return &Function{
    56  		Entry:          entry,
    57  		End:            end,
    58  		StackFrameSize: stackFrameSize,
    59  		GetBreakpointInstances: func() []*BreakpointInstance {
    60  			return []*BreakpointInstance{}
    61  		},
    62  		MiddleTrampolineAddress: middleTrampolineAddress,
    63  		FinalTrampolinePointer:  finalTrampolinePointer,
    64  		Hooked:                  false,
    65  		FunctionCopyStateID:     -1, 
    66  	}
    67  }