mirror of
https://github.com/go-delve/delve.git
synced 2025-10-29 01:27:16 +08:00
Rename: s/EvalSymbol/EvalVariable/
This commit is contained in:
@ -463,8 +463,8 @@ func (dbp *DebuggedProcess) CurrentBreakpoint() *BreakPoint {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Returns the value of the named symbol.
|
// Returns the value of the named symbol.
|
||||||
func (dbp *DebuggedProcess) EvalSymbol(name string) (*Variable, error) {
|
func (dbp *DebuggedProcess) EvalVariable(name string) (*Variable, error) {
|
||||||
return dbp.CurrentThread.EvalSymbol(name)
|
return dbp.CurrentThread.EvalVariable(name)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns a reader for the dwarf data
|
// Returns a reader for the dwarf data
|
||||||
|
|||||||
@ -197,8 +197,8 @@ func parseG(thread *ThreadContext, gaddr uint64, deref bool) (*G, error) {
|
|||||||
return g, nil
|
return g, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns the value of the named symbol.
|
// Returns the value of the named variable.
|
||||||
func (thread *ThreadContext) EvalSymbol(name string) (*Variable, error) {
|
func (thread *ThreadContext) EvalVariable(name string) (*Variable, error) {
|
||||||
pc, err := thread.PC()
|
pc, err := thread.PC()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|||||||
@ -77,9 +77,9 @@ func TestVariableEvaluation(t *testing.T) {
|
|||||||
assertNoError(err, t, "Continue() returned an error")
|
assertNoError(err, t, "Continue() returned an error")
|
||||||
|
|
||||||
for _, tc := range testcases {
|
for _, tc := range testcases {
|
||||||
variable, err := p.EvalSymbol(tc.name)
|
variable, err := p.EvalVariable(tc.name)
|
||||||
if tc.err == nil {
|
if tc.err == nil {
|
||||||
assertNoError(err, t, "EvalSymbol() returned an error")
|
assertNoError(err, t, "EvalVariable() returned an error")
|
||||||
assertVariable(t, variable, tc)
|
assertVariable(t, variable, tc)
|
||||||
} else {
|
} else {
|
||||||
if tc.err.Error() != err.Error() {
|
if tc.err.Error() != err.Error() {
|
||||||
@ -101,10 +101,10 @@ func TestVariableFunctionScoping(t *testing.T) {
|
|||||||
assertNoError(err, t, "Continue() returned an error")
|
assertNoError(err, t, "Continue() returned an error")
|
||||||
p.Clear(pc)
|
p.Clear(pc)
|
||||||
|
|
||||||
_, err = p.EvalSymbol("a1")
|
_, err = p.EvalVariable("a1")
|
||||||
assertNoError(err, t, "Unable to find variable a1")
|
assertNoError(err, t, "Unable to find variable a1")
|
||||||
|
|
||||||
_, err = p.EvalSymbol("a2")
|
_, err = p.EvalVariable("a2")
|
||||||
assertNoError(err, t, "Unable to find variable a1")
|
assertNoError(err, t, "Unable to find variable a1")
|
||||||
|
|
||||||
// Move scopes, a1 exists here by a2 does not
|
// Move scopes, a1 exists here by a2 does not
|
||||||
@ -116,10 +116,10 @@ func TestVariableFunctionScoping(t *testing.T) {
|
|||||||
err = p.Continue()
|
err = p.Continue()
|
||||||
assertNoError(err, t, "Continue() returned an error")
|
assertNoError(err, t, "Continue() returned an error")
|
||||||
|
|
||||||
_, err = p.EvalSymbol("a1")
|
_, err = p.EvalVariable("a1")
|
||||||
assertNoError(err, t, "Unable to find variable a1")
|
assertNoError(err, t, "Unable to find variable a1")
|
||||||
|
|
||||||
_, err = p.EvalSymbol("a2")
|
_, err = p.EvalVariable("a2")
|
||||||
if err == nil {
|
if err == nil {
|
||||||
t.Fatalf("Can eval out of scope variable a2")
|
t.Fatalf("Can eval out of scope variable a2")
|
||||||
}
|
}
|
||||||
|
|||||||
@ -40,12 +40,12 @@ type Client interface {
|
|||||||
|
|
||||||
// ListPackageVariables lists all package variables in the context of the current thread.
|
// ListPackageVariables lists all package variables in the context of the current thread.
|
||||||
ListPackageVariables(filter string) ([]api.Variable, error)
|
ListPackageVariables(filter string) ([]api.Variable, error)
|
||||||
// EvalSymbol returns a variable in the context of the current thread.
|
// EvalVariable returns a variable in the context of the current thread.
|
||||||
EvalSymbol(symbol string) (*api.Variable, error)
|
EvalVariable(symbol string) (*api.Variable, error)
|
||||||
// ListPackageVariablesFor lists all package variables in the context of a thread.
|
// ListPackageVariablesFor lists all package variables in the context of a thread.
|
||||||
ListPackageVariablesFor(threadID int, filter string) ([]api.Variable, error)
|
ListPackageVariablesFor(threadID int, filter string) ([]api.Variable, error)
|
||||||
// EvalSymbolFor returns a variable in the context of the specified thread.
|
// EvalVariableFor returns a variable in the context of the specified thread.
|
||||||
EvalSymbolFor(threadID int, symbol string) (*api.Variable, error)
|
EvalVariableFor(threadID int, symbol string) (*api.Variable, error)
|
||||||
|
|
||||||
// ListSources lists all source files in the process matching filter.
|
// ListSources lists all source files in the process matching filter.
|
||||||
ListSources(filter string) ([]string, error)
|
ListSources(filter string) ([]string, error)
|
||||||
|
|||||||
@ -426,14 +426,14 @@ func (d *Debugger) FunctionArguments(threadID int) ([]api.Variable, error) {
|
|||||||
return vars, err
|
return vars, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *Debugger) EvalSymbolInThread(threadID int, symbol string) (*api.Variable, error) {
|
func (d *Debugger) EvalVariableInThread(threadID int, symbol string) (*api.Variable, error) {
|
||||||
var variable *api.Variable
|
var variable *api.Variable
|
||||||
err := d.withProcess(func(p *proctl.DebuggedProcess) error {
|
err := d.withProcess(func(p *proctl.DebuggedProcess) error {
|
||||||
thread, found := p.Threads[threadID]
|
thread, found := p.Threads[threadID]
|
||||||
if !found {
|
if !found {
|
||||||
return fmt.Errorf("couldn't find thread %d", threadID)
|
return fmt.Errorf("couldn't find thread %d", threadID)
|
||||||
}
|
}
|
||||||
v, err := thread.EvalSymbol(symbol)
|
v, err := thread.EvalVariable(symbol)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
@ -160,7 +160,7 @@ func (c *RESTClient) GetThread(id int) (*api.Thread, error) {
|
|||||||
return thread, nil
|
return thread, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *RESTClient) EvalSymbol(symbol string) (*api.Variable, error) {
|
func (c *RESTClient) EvalVariable(symbol string) (*api.Variable, error) {
|
||||||
var v *api.Variable
|
var v *api.Variable
|
||||||
err := c.doGET(fmt.Sprintf("/eval/%s", symbol), &v)
|
err := c.doGET(fmt.Sprintf("/eval/%s", symbol), &v)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -169,7 +169,7 @@ func (c *RESTClient) EvalSymbol(symbol string) (*api.Variable, error) {
|
|||||||
return v, nil
|
return v, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *RESTClient) EvalSymbolFor(threadID int, symbol string) (*api.Variable, error) {
|
func (c *RESTClient) EvalVariableFor(threadID int, symbol string) (*api.Variable, error) {
|
||||||
var v *api.Variable
|
var v *api.Variable
|
||||||
err := c.doGET(fmt.Sprintf("/threads/%d/eval/%s", threadID, symbol), &v)
|
err := c.doGET(fmt.Sprintf("/threads/%d/eval/%s", threadID, symbol), &v)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@ -354,7 +354,7 @@ func (s *RESTServer) evalSymbol(request *restful.Request, response *restful.Resp
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
v, err := s.debugger.EvalSymbolInThread(current.ID, symbol)
|
v, err := s.debugger.EvalVariableInThread(current.ID, symbol)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
writeError(response, http.StatusInternalServerError, err.Error())
|
writeError(response, http.StatusInternalServerError, err.Error())
|
||||||
return
|
return
|
||||||
@ -382,7 +382,7 @@ func (s *RESTServer) evalThreadSymbol(request *restful.Request, response *restfu
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
v, err := s.debugger.EvalSymbolInThread(id, symbol)
|
v, err := s.debugger.EvalVariableInThread(id, symbol)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
writeError(response, http.StatusInternalServerError, err.Error())
|
writeError(response, http.StatusInternalServerError, err.Error())
|
||||||
return
|
return
|
||||||
|
|||||||
@ -308,7 +308,7 @@ func printVar(client service.Client, args ...string) error {
|
|||||||
return fmt.Errorf("not enough arguments")
|
return fmt.Errorf("not enough arguments")
|
||||||
}
|
}
|
||||||
|
|
||||||
val, err := client.EvalSymbol(args[0])
|
val, err := client.EvalVariable(args[0])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user