Skip to content

Commit

Permalink
API sync from Delve
Browse files Browse the repository at this point in the history
  • Loading branch information
a committed Sep 24, 2024
1 parent 789b0af commit 759f299
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 6 deletions.
9 changes: 7 additions & 2 deletions internal/dlvclient/service/api/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,11 @@ type Breakpoint struct {
Disabled bool `json:"disabled"`

UserData interface{} `json:"-"`

// RootFuncName is the Root function from where tracing needs to be done
RootFuncName string
// TraceFollowCalls indicates the Depth of tracing
TraceFollowCalls int
}

// ValidBreakpointName returns an error if
Expand Down Expand Up @@ -319,12 +324,12 @@ type Variable struct {
// Function variables will store the name of the function in this field
Value string `json:"value"`

// Number of elements in an array or a slice, number of keys for a map, number of struct members for a struct, length of strings
// Number of elements in an array or a slice, number of keys for a map, number of struct members for a struct, length of strings, number of captured variables for functions
Len int64 `json:"len"`
// Cap value for slices
Cap int64 `json:"cap"`

// Array and slice elements, member fields of structs, key/value pairs of maps, value of complex numbers
// Array and slice elements, member fields of structs, key/value pairs of maps, value of complex numbers, captured variables of functions.
// The Name field in this slice will always be the empty string except for structs (when it will be the field name) and for complex numbers (when it will be "real" and "imaginary")
// For maps each map entry will have to items in this slice, even numbered items will represent map keys and odd numbered items will represent their values
// This field's length is capped at proc.maxArrayValues for slices and arrays and 2*proc.maxArrayValues for maps, in the circumstances where the cap takes effect len(Children) != Len
Expand Down
4 changes: 2 additions & 2 deletions internal/dlvclient/service/rpc2/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -313,9 +313,9 @@ func (c *RPCClient) ListSources(filter string) ([]string, error) {
return sources.Sources, err
}

func (c *RPCClient) ListFunctions(filter string) ([]string, error) {
func (c *RPCClient) ListFunctions(filter string, TraceFollow int) ([]string, error) {
funcs := new(ListFunctionsOut)
err := c.call("ListFunctions", ListFunctionsIn{filter}, funcs)
err := c.call("ListFunctions", ListFunctionsIn{filter, TraceFollow}, funcs)
return funcs.Funcs, err
}

Expand Down
3 changes: 2 additions & 1 deletion internal/dlvclient/service/rpc2/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,8 @@ type ListSourcesOut struct {
}

type ListFunctionsIn struct {
Filter string
Filter string
FollowCalls int
}

type ListFunctionsOut struct {
Expand Down
10 changes: 9 additions & 1 deletion internal/starbind/starlark_mapping.go
Original file line number Diff line number Diff line change
Expand Up @@ -1093,11 +1093,19 @@ func (env *Env) starlarkPredeclare() (starlark.StringDict, map[string]string) {
return starlark.None, decorateError(thread, err)
}
}
if len(args) > 1 && args[1] != starlark.None {
err := unmarshalStarlarkValue(args[1], &rpcArgs.FollowCalls, "FollowCalls")
if err != nil {
return starlark.None, decorateError(thread, err)
}
}
for _, kv := range kwargs {
var err error
switch kv[0].(starlark.String) {
case "Filter":
err = unmarshalStarlarkValue(kv[1], &rpcArgs.Filter, "Filter")
case "FollowCalls":
err = unmarshalStarlarkValue(kv[1], &rpcArgs.FollowCalls, "FollowCalls")
default:
err = fmt.Errorf("unknown argument %q", kv[0])
}
Expand All @@ -1111,7 +1119,7 @@ func (env *Env) starlarkPredeclare() (starlark.StringDict, map[string]string) {
}
return env.interfaceToStarlarkValue(rpcRet), nil
})
doc["functions"] = "builtin functions(Filter)\n\nfunctions lists all functions in the process matching filter."
doc["functions"] = "builtin functions(Filter, FollowCalls)\n\nfunctions lists all functions in the process matching filter."
r["goroutines"] = starlark.NewBuiltin("goroutines", func(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {
if err := isCancelled(thread); err != nil {
return starlark.None, decorateError(thread, err)
Expand Down

0 comments on commit 759f299

Please sign in to comment.