proc: move AllGCache to a common struct

Add a new method "Common" to proc.Process that returns a pointer to a
struct that pkg/proc can use to store its things, independently of the
backend.

This is used here to replace the AllGCache typecasts, it will also be
used to store the return values of the stepout breakpoint and the state
for injected function calls.
This commit is contained in:
aarzilli
2018-05-10 21:25:59 +02:00
committed by Alessandro Arzilli
parent d04c60e0b9
commit f38a2816d1
6 changed files with 28 additions and 32 deletions

View File

@ -62,6 +62,8 @@ type Info interface {
ResumeNotify(chan<- struct{})
Exited() bool
BinInfo() *BinaryInfo
// Common returns a struct with fields common to all backends
Common() *CommonProcess
ThreadInfo
GoroutineInfo
@ -100,3 +102,11 @@ type BreakpointManipulation interface {
ClearBreakpoint(addr uint64) (*Breakpoint, error)
ClearInternalBreakpoints() error
}
type CommonProcess struct {
allGCache []*G
}
func (p *CommonProcess) ClearAllGCache() {
p.allGCache = nil
}