func (d *Debugger) convertStacktrace(rawlocs []proc.Stackframe, full bool) ([]api.Stackframe, error) { locations := make([]api.Stackframe, 0, len(rawlocs)) for i := range rawlocs { frame := api.Stackframe{Location: api.ConvertLocation(rawlocs[i].Call)} if full { scope := rawlocs[i].Scope(d.process.CurrentThread) lv, err := scope.LocalVariables() if err != nil { return nil, err } av, err := scope.FunctionArguments() if err != nil { return nil, err } frame.Locals = convertVars(lv) frame.Arguments = convertVars(av) } locations = append(locations, frame) } return locations, nil }
func (d *Debugger) convertStacktrace(rawlocs []proc.Stackframe, cfg *proc.LoadConfig) ([]api.Stackframe, error) { locations := make([]api.Stackframe, 0, len(rawlocs)) for i := range rawlocs { frame := api.Stackframe{Location: api.ConvertLocation(rawlocs[i].Call)} if cfg != nil { var err error scope := rawlocs[i].Scope(d.process.CurrentThread) locals, err := scope.LocalVariables(*cfg) if err != nil { return nil, err } arguments, err := scope.FunctionArguments(*cfg) if err != nil { return nil, err } frame.Locals = convertVars(locals) frame.Arguments = convertVars(arguments) } locations = append(locations, frame) } return locations, nil }