dbgmem

package
v0.19.2 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2022 License: GPL-3.0, GPL-3.0 Imports: 8 Imported by: 0

Documentation

Overview

Package dbgmem sits between the debugger and the acutal VCS memory. In the context of the debugger it is more useful to address memory via this package rather than using the memory package directly.

The key type provided by the package is the AddressInfo type. This type provides every detail about a memory address that you could want.

The other key type is the MemoryDebug type. Initialise this is the usual way by specifying a VCS instance and symbols table. Note that both should be initialised and not left to point to nil - no checks are made in the dbgmem package.

The MapAddress() function is the basic way you create an AddressInfo type. Specify whether the address is read or write address and the function does all the work. The address can even be a symbol, in which case the symbols table is consulted.

The Peek() and Poke() functions complement the Peek() and Poke() functions in the memory package. In the dbgmem package case, Peek() and Poke() accept symbols as well as numeric addresses.

Peek() and Poke() will return Sentinal errors (PeekError and PokeError respectively) if a bus.AddressError is encountered).

Index

Constants

View Source
const (
	PeekError = "cannot peek address (%v)"
	PokeError = "cannot poke address (%v)"
)

Formatted errors for Peek() and Poke(). These can be used by other packages, if required, for consistency.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddressInfo

type AddressInfo struct {
	Address       uint16
	MappedAddress uint16
	Symbol        string
	Area          memorymap.Area

	// addresses and symbols are mapped differently depending on whether
	// address is to be used for reading or writing
	Read bool

	// the data at the address. if peeked is false then data mays not be valid
	Peeked bool
	Data   uint8
}

AddressInfo is returned by dbgmem functions. This type contains everything you could possibly usefully know about an address. Most usefully perhaps, the String() function provides a normalised presentation of information.

func (AddressInfo) String

func (ai AddressInfo) String() string

func (AddressInfo) StringNoSymbol added in v0.17.0

func (ai AddressInfo) StringNoSymbol() string

StringNoSymbol is the same as String() but it does not print the AddressSymbol field. Useful in some contexts were the symbol is printed in some other way.

type DbgMem

type DbgMem struct {
	VCS *hardware.VCS
	Sym *symbols.Symbols
}

DbgMem is a front-end to the real VCS memory. it allows addressing by symbol name and uses the AddressInfo type for easier presentation.

func (DbgMem) MapAddress

func (dbgmem DbgMem) MapAddress(address interface{}, read bool) *AddressInfo

MapAddress allows addressing by symbols in addition to numerically.

func (DbgMem) Peek

func (dbgmem DbgMem) Peek(address interface{}) (*AddressInfo, error)

Peek returns the contents of the memory address, without triggering any side effects. The supplied address can be numeric of symbolic.

func (DbgMem) Poke

func (dbgmem DbgMem) Poke(address interface{}, data uint8) (*AddressInfo, error)

Poke writes a value at the specified address. The supplied address be numeric or symbolic.

Jump to

Keyboard shortcuts

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