debug

package
v0.0.0-...-f6f1029 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2024 License: BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Breakpoint

type Breakpoint struct {
	PC      uint16
	Id      uint64
	Enabled bool
}

break when the cpu's PC is at a specific value TODO: add conditional breakpoints, and break upon reading/writing specific memory addresses

func (*Breakpoint) Hit

func (breakpoint *Breakpoint) Hit(cpu *nes.CPUState) bool

type DebugCommand

type DebugCommand interface {
	Name() string
}
var DebugCommandContinue DebugCommand = makeCommand("continue")
var DebugCommandNext DebugCommand = makeCommand("next")

type DebugCommandSimple

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

func (*DebugCommandSimple) Name

func (command *DebugCommandSimple) Name() string

type DebugCommandStep

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

func (*DebugCommandStep) Name

func (command *DebugCommandStep) Name() string

type DebugWindow

type DebugWindow struct {
	Quit         context.Context
	Cancel       context.CancelFunc
	Requests     chan WindowRequest
	IsOpen       bool
	Wait         sync.WaitGroup
	BigFont      *ttf.Font
	SmallFont    *ttf.Font
	Line         Line
	Instructions []Instruction
	Lock         sync.Mutex
	Debugger     Debugger
	Cycle        uint64
	Registers    Registers
	LastCommand  string
	// contains filtered or unexported fields
}

func MakeDebugWindow

func MakeDebugWindow(mainQuit context.Context, bigFont *ttf.Font, smallFont *ttf.Font) *DebugWindow

func (*DebugWindow) AddInstruction

func (debug *DebugWindow) AddInstruction(pc uint16, instruction nes.Instruction)

func (*DebugWindow) Close

func (debug *DebugWindow) Close()

func (*DebugWindow) HandleKey

func (debug *DebugWindow) HandleKey(event sdl.Event)

func (*DebugWindow) HandleText

func (debug *DebugWindow) HandleText(event sdl.Event)

func (*DebugWindow) IsWindow

func (debug *DebugWindow) IsWindow(windowId uint32) bool

func (*DebugWindow) Open

func (debug *DebugWindow) Open(mainQuit context.Context)

func (*DebugWindow) Redraw

func (debug *DebugWindow) Redraw()

func (*DebugWindow) SetCycle

func (debug *DebugWindow) SetCycle(cycle uint64)

func (*DebugWindow) SetDebugger

func (debug *DebugWindow) SetDebugger(debugger Debugger)

func (*DebugWindow) SetRegisters

func (debug *DebugWindow) SetRegisters(registers Registers)

type Debugger

type Debugger interface {
	Handle(*nes.CPUState) bool
	AddPCBreakpoint(uint16) Breakpoint
	AddCurrentPCBreakpoint() Breakpoint
	RemoveBreakpoint(id uint64) bool
	GetBreakpoints() []Breakpoint
	Continue()
	Step(count int)
	Next()
	IsStopped() bool
	Update(*nes.CPUState, nes.InstructionTable)
	Close()
}

func MakeDebugger

func MakeDebugger(cpu *nes.CPUState, window *DebugWindow) Debugger

type DebuggerMode

type DebuggerMode int
const (
	ModeStopped DebuggerMode = iota
	ModeStepping
	ModeNext
	ModeContinue
)

type DebuggerTabComplete

type DebuggerTabComplete struct {
}

type DebuggerTextAdd

type DebuggerTextAdd struct {
	Text string
}

type DebuggerTextBackspace

type DebuggerTextBackspace struct {
}

type DebuggerTextClearLine

type DebuggerTextClearLine struct {
}

type DebuggerTextEnter

type DebuggerTextEnter struct {
}

type DebuggerTextRemoveWord

type DebuggerTextRemoveWord struct {
}

type DefaultDebugger

type DefaultDebugger struct {
	Commands     chan DebugCommand
	Mode         DebuggerMode
	Breakpoints  []Breakpoint
	BreakpointId uint64
	Cpu          *nes.CPUState
	Window       *DebugWindow
	Lock         sync.Mutex
	LastPc       uint16
	StepCount    int
}

func (*DefaultDebugger) AddCurrentPCBreakpoint

func (debugger *DefaultDebugger) AddCurrentPCBreakpoint() Breakpoint

func (*DefaultDebugger) AddPCBreakpoint

func (debugger *DefaultDebugger) AddPCBreakpoint(pc uint16) Breakpoint

func (*DefaultDebugger) Close

func (debugger *DefaultDebugger) Close()

func (*DefaultDebugger) Continue

func (debugger *DefaultDebugger) Continue()

func (*DefaultDebugger) ContinueUntilBreak

func (debugger *DefaultDebugger) ContinueUntilBreak()

func (*DefaultDebugger) GetBreakpoints

func (debugger *DefaultDebugger) GetBreakpoints() []Breakpoint

func (*DefaultDebugger) Handle

func (debugger *DefaultDebugger) Handle(cpu *nes.CPUState) bool

func (*DefaultDebugger) IsStopped

func (debugger *DefaultDebugger) IsStopped() bool

func (*DefaultDebugger) Next

func (debugger *DefaultDebugger) Next()

func (*DefaultDebugger) RemoveBreakpoint

func (debugger *DefaultDebugger) RemoveBreakpoint(id uint64) bool

func (*DefaultDebugger) Step

func (debugger *DefaultDebugger) Step(count int)

func (*DefaultDebugger) Stop

func (debugger *DefaultDebugger) Stop()

func (*DefaultDebugger) Update

func (debugger *DefaultDebugger) Update(cpu *nes.CPUState, table nes.InstructionTable)

func (*DefaultDebugger) WithLock

func (debugger *DefaultDebugger) WithLock(fn func())

type Instruction

type Instruction struct {
	PC          uint16
	Instruction nes.Instruction
}

type Line

type Line struct {
	Text string
}

type Registers

type Registers struct {
	A      byte
	X      byte
	Y      byte
	SP     byte
	PC     uint16
	Status byte
}

type WindowRequest

type WindowRequest any

type WindowRequestBackspace

type WindowRequestBackspace struct {
}

type WindowRequestRaise

type WindowRequestRaise struct {
}

type WindowRequestRedraw

type WindowRequestRedraw struct {
}

type WindowRequestWindow

type WindowRequestWindow struct {
	Response chan *sdl.Window
}

Jump to

Keyboard shortcuts

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