proc: allow simultaneous call injection to multiple goroutines (#1591)

* proc: allow simultaneous call injection to multiple goroutines

Changes the call injection code so that we can have multiple call
injections going on at the same time as long as they happen on distinct
goroutines.

* proc: fix EvalExpressionWithCalls for constant expressions

The lack of address of constant expressions would confuse EvalExpressionWithCalls

Fixes #1577
This commit is contained in:
Alessandro Arzilli
2019-06-30 19:44:30 +02:00
committed by Derek Parker
parent 55eed318fd
commit dd4fd5dc9c
14 changed files with 196 additions and 129 deletions

View File

@ -214,10 +214,10 @@ func (scope *EvalScope) evalAST(t ast.Expr) (*Variable, error) {
// try to interpret the selector as a package variable
if maybePkg, ok := node.X.(*ast.Ident); ok {
if maybePkg.Name == "runtime" && node.Sel.Name == "curg" {
if scope.Gvar == nil {
if scope.g == nil {
return nilVariable, nil
}
return scope.Gvar.clone(), nil
return scope.g.variable.clone(), nil
} else if maybePkg.Name == "runtime" && node.Sel.Name == "frameoff" {
return newConstant(constant.MakeInt64(scope.frameOffset), scope.Mem), nil
} else if v, err := scope.findGlobal(maybePkg.Name + "." + node.Sel.Name); err == nil {