Documentation
¶
Overview ¶
Package developer offers additional functionality to the developer of ROMs that use a coprocessor. For instance, it handles the loading of .map and .obj files if they have been generated during the compilation of the 2600 ROM. The .map and .obj files are used to provide source code level information during execution.
Objdump type is a very basic parser for obj files as produced by "objdump -S" on the base elf file that is used to create a cartridge binary
Index ¶
- Constants
- type Developer
- func (dev *Developer) BorrowIllegalAccess(f func(*IllegalAccess))
- func (dev *Developer) BorrowSource(f func(*Source))
- func (dev *Developer) ExecutionProfile(addr map[uint32]float32)
- func (dev *Developer) HasSource() bool
- func (dev *Developer) IllegalAccess(event string, pc uint32, addr uint32) string
- func (dev *Developer) NewFrame(_ television.FrameInfo) error
- type ExecutedLines
- type IllegalAccess
- type IllegalAccessEntry
- type Source
- type SrcFile
- type SrcLine
- type SrcLineAsm
Constants ¶
const ( UnknownFunction = "<unknown function>" UnknownSourceLine = "<unknown source line>" )
Strings used to indicate unknown values.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Developer ¶
type Developer struct {
// contains filtered or unexported fields
}
Developer implements the CartCoProcDeveloper interface.
func NewDeveloper ¶
func NewDeveloper(pathToROM string, cart mapper.CartCoProcBus) *Developer
NewDeveloper is the preferred method of initialisation for the Developer type.
func (*Developer) BorrowIllegalAccess ¶
func (dev *Developer) BorrowIllegalAccess(f func(*IllegalAccess))
BorrowIllegalAccess will lock the illegal access log for the duration of the supplied fucntion, which will be executed with the illegal access log as an argument.
func (*Developer) BorrowSource ¶
BorrowSource will lock the source code structure for the durction of the supplied function, which will be executed with the source code structure as an argument.
May return nil.
func (*Developer) ExecutionProfile ¶
ExecutionProfile implements the CartCoProcDeveloper interface.
func (*Developer) IllegalAccess ¶
IllegalAccess implements the CartCoProcDeveloper interface.
type ExecutedLines ¶
type ExecutedLines struct {
Lines []*SrcLine
// contains filtered or unexported fields
}
ExecutedLines orders every line of executable source code in the identified source files. Useful for determining the most expensive lines of source code in terms of execution time.
func (ExecutedLines) Less ¶
func (e ExecutedLines) Less(i int, j int) bool
Less implements sort.Interface.
func (ExecutedLines) SortedBy ¶
func (e ExecutedLines) SortedBy() string
SortedBy returns a string describing the sort method
func (ExecutedLines) Swap ¶
func (e ExecutedLines) Swap(i int, j int)
Swap implements sort.Interface.
type IllegalAccess ¶
type IllegalAccess struct {
Log []IllegalAccessEntry
// contains filtered or unexported fields
}
IllegalAccess records memory accesses by the coprocesser that are "illegal".
type IllegalAccessEntry ¶
IllegalAccessEntry is a single entry in the illegal access log.
type Source ¶
type Source struct {
Files map[string]*SrcFile
FilesNames []string
// A list of all the source lines in the program. only those lines that
// have SrcLineAsm entries are included.
//
// sorted by cycle count from highest to lowest
ExecutedLines ExecutedLines
// the number of cycles this line has instruction consumed on the
// coprocessor during the course of the previous frame
FrameCycles float32
// the total number of cycles over the lifetime of the program
TotalCycles float32
// contains filtered or unexported fields
}
Source files for the currently loaded ROM. It is built through a combination of a binary objdump and the original source files.
type SrcFile ¶
type SrcFile struct {
// name and path of loaded file
Filename string
// the lines of the file
Lines []*SrcLine
}
SrcFile represents a single file of original source code. A file is made up of many SrcLine entries.
type SrcLine ¶
type SrcLine struct {
// the file the line is found in
File *SrcFile
Function string // function name line is contained in (if found)
LineNumber int // counting from one
Content string // the actual line
Inlined bool
// the generated assembly for this line. will be empty if line is a comment
// or otherwise unsused
Asm []*SrcLineAsm
// the number of cycles this line has instruction consumed on the
// coprocessor during the course of the previous frame
FrameCycles float32
// the total number of cycles over the lifetime of the program
LifetimeCycles float32
// whether this src line has been responsible for an illegal access
IllegalAccess bool
// the number of times the line has been responsible for an illegal access
IllegalCount int
// contains filtered or unexported fields
}
SrcLine represents a single line of source in a SrcFile.
type SrcLineAsm ¶
type SrcLineAsm struct {
// address of instruction
Addr uint32
// the actual coprocessor instruction
Instruction string
// contains filtered or unexported fields
}
SrcLineAsm associates an asm with a block of source (which might be a single line).