mirror of
https://github.com/beego/bee.git
synced 2025-06-27 00:20:21 +00:00
Update vendors
This commit is contained in:
114
vendor/github.com/derekparker/delve/service/rpc2/client.go
generated
vendored
114
vendor/github.com/derekparker/delve/service/rpc2/client.go
generated
vendored
@ -3,6 +3,7 @@ package rpc2
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"net"
|
||||
"net/rpc"
|
||||
"net/rpc/jsonrpc"
|
||||
"time"
|
||||
@ -13,9 +14,9 @@ import (
|
||||
|
||||
// Client is a RPC service.Client.
|
||||
type RPCClient struct {
|
||||
addr string
|
||||
processPid int
|
||||
client *rpc.Client
|
||||
client *rpc.Client
|
||||
|
||||
retValLoadCfg *api.LoadConfig
|
||||
}
|
||||
|
||||
// Ensure the implementation satisfies the interface.
|
||||
@ -27,11 +28,20 @@ func NewClient(addr string) *RPCClient {
|
||||
if err != nil {
|
||||
log.Fatal("dialing:", err)
|
||||
}
|
||||
c := &RPCClient{addr: addr, client: client}
|
||||
return newFromRPCClient(client)
|
||||
}
|
||||
|
||||
func newFromRPCClient(client *rpc.Client) *RPCClient {
|
||||
c := &RPCClient{client: client}
|
||||
c.call("SetApiVersion", api.SetAPIVersionIn{2}, &api.SetAPIVersionOut{})
|
||||
return c
|
||||
}
|
||||
|
||||
// NewClientFromConn creates a new RPCClient from the given connection.
|
||||
func NewClientFromConn(conn net.Conn) *RPCClient {
|
||||
return newFromRPCClient(jsonrpc.NewClient(conn))
|
||||
}
|
||||
|
||||
func (c *RPCClient) ProcessPid() int {
|
||||
out := new(ProcessPidOut)
|
||||
c.call("ProcessPid", ProcessPidIn{}, out)
|
||||
@ -45,13 +55,20 @@ func (c *RPCClient) LastModified() time.Time {
|
||||
}
|
||||
|
||||
func (c *RPCClient) Detach(kill bool) error {
|
||||
defer c.client.Close()
|
||||
out := new(DetachOut)
|
||||
return c.call("Detach", DetachIn{kill}, out)
|
||||
}
|
||||
|
||||
func (c *RPCClient) Restart() ([]api.DiscardedBreakpoint, error) {
|
||||
out := new(RestartOut)
|
||||
err := c.call("Restart", RestartIn{}, out)
|
||||
err := c.call("Restart", RestartIn{"", false, nil}, out)
|
||||
return out.DiscardedBreakpoints, err
|
||||
}
|
||||
|
||||
func (c *RPCClient) RestartFrom(pos string, resetArgs bool, newArgs []string) ([]api.DiscardedBreakpoint, error) {
|
||||
out := new(RestartOut)
|
||||
err := c.call("Restart", RestartIn{pos, resetArgs, newArgs}, out)
|
||||
return out.DiscardedBreakpoints, err
|
||||
}
|
||||
|
||||
@ -61,18 +78,32 @@ func (c *RPCClient) GetState() (*api.DebuggerState, error) {
|
||||
return out.State, err
|
||||
}
|
||||
|
||||
func (c *RPCClient) GetStateNonBlocking() (*api.DebuggerState, error) {
|
||||
var out StateOut
|
||||
err := c.call("State", StateIn{NonBlocking: true}, &out)
|
||||
return out.State, err
|
||||
}
|
||||
|
||||
func (c *RPCClient) Continue() <-chan *api.DebuggerState {
|
||||
return c.continueDir(api.Continue)
|
||||
}
|
||||
|
||||
func (c *RPCClient) Rewind() <-chan *api.DebuggerState {
|
||||
return c.continueDir(api.Rewind)
|
||||
}
|
||||
|
||||
func (c *RPCClient) continueDir(cmd string) <-chan *api.DebuggerState {
|
||||
ch := make(chan *api.DebuggerState)
|
||||
go func() {
|
||||
for {
|
||||
out := new(CommandOut)
|
||||
err := c.call("Command", &api.DebuggerCommand{Name: api.Continue}, &out)
|
||||
err := c.call("Command", &api.DebuggerCommand{Name: cmd, ReturnInfoLoadConfig: c.retValLoadCfg}, &out)
|
||||
state := out.State
|
||||
if err != nil {
|
||||
state.Err = err
|
||||
}
|
||||
if state.Exited {
|
||||
// Error types apparantly cannot be marshalled by Go correctly. Must reset error here.
|
||||
// Error types apparently cannot be marshalled by Go correctly. Must reset error here.
|
||||
state.Err = fmt.Errorf("Process %d has exited with status %d", c.ProcessPid(), state.ExitStatus)
|
||||
}
|
||||
ch <- &state
|
||||
@ -101,19 +132,25 @@ func (c *RPCClient) Continue() <-chan *api.DebuggerState {
|
||||
|
||||
func (c *RPCClient) Next() (*api.DebuggerState, error) {
|
||||
var out CommandOut
|
||||
err := c.call("Command", api.DebuggerCommand{Name: api.Next}, &out)
|
||||
err := c.call("Command", api.DebuggerCommand{Name: api.Next, ReturnInfoLoadConfig: c.retValLoadCfg}, &out)
|
||||
return &out.State, err
|
||||
}
|
||||
|
||||
func (c *RPCClient) Step() (*api.DebuggerState, error) {
|
||||
var out CommandOut
|
||||
err := c.call("Command", api.DebuggerCommand{Name: api.Step}, &out)
|
||||
err := c.call("Command", api.DebuggerCommand{Name: api.Step, ReturnInfoLoadConfig: c.retValLoadCfg}, &out)
|
||||
return &out.State, err
|
||||
}
|
||||
|
||||
func (c *RPCClient) StepOut() (*api.DebuggerState, error) {
|
||||
var out CommandOut
|
||||
err := c.call("Command", &api.DebuggerCommand{Name: api.StepOut}, &out)
|
||||
err := c.call("Command", &api.DebuggerCommand{Name: api.StepOut, ReturnInfoLoadConfig: c.retValLoadCfg}, &out)
|
||||
return &out.State, err
|
||||
}
|
||||
|
||||
func (c *RPCClient) Call(expr string) (*api.DebuggerState, error) {
|
||||
var out CommandOut
|
||||
err := c.call("Command", &api.DebuggerCommand{Name: api.Call, ReturnInfoLoadConfig: c.retValLoadCfg, Expr: expr}, &out)
|
||||
return &out.State, err
|
||||
}
|
||||
|
||||
@ -267,9 +304,9 @@ func (c *RPCClient) ListGoroutines() ([]*api.Goroutine, error) {
|
||||
return out.Goroutines, err
|
||||
}
|
||||
|
||||
func (c *RPCClient) Stacktrace(goroutineId, depth int, cfg *api.LoadConfig) ([]api.Stackframe, error) {
|
||||
func (c *RPCClient) Stacktrace(goroutineId, depth int, readDefers bool, cfg *api.LoadConfig) ([]api.Stackframe, error) {
|
||||
var out StacktraceOut
|
||||
err := c.call("Stacktrace", StacktraceIn{goroutineId, depth, false, cfg}, &out)
|
||||
err := c.call("Stacktrace", StacktraceIn{goroutineId, depth, false, readDefers, cfg}, &out)
|
||||
return out.Locations, err
|
||||
}
|
||||
|
||||
@ -299,8 +336,57 @@ func (c *RPCClient) DisassemblePC(scope api.EvalScope, pc uint64, flavour api.As
|
||||
return out.Disassemble, err
|
||||
}
|
||||
|
||||
func (c *RPCClient) url(path string) string {
|
||||
return fmt.Sprintf("http://%s%s", c.addr, path)
|
||||
// Recorded returns true if the debugger target is a recording.
|
||||
func (c *RPCClient) Recorded() bool {
|
||||
out := new(RecordedOut)
|
||||
c.call("Recorded", RecordedIn{}, out)
|
||||
return out.Recorded
|
||||
}
|
||||
|
||||
// TraceDirectory returns the path to the trace directory for a recording.
|
||||
func (c *RPCClient) TraceDirectory() (string, error) {
|
||||
var out RecordedOut
|
||||
err := c.call("Recorded", RecordedIn{}, &out)
|
||||
return out.TraceDirectory, err
|
||||
}
|
||||
|
||||
// Checkpoint sets a checkpoint at the current position.
|
||||
func (c *RPCClient) Checkpoint(where string) (checkpointID int, err error) {
|
||||
var out CheckpointOut
|
||||
err = c.call("Checkpoint", CheckpointIn{where}, &out)
|
||||
return out.ID, err
|
||||
}
|
||||
|
||||
// ListCheckpoints gets all checkpoints.
|
||||
func (c *RPCClient) ListCheckpoints() ([]api.Checkpoint, error) {
|
||||
var out ListCheckpointsOut
|
||||
err := c.call("ListCheckpoints", ListCheckpointsIn{}, &out)
|
||||
return out.Checkpoints, err
|
||||
}
|
||||
|
||||
// ClearCheckpoint removes a checkpoint
|
||||
func (c *RPCClient) ClearCheckpoint(id int) error {
|
||||
var out ClearCheckpointOut
|
||||
err := c.call("ClearCheckpoint", ClearCheckpointIn{id}, &out)
|
||||
return err
|
||||
}
|
||||
|
||||
func (c *RPCClient) SetReturnValuesLoadConfig(cfg *api.LoadConfig) {
|
||||
c.retValLoadCfg = cfg
|
||||
}
|
||||
|
||||
func (c *RPCClient) IsMulticlient() bool {
|
||||
var out IsMulticlientOut
|
||||
c.call("IsMulticlient", IsMulticlientIn{}, &out)
|
||||
return out.IsMulticlient
|
||||
}
|
||||
|
||||
func (c *RPCClient) Disconnect(cont bool) error {
|
||||
if cont {
|
||||
out := new(CommandOut)
|
||||
c.client.Go("RPCServer.Command", &api.DebuggerCommand{Name: api.Continue, ReturnInfoLoadConfig: c.retValLoadCfg}, &out, nil)
|
||||
}
|
||||
return c.client.Close()
|
||||
}
|
||||
|
||||
func (c *RPCClient) call(method string, args, reply interface{}) error {
|
||||
|
108
vendor/github.com/derekparker/delve/service/rpc2/server.go
generated
vendored
108
vendor/github.com/derekparker/delve/service/rpc2/server.go
generated
vendored
@ -55,10 +55,24 @@ type DetachOut struct {
|
||||
|
||||
// Detach detaches the debugger, optionally killing the process.
|
||||
func (s *RPCServer) Detach(arg DetachIn, out *DetachOut) error {
|
||||
return s.debugger.Detach(arg.Kill)
|
||||
err := s.debugger.Detach(arg.Kill)
|
||||
if s.config.DisconnectChan != nil {
|
||||
close(s.config.DisconnectChan)
|
||||
s.config.DisconnectChan = nil
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
type RestartIn struct {
|
||||
// Position to restart from, if it starts with 'c' it's a checkpoint ID,
|
||||
// otherwise it's an event number. Only valid for recorded targets.
|
||||
Position string
|
||||
|
||||
// ResetArgs tell whether NewArgs should take effect.
|
||||
ResetArgs bool
|
||||
// NewArgs are arguments to launch a new process. They replace only the
|
||||
// argv[1] and later. Argv[0] cannot be changed.
|
||||
NewArgs []string
|
||||
}
|
||||
|
||||
type RestartOut struct {
|
||||
@ -71,11 +85,13 @@ func (s *RPCServer) Restart(arg RestartIn, out *RestartOut) error {
|
||||
return errors.New("cannot restart process Delve did not create")
|
||||
}
|
||||
var err error
|
||||
out.DiscardedBreakpoints, err = s.debugger.Restart()
|
||||
out.DiscardedBreakpoints, err = s.debugger.Restart(arg.Position, arg.ResetArgs, arg.NewArgs)
|
||||
return err
|
||||
}
|
||||
|
||||
type StateIn struct {
|
||||
// If NonBlocking is true State will return immediately even if the target process is running.
|
||||
NonBlocking bool
|
||||
}
|
||||
|
||||
type StateOut struct {
|
||||
@ -84,7 +100,7 @@ type StateOut struct {
|
||||
|
||||
// State returns the current debugger state.
|
||||
func (s *RPCServer) State(arg StateIn, out *StateOut) error {
|
||||
st, err := s.debugger.State()
|
||||
st, err := s.debugger.State(arg.NonBlocking)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -106,7 +122,6 @@ func (s *RPCServer) Command(command api.DebuggerCommand, cb service.RPCCallback)
|
||||
var out CommandOut
|
||||
out.State = *st
|
||||
cb.Return(out, nil)
|
||||
return
|
||||
}
|
||||
|
||||
type GetBreakpointIn struct {
|
||||
@ -137,10 +152,11 @@ func (s *RPCServer) GetBreakpoint(arg GetBreakpointIn, out *GetBreakpointOut) er
|
||||
}
|
||||
|
||||
type StacktraceIn struct {
|
||||
Id int
|
||||
Depth int
|
||||
Full bool
|
||||
Cfg *api.LoadConfig
|
||||
Id int
|
||||
Depth int
|
||||
Full bool
|
||||
Defers bool // read deferred functions
|
||||
Cfg *api.LoadConfig
|
||||
}
|
||||
|
||||
type StacktraceOut struct {
|
||||
@ -156,11 +172,11 @@ func (s *RPCServer) Stacktrace(arg StacktraceIn, out *StacktraceOut) error {
|
||||
if cfg == nil && arg.Full {
|
||||
cfg = &api.LoadConfig{true, 1, 64, 64, -1}
|
||||
}
|
||||
locs, err := s.debugger.Stacktrace(arg.Id, arg.Depth, api.LoadConfigToProc(cfg))
|
||||
var err error
|
||||
out.Locations, err = s.debugger.Stacktrace(arg.Id, arg.Depth, arg.Defers, api.LoadConfigToProc(cfg))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
out.Locations = locs
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -309,7 +325,7 @@ type ListPackageVarsOut struct {
|
||||
|
||||
// ListPackageVars lists all package variables in the context of the current thread.
|
||||
func (s *RPCServer) ListPackageVars(arg ListPackageVarsIn, out *ListPackageVarsOut) error {
|
||||
state, err := s.debugger.State()
|
||||
state, err := s.debugger.State(false)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -340,7 +356,7 @@ type ListRegistersOut struct {
|
||||
// ListRegisters lists registers and their values.
|
||||
func (s *RPCServer) ListRegisters(arg ListRegistersIn, out *ListRegistersOut) error {
|
||||
if arg.ThreadID == 0 {
|
||||
state, err := s.debugger.State()
|
||||
state, err := s.debugger.State(false)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -565,7 +581,7 @@ type DisassembleOut struct {
|
||||
//
|
||||
// If both StartPC and EndPC are non-zero the specified range will be disassembled, otherwise the function containing StartPC will be disassembled.
|
||||
//
|
||||
// Scope is used to mark the instruction the specified gorutine is stopped at.
|
||||
// Scope is used to mark the instruction the specified goroutine is stopped at.
|
||||
//
|
||||
// Disassemble will also try to calculate the destination address of an absolute indirect CALL if it happens to be the instruction the selected goroutine is stopped at.
|
||||
func (c *RPCServer) Disassemble(arg DisassembleIn, out *DisassembleOut) error {
|
||||
@ -573,3 +589,69 @@ func (c *RPCServer) Disassemble(arg DisassembleIn, out *DisassembleOut) error {
|
||||
out.Disassemble, err = c.debugger.Disassemble(arg.Scope, arg.StartPC, arg.EndPC, arg.Flavour)
|
||||
return err
|
||||
}
|
||||
|
||||
type RecordedIn struct {
|
||||
}
|
||||
|
||||
type RecordedOut struct {
|
||||
Recorded bool
|
||||
TraceDirectory string
|
||||
}
|
||||
|
||||
func (s *RPCServer) Recorded(arg RecordedIn, out *RecordedOut) error {
|
||||
out.Recorded, out.TraceDirectory = s.debugger.Recorded()
|
||||
return nil
|
||||
}
|
||||
|
||||
type CheckpointIn struct {
|
||||
Where string
|
||||
}
|
||||
|
||||
type CheckpointOut struct {
|
||||
ID int
|
||||
}
|
||||
|
||||
func (s *RPCServer) Checkpoint(arg CheckpointIn, out *CheckpointOut) error {
|
||||
var err error
|
||||
out.ID, err = s.debugger.Checkpoint(arg.Where)
|
||||
return err
|
||||
}
|
||||
|
||||
type ListCheckpointsIn struct {
|
||||
}
|
||||
|
||||
type ListCheckpointsOut struct {
|
||||
Checkpoints []api.Checkpoint
|
||||
}
|
||||
|
||||
func (s *RPCServer) ListCheckpoints(arg ListCheckpointsIn, out *ListCheckpointsOut) error {
|
||||
var err error
|
||||
out.Checkpoints, err = s.debugger.Checkpoints()
|
||||
return err
|
||||
}
|
||||
|
||||
type ClearCheckpointIn struct {
|
||||
ID int
|
||||
}
|
||||
|
||||
type ClearCheckpointOut struct {
|
||||
}
|
||||
|
||||
func (s *RPCServer) ClearCheckpoint(arg ClearCheckpointIn, out *ClearCheckpointOut) error {
|
||||
return s.debugger.ClearCheckpoint(arg.ID)
|
||||
}
|
||||
|
||||
type IsMulticlientIn struct {
|
||||
}
|
||||
|
||||
type IsMulticlientOut struct {
|
||||
// IsMulticlient returns true if the headless instance was started with --accept-multiclient
|
||||
IsMulticlient bool
|
||||
}
|
||||
|
||||
func (s *RPCServer) IsMulticlient(arg IsMulticlientIn, out *IsMulticlientOut) error {
|
||||
*out = IsMulticlientOut{
|
||||
IsMulticlient: s.config.AcceptMulti,
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user