Documentation
¶
Overview ¶
Package sym provides access to Playstation 1 symbol files (*.SYM).
Index ¶
- type Base
- type BlockEnd
- type BlockStart
- type Class
- type Def
- type Def2
- type EndSLD
- type File
- type FileHeader
- type FuncEnd
- type FuncStart
- type IncSLD
- type IncSLDByte
- type IncSLDWord
- type Kind
- type Mod
- type Name1
- type Name2
- type Name5
- type Name6
- type Options
- type Overlay
- type SetOverlay
- type SetSLD
- type SetSLD2
- type Symbol
- type SymbolBody
- type SymbolHeader
- type Type
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Base ¶
type Base uint8
Base is a base type.
const ( BaseNull Base = 0x0 // NULL BaseVoid Base = 0x1 // VOID BaseChar Base = 0x2 // CHAR BaseShort Base = 0x3 // SHORT BaseInt Base = 0x4 // INT BaseLong Base = 0x5 // LONG BaseFloat Base = 0x6 // FLOAT BaseDouble Base = 0x7 // DOUBLE BaseStruct Base = 0x8 // STRUCT BaseUnion Base = 0x9 // UNION BaseEnum Base = 0xA // ENUM // Member of enum. BaseMOE Base = 0xB // MOE BaseUChar Base = 0xC // UCHAR BaseUShort Base = 0xD // USHORT BaseUInt Base = 0xE // UINT BaseULong Base = 0xF // ULONG )
Base types.
type BlockEnd ¶
type BlockEnd struct {
// Line number.
Line uint32 `struc:"uint32,little"`
}
A BlockEnd symbol specifies the end of a block.
Value of the symbol header specifies the associated address.
type BlockStart ¶
type BlockStart struct {
// Line number.
Line uint32 `struc:"uint32,little"`
}
A BlockStart symbol specifies the start of a block.
Value of the symbol header specifies the associated address.
func (*BlockStart) BodySize ¶
func (body *BlockStart) BodySize() int
BodySize returns the size of the symbol body in bytes.
func (*BlockStart) String ¶
func (body *BlockStart) String() string
String returns the string representation of the block start symbol.
type Class ¶
type Class uint16
Class specifies the class of a definition.
const ( // Storage class auto. ClassAUTO Class = 0x0001 // AUTO // Storage class extern. ClassEXT Class = 0x0002 // EXT // Storage class static. ClassSTAT Class = 0x0003 // STAT // Storage class register. ClassREG Class = 0x0004 // REG // TODO: Figure out when LABEL is used. ClassLABEL Class = 0x0006 // LABEL // Member of struct. ClassMOS Class = 0x0008 // MOS // Function parameter passed on stack. ClassARG Class = 0x0009 // ARG // Struct tag. ClassSTRTAG Class = 0x000A // STRTAG // Member of union. ClassMOU Class = 0x000B // MOU // Union tag. ClassUNTAG Class = 0x000C // UNTAG // Storage class typedef. ClassTPDEF Class = 0x000D // TPDEF // Enum tag. ClassENTAG Class = 0x000F // ENTAG // Member of enum. ClassMOE Class = 0x0010 // MOE // Function parameter passed in register. ClassREGPARM Class = 0x0011 // REGPARM // TODO: Figure out when FIELD is used. ClassFIELD Class = 0x0012 // FIELD // End of symbol. ClassEOS Class = 0x0066 // EOS Class103 Class = 0x0067 // 103 )
Definition classes.
type Def ¶
type Def struct {
// Definition class.
Class Class `struc:"uint16,little"`
// Definition type.
Type Type `struc:"uint16,little"`
// Definition size.
Size uint32 `struc:"uint32,little"`
// Name length.
NameLen uint8 `struc:"uint8,sizeof=Name"`
// Definition name,
Name string
}
A Def symbol specifies the class, type, size and name of a definition.
Value of the symbol header specifies the associated address.
type Def2 ¶
type Def2 struct {
// Definition class.
Class Class `struc:"uint16,little"`
// Definition type.
Type Type `struc:"uint16,little"`
// Definition size.
Size uint32 `struc:"uint32,little"`
// Dimensions length.
DimsLen uint16 `struc:"uint16,little,sizeof=Dims"`
// Dimensions.
Dims []uint32 `struc:"[]uint32,little"`
// Tag length.
TagLen uint8 `struc:"uint8,sizeof=Tag"`
// Definition tag,
Tag string
// Name length.
NameLen uint8 `struc:"uint8,sizeof=Name"`
// Definition name,
Name string
}
A Def2 symbol specifies the class, type, size, dimensions, tag and name of a definition.
Value of the symbol header specifies the associated address.
type EndSLD ¶
type EndSLD struct {
}
An EndSLD symbol indicates the end of a line number specifier.
Value of the symbol header specifies the associated address.
type File ¶
type File struct {
// File header.
Hdr *FileHeader
// Symbols.
Syms []*Symbol
// Parser options.
Opts *Options
}
A File is PS1 symbol file.
func ParseBytes ¶
ParseBytes parses the given PS1 symbol file, reading from b.
type FileHeader ¶
type FileHeader struct {
// File signature; MND.
Signature [3]byte `struc:"[3]byte"`
// File format version.
Version uint8 `struc:"uint8"`
// Target unit.
TargetUnit uint32 `struc:"uint32,little"`
}
A FileHeader is a PS1 symbol file header.
func (*FileHeader) String ¶
func (hdr *FileHeader) String() string
String returns the string representation of the symbol file header.
type FuncEnd ¶
type FuncEnd struct {
// Line number.
Line uint32 `struc:"uint32,little"`
}
A FuncEnd symbol specifies the end of a function.
Value of the symbol header specifies the associated address.
type FuncStart ¶
type FuncStart struct {
// Frame pointer register.
FP uint16 `struc:"uint16,little"`
// Function size.
FSize uint32 `struc:"uint32,little"`
// Return address register.
RetReg uint16 `struc:"uint16,little"`
// Mask.
Mask uint32 `struc:"uint32,little"`
// Mask offset.
MaskOffset int32 `struc:"int32,little"`
// Line number.
Line uint32 `struc:"uint32,little"`
// Path length.
PathLen uint8 `struc:"uint8,sizeof=Path"`
// Source file.
Path string
// Name length.
NameLen uint8 `struc:"uint8,sizeof=Name"`
// Symbol name.
Name string
}
A FuncStart symbol specifies the start of a function.
Value of the symbol header specifies the associated address.
type IncSLD ¶
type IncSLD struct {
}
An IncSLD symbol increments the current line number.
Value of the symbol header specifies the associated address.
type IncSLDByte ¶
type IncSLDByte struct {
Inc uint8 `struc:"uint8"`
}
An IncSLDByte symbol specifies the increment of the current line number.
Value of the symbol header specifies the associated address.
func (*IncSLDByte) BodySize ¶
func (body *IncSLDByte) BodySize() int
BodySize returns the size of the symbol body in bytes.
func (*IncSLDByte) String ¶
func (body *IncSLDByte) String() string
String returns the string representation of the line number increment symbol.
type IncSLDWord ¶
type IncSLDWord struct {
Inc uint16 `struc:"uint16,little"`
}
An IncSLDWord symbol specifies the increment of the current line number.
Value of the symbol header specifies the associated address.
func (*IncSLDWord) BodySize ¶
func (body *IncSLDWord) BodySize() int
BodySize returns the size of the symbol body in bytes.
func (*IncSLDWord) String ¶
func (body *IncSLDWord) String() string
String returns the string representation of the line number increment symbol.
type Kind ¶
type Kind uint8
Kind specifies the kind of a symbol.
const ( KindName1 Kind = 0x01 // 1 KindName2 Kind = 0x02 // 2 KindName5 Kind = 0x05 // 5 KindName6 Kind = 0x06 // 6 KindIncSLD Kind = 0x80 // 80 KindIncSLDByte Kind = 0x82 // 82 KindIncSLDWord Kind = 0x84 // 84 KindSetSLD Kind = 0x86 // 86 KindSetSLD2 Kind = 0x88 // 88 KindEndSLD Kind = 0x8A // 8a KindFuncStart Kind = 0x8C // 8c KindFuncEnd Kind = 0x8E // 8e KindBlockStart Kind = 0x90 // 90 KindBlockEnd Kind = 0x92 // 92 KindDef Kind = 0x94 // 94 KindDef2 Kind = 0x96 // 96 KindOverlay Kind = 0x98 // overlay KindSetOverlay Kind = 0x9A // set overlay )
Symbol kinds.
type Name1 ¶
type Name1 struct {
// Name length.
NameLen uint8 `struc:"uint8,sizeof=Name"`
// Symbol name,
Name string
}
A Name1 symbol specifies the name of a symbol.
Value of the symbol header specifies the associated address.
type Name2 ¶
type Name2 struct {
// Name length.
NameLen uint8 `struc:"uint8,sizeof=Name"`
// Symbol name,
Name string
}
A Name2 symbol specifies the name of a symbol.
Value of the symbol header specifies the associated address.
type Name5 ¶
type Name5 struct {
// Name length.
NameLen uint8 `struc:"uint8,sizeof=Name"`
// Symbol name,
Name string
}
A Name5 symbol specifies the name of a symbol.
Value of the symbol header specifies the associated address.
type Name6 ¶
type Name6 struct {
// Name length.
NameLen uint8 `struc:"uint8,sizeof=Name"`
// Symbol name,
Name string
}
A Name6 symbol specifies the name of a symbol.
Value of the symbol header specifies the associated address.
type Overlay ¶
type Overlay struct {
// Overlay length in bytes.
Length uint32 `struc:"uint32,little"`
// Overlay ID.
ID uint32 `struc:"uint32,little"`
}
An Overlay symbol specifies the length and id of a file overlay (e.g. a shared library).
Value of the symbol header specifies the base address at which the overlay is loaded.
type SetOverlay ¶
type SetOverlay struct {
}
A SetOverlay specifies the active overlay.
Value of the symbol header specifies the active overlay ID.
func (*SetOverlay) BodySize ¶
func (body *SetOverlay) BodySize() int
BodySize returns the size of the symbol body in bytes.
func (*SetOverlay) String ¶
func (body *SetOverlay) String() string
String returns the string representation of the set overlay symbol.
type SetSLD ¶
type SetSLD struct {
// Line number.
Line uint32 `struc:"uint32,little"`
}
A SetSLD symbol specifies the current line number.
Value of the symbol header specifies the associated address.
type SetSLD2 ¶
type SetSLD2 struct {
// Line number.
Line uint32 `struc:"uint32,little"`
// Path length.
PathLen uint8 `struc:"uint8,sizeof=Path"`
// Source file,
Path string
}
A SetSLD2 symbol specifies the current line number and source file.
Value of the symbol header specifies the associated address.
type Symbol ¶
type Symbol struct {
// Symbol header.
Hdr *SymbolHeader
// Symbol body.
Body SymbolBody
}
A Symbol is a PS1 symbol.
type SymbolBody ¶
type SymbolBody interface {
fmt.Stringer
// BodySize returns the size of the symbol body in bytes.
BodySize() int
}
SymbolBody is the sum-type of all symbol bodies.
type SymbolHeader ¶
type SymbolHeader struct {
// Address or value of symbol.
Value uint32 `struc:"uint32,little"`
// Symbol kind; specifies type of symbol body.
Kind Kind `struc:"uint8"`
}
A SymbolHeader is a PS1 symbol header.
func (*SymbolHeader) String ¶
func (hdr *SymbolHeader) String() string
String returns the string representation of the symbol header.
type Type ¶
type Type uint16
Type specifies the type of a definition.
A type is made up of a 4-bit basic type specifier, and a set of 2-bit type modifiers.
Basic type xxxx
Modifier xx
Modifier xx
Modifier xx
Modifier xx
Modifier xx
Modifier xx
Example.
int * f_0064() {}
Interpretation.
int 0100
function 10
pointer 01
00
00
00
00
0x64 = 00 00 00 00 01 10 0100
Example.
int (*v_0094)();
Interpretation.
int 0100
pointer 01
function 10
00
00
00
00
0x94 = 00 00 00 00 10 01 0100
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
sym_dump
command
The sym_dump tool converts Playstation 1 MND/SYM files to C headers (*.sym -> *.h) and scripts for importing symbol information into IDA.
|
The sym_dump tool converts Playstation 1 MND/SYM files to C headers (*.sym -> *.h) and scripts for importing symbol information into IDA. |
|
Package csym translates Playstation 1 symbol information to C declarations.
|
Package csym translates Playstation 1 symbol information to C declarations. |
|
c
Package c provides an AST for a subset of C.
|
Package c provides an AST for a subset of C. |