faults

package
v0.51.0 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2025 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Overview

Package faults records memory faults generated by a coprocessor.

Usage of the word "faults" is a shorthand and should probably be referred to as "memory faults" in a user facing context.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Category

type Category string

Category classifies the approximate reason for a memory fault

const (
	// a program memory fault is special because it will always cause a fatal error
	ProgramMemory Category = "program memory"

	// these are general "memory faults"
	NullDereference Category = "null dereference"
	StackError      Category = "stack collision"
	IllegalAddress  Category = "illegal address"

	// these are memory faults but are usually treated as warnings
	MisalignedAddressing    Category = "misaligned addressing"
	UnimplementedPeripheral Category = "unimplemented peripheral"

	// an undefined symbol is encountered when a symbol has not been resolved at load time. the
	// fault is raised whenever the symbol is encountered
	UndefinedSymbol Category = "undefined symbol"
)

List of valid Category values

type Entry

type Entry struct {
	Category Category

	// description of the event that triggered the memory fault
	Event string

	// addresses related to the fault
	InstructionAddr uint32
	AccessAddr      uint32

	// number of times this specific illegal access has been seen
	Count int
}

Entry is a single entry in the fault log

func (Entry) String

func (e Entry) String() string

type Faults

type Faults struct {

	// all the accesses in order of the first time they appear. the Count field
	// in the IllegalAccessEntry can be used to see if that entry was seen more
	// than once *after* the first appearance
	Log []*Entry

	// is true once a stack collision has been detected. once a stack collision
	// has occured then subsequent illegal accesses cannot be trusted and will
	// likely not be logged
	HasStackCollision bool
	// contains filtered or unexported fields
}

Faults records memory accesses by the coprocesser that are "illegal".

func NewFaults

func NewFaults() Faults

func (*Faults) Clear

func (flt *Faults) Clear()

Clear all entries from faults log. Does not clear the HasStackCollision flag

func (*Faults) NewEntry

func (flt *Faults) NewEntry(event string, category Category, instructionAddr uint32, accessAddr uint32)

NewEntry adds a new entry to the list of faults

func (Faults) WriteLog

func (flt Faults) WriteLog(w io.Writer)

WriteLog writes the list of faults in the order they were added

Jump to

Keyboard shortcuts

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