diff --git a/service/rpc/client.go b/service/rpc/client.go index 59c94b96f1f5415afe421890c64ec04441041e34..9904ac78a16678068f74f116701e8eb582565de9 100644 --- a/service/rpc/client.go +++ b/service/rpc/client.go @@ -147,7 +147,7 @@ func (c *RPCClient) EvalVariable(symbol string) (*api.Variable, error) { func (c *RPCClient) EvalVariableFor(threadID int, symbol string) (*api.Variable, error) { v := new(api.Variable) - err := c.call("EvalThreadSymbol", threadID, v) + err := c.call("EvalThreadSymbol", ThreadSymbolArgs{threadID, symbol}, v) return v, err } diff --git a/service/test/integration_test.go b/service/test/integration_test.go index 93a408d33e8fc248be89ae75bfe105a43efab4bb..ca84680458d438870933566531337daf3826a938 100644 --- a/service/test/integration_test.go +++ b/service/test/integration_test.go @@ -601,3 +601,41 @@ func TestClientServer_FindLocations(t *testing.T) { findLocationHelper(t, c, "main.stacktraceme", false, 1, stacktracemeAddr) }) } + +func TestClientServer_EvalVariableFor(t *testing.T) { + withTestClient("testvariables", t, func(c service.Client) { + fp := testProgPath(t, "testvariables") + _, err := c.CreateBreakpoint(&api.Breakpoint{File: fp, Line: 59}) + if err != nil { + t.Fatalf("CreateBreakpoint(): %v", err) + } + + state := <-c.Continue() + + if state.Err != nil { + t.Fatalf("Continue(): %v\n", state.Err) + } + + var1, err := c.EvalVariable("a1") + if err != nil { + t.Fatalf("EvalVariable(): %v", err) + } + + t.Logf("var1: <%s>", var1.Value) + + if var1.Value != "foofoofoofoofoofoo" { + t.Fatalf("Wrong variable value (EvalVariable)", var1.Value) + } + + var2, err := c.EvalVariableFor(state.CurrentThread.ID, "a1") + if err != nil { + t.Fatalf("EvalVariableFor(): %v", err) + } + + t.Logf("var2: <%s>", var2.Value) + + if var2.Value != var1.Value { + t.Fatalf("Wrong variable value (EvalVariableFor)", var2.Value) + } + }) +}