Package ogle
import "exp/ogle"
Ogle is the beginning of a debugger for Go.
Package files
abort.go arch.go cmd.go event.go frame.go goroutine.go process.go rruntime.go rtype.go rvalue.go vars.goVariables
var Amd64 = &amd64{gReg: -1}
func Main
func Main()
type Arch
type Arch interface {
// ToWord converts an array of up to 8 bytes in memory order
// to a word.
ToWord(data []byte) proc.Word
// FromWord converts a word to an array of up to 8 bytes in
// memory order.
FromWord(v proc.Word, out []byte)
// ToFloat32 converts a word to a float. The order of this
// word will be the order returned by ToWord on the memory
// representation of a float, and thus may require reversing.
ToFloat32(bits uint32) float32
// FromFloat32 converts a float to a word. This should return
// a word that can be passed to FromWord to get the memory
// representation of a float on this architecture.
FromFloat32(f float32) uint32
// ToFloat64 is to float64 as ToFloat32 is to float32.
ToFloat64(bits uint64) float64
// FromFloat64 is to float64 as FromFloat32 is to float32.
FromFloat64(f float64) uint64
// IntSize returns the number of bytes in an 'int'.
IntSize() int
// PtrSize returns the number of bytes in a 'uintptr'.
PtrSize() int
// FloatSize returns the number of bytes in a 'float'.
FloatSize() int
// Align rounds offset up to the appropriate offset for a
// basic type with the given width.
Align(offset, width int) int
// G returns the current G pointer.
G(regs proc.Regs) proc.Word
// ClosureSize returns the number of bytes expected by
// ParseClosure.
ClosureSize() int
// ParseClosure takes ClosureSize bytes read from a return PC
// in a remote process, determines if the code is a closure,
// and returns the frame size of the closure if it is.
ParseClosure(data []byte) (frame int, ok bool)
}
type ArchAlignedMultiple
type ArchAlignedMultiple struct{}
func (ArchAlignedMultiple) Align
func (ArchAlignedMultiple) Align(offset, width int) int
type ArchLSB
type ArchLSB struct{}
func (ArchLSB) FromFloat32
func (ArchLSB) FromFloat32(f float32) uint32
func (ArchLSB) FromFloat64
func (ArchLSB) FromFloat64(f float64) uint64
func (ArchLSB) FromWord
func (ArchLSB) FromWord(v proc.Word, out []byte)
func (ArchLSB) ToFloat32
func (ArchLSB) ToFloat32(bits uint32) float32
func (ArchLSB) ToFloat64
func (ArchLSB) ToFloat64(bits uint64) float64
func (ArchLSB) ToWord
func (ArchLSB) ToWord(data []byte) proc.Word
type Breakpoint
A Breakpoint event occurs when a process reaches a particular program counter. When this event is handled, the current goroutine will be the goroutine that reached the program counter.
type Breakpoint struct {
// contains unexported fields
}
func (*Breakpoint) PC
func (b *Breakpoint) PC() proc.Word
func (*Breakpoint) String
func (b *Breakpoint) String() string
type Event
type Event interface {
Process() *Process
Goroutine() *Goroutine
String() string
}
type EventAction
An EventAction is an event handler's response to an event. If all of an event's handlers execute without returning errors, their results are combined as follows: If any handler returned EAContinue, then the process resumes (without returning from WaitStop); otherwise, if any handler returned EAStop, the process remains stopped; otherwise, if all handlers returned EADefault, the process resumes. A handler may return EARemoveSelf bit-wise or'd with any other action to indicate that the handler should be removed from the hook.
type EventAction int
const (
EARemoveSelf EventAction = 0x100
EADefault EventAction = iota
EAStop
EAContinue
)
func EventPrint
func EventPrint(ev Event) (EventAction, os.Error)
EventPrint is a standard event handler that prints events as they occur. It will not cause the process to stop.
func EventStop
func EventStop(ev Event) (EventAction, os.Error)
EventStop is a standard event handler that causes the process to stop.
type EventHandler
An EventHandler is a function that takes an event and returns a response to that event and possibly an error. If an event handler returns an error, the process stops and no other handlers for that event are executed.
type EventHandler func(e Event) (EventAction, os.Error)
type EventHook
A EventHook allows event handlers to be added and removed.
type EventHook interface {
AddHandler(EventHandler)
RemoveHandler(EventHandler)
NumHandler() int
String() string
// contains unexported methods
}
type FormatError
A FormatError indicates a failure to process information in or about a remote process, such as unexpected or missing information in the object file or runtime structures.
type FormatError string
func (FormatError) String
func (e FormatError) String() string
type Frame
A Frame represents a single frame on a remote call stack.
type Frame struct {
// contains unexported fields
}
func (*Frame) Inner
func (f *Frame) Inner() *Frame
Inner returns the Frame called by this Frame, or nil if this is the innermost frame.
func (*Frame) Outer
func (f *Frame) Outer() (*Frame, os.Error)
Outer returns the Frame that called this Frame, or nil if this is the outermost frame.
func (*Frame) String
func (f *Frame) String() string
type Goroutine
A Goroutine represents a goroutine in a remote process.
type Goroutine struct {
// contains unexported fields
}
func (*Goroutine) In
func (t *Goroutine) In() os.Error
In selects the frame called by the current frame.
func (*Goroutine) Out
func (t *Goroutine) Out() os.Error
Out selects the caller frame of the current frame.
func (*Goroutine) String
func (t *Goroutine) String() string
type GoroutineCreate
A GoroutineCreate event occurs when a process creates a new goroutine. When this event is handled, the current goroutine will be the newly created goroutine.
type GoroutineCreate struct {
// contains unexported fields
}
func (*GoroutineCreate) Parent
func (e *GoroutineCreate) Parent() *Goroutine
Parent returns the goroutine that created this goroutine. May be nil if this event is the creation of the first goroutine.
func (*GoroutineCreate) String
func (e *GoroutineCreate) String() string
type GoroutineExit
A GoroutineExit event occurs when a Go goroutine exits.
type GoroutineExit struct {
// contains unexported fields
}
func (*GoroutineExit) String
func (e *GoroutineExit) String() string
type NoCurrentGoroutine
A NoCurrentGoroutine error occurs when no goroutine is currently selected in a process (or when there are no goroutines in a process).
type NoCurrentGoroutine struct{}
func (NoCurrentGoroutine) String
func (e NoCurrentGoroutine) String() string
type NotOnStack
A NotOnStack error occurs when attempting to access a variable in a remote frame where that remote frame is not on the current stack.
type NotOnStack struct {
Fn *gosym.Func
Goroutine *Goroutine
}
func (NotOnStack) String
func (e NotOnStack) String() string
type Process
A Process represents a remote attached process.
type Process struct {
Arch
// contains unexported fields
}
func NewProcess
func NewProcess(tproc proc.Process, arch Arch, syms *gosym.Table) (*Process, os.Error)
NewProcess constructs a new remote process around a traced process, an architecture, and a symbol table.
func NewProcessElf
func NewProcessElf(tproc proc.Process, f *elf.File) (*Process, os.Error)
NewProcessElf constructs a new remote process around a traced process and the process' ELF object.
func (*Process) ContWait
func (p *Process) ContWait() os.Error
ContWait resumes process execution and waits for an event to occur that stops the process.
func (*Process) Event
func (p *Process) Event() Event
Event returns the last event that caused the process to stop. This may return nil if the process has never been stopped by an event.
TODO(austin) Return nil if the user calls p.Stop()?
func (*Process) In
func (p *Process) In() os.Error
In selects the frame called by the current frame.
func (*Process) OnBreakpoint
func (p *Process) OnBreakpoint(pc proc.Word) EventHook
OnBreakpoint returns the hook that is run when the program reaches the given program counter.
func (*Process) OnGoroutineCreate
func (p *Process) OnGoroutineCreate() EventHook
OnGoroutineCreate returns the hook that is run when a goroutine is created.
func (*Process) OnGoroutineExit
func (p *Process) OnGoroutineExit() EventHook
OnGoroutineExit returns the hook that is run when a goroutine exits.
func (*Process) Out
func (p *Process) Out() os.Error
Out selects the caller frame of the current frame.
func (*Process) Peek
func (p *Process) Peek(addr proc.Word, out []byte) (int, os.Error)
func (*Process) Poke
func (p *Process) Poke(addr proc.Word, b []byte) (int, os.Error)
type ProcessNotStopped
A ProcessNotStopped error occurs when attempting to read or write memory or registers of a process that is not stopped.
type ProcessNotStopped struct{}
func (ProcessNotStopped) String
func (e ProcessNotStopped) String() string
type ReadOnlyError
A ReadOnlyError occurs when attempting to set or assign to a read-only value.
type ReadOnlyError string
func (ReadOnlyError) String
func (e ReadOnlyError) String() string
type RemoteMismatchError
A RemoteMismatchError occurs when an operation that requires two identical remote processes is given different process. For example, this occurs when trying to set a pointer in one process to point to something in another process.
type RemoteMismatchError string
func (RemoteMismatchError) String
func (e RemoteMismatchError) String() string
type UnknownArchitecture
An UnknownArchitecture occurs when trying to load an object file that indicates an architecture not supported by the debugger.
type UnknownArchitecture elf.Machine
func (UnknownArchitecture) String
func (e UnknownArchitecture) String() string
type UnknownGoroutine
An UnknownGoroutine error is an internal error representing an unrecognized G structure pointer.
type UnknownGoroutine struct {
OSThread proc.Thread
Goroutine proc.Word
}
func (UnknownGoroutine) String
func (e UnknownGoroutine) String() string
type UsageError
A UsageError occurs when a command is called with illegal arguments.
type UsageError string
func (UsageError) String
func (e UsageError) String() string
