dbgp

package
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 31, 2018 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateProtocolFromXML

func CreateProtocolFromXML(xmlString string) (interface{}, error)

CreateProtocolFromXML creator

Types

type Client

type Client struct {
	Connection *Connection
	Session    *Session
}

Client for xdbg srv

func NewClient

func NewClient(conn *Connection) *Client

NewClient creates a new client instance

func (*Client) Finish

func (c *Client) Finish() (*ProtocolResponse, error)

Finish stops the debugger

func (*Client) GetBreakpointList

func (c *Client) GetBreakpointList() ([]ProtocolBreakpoint, error)

GetBreakpointList returns the current list of activated bp's

func (*Client) GetContext

func (c *Client) GetContext(contextID int) ([]ProtocolProperty, error)

GetContext returns the context by id

func (*Client) GetContextNames

func (c *Client) GetContextNames() ([]ProtocolContext, error)

GetContextNames returns the context name mapping

func (*Client) GetProperty

func (c *Client) GetProperty(s string) (*ProtocolResponse, error)

GetProperty tries fetch a variable by name

func (*Client) Init

func (c *Client) Init() error

Init reads the init protocol from the xdebug server

func (*Client) Next

func (c *Client) Next() (*ProtocolResponse, error)

Next step over the next instruction

func (*Client) Run

func (c *Client) Run() (*ProtocolResponse, error)

Run the debugger

func (*Client) SetBreakpoint

func (c *Client) SetBreakpoint(file string, line int, expr string) error

SetBreakpoint creates a breakpoint

func (*Client) SetBreakpointToCall

func (c *Client) SetBreakpointToCall(funcName string) error

SetBreakpointToCall creates a call breakpoint

func (*Client) SetExceptionBreakpoint

func (c *Client) SetExceptionBreakpoint() error

SetExceptionBreakpoint sets a generic break to exceptions

func (*Client) Step

func (c *Client) Step() (*ProtocolResponse, error)

Step into the next instruction

type Connection

type Connection struct {
	// contains filtered or unexported fields
}

Connection model

func NewConnection

func NewConnection(conn net.Conn) *Connection

NewConnection constructor

func (*Connection) Close

func (c *Connection) Close()

Close the connection

func (*Connection) GetResponse

func (c *Connection) GetResponse() (*ProtocolResponse, error)

GetResponse read a message response

func (*Connection) ReadMessage

func (c *Connection) ReadMessage() (interface{}, error)

ReadMessage read a message

func (*Connection) SendMessage

func (c *Connection) SendMessage(msg string)

SendMessage writes a message

type ConnectionHandler

type ConnectionHandler func(*Connection)

ConnectionHandler handles srv accepts

type ProtocolBreakpoint

type ProtocolBreakpoint struct {
	ID       string `xml:"id,attr"`
	Type     string `xml:"type,attr"`
	FileName string `xml:"filename,attr"`
	Line     int    `xml:"lineno,attr"`
	State    string `xml:"state,attr"`
	HitCount int    `xml:"hit_count,attr"`
}

ProtocolBreakpoint data struct

type ProtocolContext

type ProtocolContext struct {
	ID   string `xml:"id,attr"`
	Name string `xml:"name,attr"`
}

ProtocolContext data struct

type ProtocolError

type ProtocolError struct {
	Code    int    `xml:"code,attr"`
	Message string `xml:"message"`
}

ProtocolError data struct

type ProtocolInit

type ProtocolInit struct {
	FileURI  string `xml:"fileuri,attr"`
	Language string `xml:"language,attr"`
	AppID    string `xml:"appid,attr"`
	IDEKey   string `xml:"idekey,attr"`
}

ProtocolInit data struct

type ProtocolMessage

type ProtocolMessage struct {
	Filename  string `xml:"filename,attr"`
	Line      int    `xml:"lineno,attr"`
	Exception string `xml:"exception,attr"`
	Value     string `xml:",chardata"`
}

ProtocolMessage data struct

type ProtocolProperty

type ProtocolProperty struct {
	Name        string              `xml:"name,attr"`
	Fullname    string              `xml:"fullname,attr"`
	Type        string              `xml:"type,attr"`
	Children    int                 `xml:"children,attr"`
	NumChildren int                 `xml:"numchildren,attr"`
	Size        int                 `xml:"size,attr"`
	Page        int                 `xml:"page,attr"`
	PageSize    int                 `xml:"pagesize,attr"`
	Encoding    string              `xml:"encoding,attr"`
	Content     string              `xml:",chardata"`
	Property    *[]ProtocolProperty `xml:"property"`
}

ProtocolProperty data struct

type ProtocolResponse

type ProtocolResponse struct {
	Command        string               `xml:"command,attr"`
	Context        string               `xml:"context,attr"`
	TransactionID  string               `xml:"transaction_id,attr"`
	Reason         string               `xml:"reason,attr"`
	Status         string               `xml:"status,attr"`
	Error          ProtocolError        `xml:"error"`
	BreakpointList []ProtocolBreakpoint `xml:"breakpoint"`
	ContextList    []ProtocolContext    `xml:"context"`
	PropertyList   []ProtocolProperty   `xml:"property"`
	StackList      []ProtocolStack      `xml:"stack"`
	Message        ProtocolMessage      `xml:"message"`
}

ProtocolResponse data struct

func (ProtocolResponse) HasError

func (p ProtocolResponse) HasError() bool

HasError getter

type ProtocolStack

type ProtocolStack struct {
	Where    string `xml:"where,attr"`
	Level    int    `xml:"level,attr"`
	Type     string `xml:"type,attr"`
	Filename string `xml:"filename,attr"`
	Line     int    `xml:"lineno,attr"`
}

ProtocolStack data struct

type Server

type Server struct {
	Address string
	Port    uint16
	// contains filtered or unexported fields
}

Server model

func NewServer

func NewServer(a string, p uint16) *Server

NewServer creates a new server

func (*Server) Accept

func (s *Server) Accept(h ConnectionHandler)

Accept connections and start handler

func (*Server) Listen

func (s *Server) Listen() error

Listen start the listening

type Session

type Session struct {
	TransactionID int
	State         SessionStateType
	CurrentFile   string
	CurrentLine   int
	TargetFiles   []string
	History       []string
}

Session debug session

func NewSession

func NewSession() *Session

NewSession creates a new session instance

func (*Session) AddCommand

func (s *Session) AddCommand(c string)

AddCommand to the history

func (*Session) GetLastCommand

func (s *Session) GetLastCommand() (string, bool)

GetLastCommand from history

func (*Session) NextTransactionID

func (s *Session) NextTransactionID() int

NextTransactionID increments and returns the trans id

func (*Session) SetTargetFiles

func (s *Session) SetTargetFiles(rootFile string)

SetTargetFiles return all possible execution files

type SessionStateType

type SessionStateType int

SessionStateType enumeration type

const (
	// StateStarting initial state
	StateStarting SessionStateType = iota
	// StateStopping remote debugger is trying to stop the process
	StateStopping
	// StateStopped remote debugger has stopped
	StateStopped
	// StateRunning interpreter is running until next breakpoint or EOF
	StateRunning
	// StateBreak reached breakpoint
	StateBreak
	// StateNone undefined state
	StateNone
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL