ctf

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MAGIC       = 0xcff1     /* magic number identifying header */
	MAX_TYPE    = 0xfffffffe /* max type identifier value */
	MAX_NAME    = 0x7fffffff /* max offset into a string table */
	MAX_VLEN    = 0x3ff      /* max struct, union, enum members or args */
	MAX_INTOFF  = 0xff       /* max offset of intrinsic value in bits */
	MAX_INTBITS = 0xffff     /* max size of an intrinsic in bits */
	/* See ctf_type_t */
	MAX_SIZE   = 0xfffffffe /* max size of a type in bytes */
	LSIZE_SENT = 0xffffffff /* sentinel for ctt_size */
	MAX_LSIZE  = math.MaxUint64
	/* data format version number */
	VERSION_1     = 1
	VERSION_2     = 2
	VERSION_3     = 3
	VERSION_4     = 4
	VERSION       = VERSION_4 /* current version */
	F_COMPRESS    = 0x1       /* data buffer is compressed */
	F_NEWFUNCINFO = 0x2       /* New v3 func info section format.  */
)
View Source
const (
	/*
	 * Values for TYPE_KIND().  If the kind has an associated data list,
	 * INFO_VLEN() will extract the number of elements in the list, and
	 * the type of each element is shown in the comments below.
	 */
	UNKNOWN  kind = 0 /* unknown type (used for padding) */
	INTEGER  kind = 1 /* variant data is INT_DATA() (see below) */
	FLOAT    kind = 2 /* variant data is DATA() (see below) */
	POINTER  kind = 3 /* ctt_type is referenced type */
	ARRAY    kind = 4 /* variant data is single ctf_array_t */
	FUNCTION kind = 5 /* ctt_type is return type, variant data is */
	/* list of argument types (uint32_t's) */
	STRUCT   kind = 6  /* variant data is list of ctf_member_t's */
	UNION    kind = 7  /* variant data is list of ctf_member_t's */
	ENUM     kind = 8  /* variant data is list of ctf_enum_t's */
	FORWARD  kind = 9  /* no additional data; ctt_name is tag */
	TYPEDEF  kind = 10 /* ctt_type is referenced type */
	VOLATILE kind = 11 /* ctt_type is base type */
	CONST    kind = 12 /* ctt_type is base type */
	RESTRICT kind = 13 /* ctt_type is base type */

	PTRAUTH kind = 14 /* variant data is PTRAUTH_DATA (see below) */

	MAX kind = 31 /* Maximum possible K_* value */
)
View Source
const (
	SIGNED  intEncoding = 0x01 /* integer is signed (otherwise unsigned) */
	CHAR    intEncoding = 0x02 /* character display format */
	BOOL    intEncoding = 0x04 /* boolean display format */
	VARARGS intEncoding = 0x08 /* varargs display format */
)
View Source
const (
	SINGLE   floatEncoding = 1  /* IEEE 32-bit float encoding */
	DOUBLE   floatEncoding = 2  /* IEEE 64-bit float encoding */
	CPLX     floatEncoding = 3  /* Complex encoding */
	DCPLX    floatEncoding = 4  /* Double complex encoding */
	LDCPLX   floatEncoding = 5  /* Long double complex encoding */
	LDOUBLE  floatEncoding = 6  /* Long double encoding */
	INTRVL   floatEncoding = 7  /* Interval (2x32-bit) encoding */
	DINTRVL  floatEncoding = 8  /* Double interval (2x64-bit) encoding */
	LDINTRVL floatEncoding = 9  /* Long double interval (2x128-bit) encoding */
	IMAGRY   floatEncoding = 10 /* Imaginary (32-bit) encoding */
	DIMAGRY  floatEncoding = 11 /* Long imaginary (64-bit) encoding */
	LDIMAGRY floatEncoding = 12 /* Long double imaginary (128-bit) encoding */
)
View Source
const LSTRUCT_THRESH = 8192

* Most structure members have bit offsets that can be expressed using a * short. Some don't. ctf_member_t is used for structs which cannot * contain any of these large offsets, whereas ctf_lmember_t is used in the * latter case. If ctt_size for a given struct is >= 8192 bytes, all members * will be stored as type ctf_lmember_t.

Variables

This section is empty.

Functions

This section is empty.

Types

type Array

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

func (*Array) Contents

func (a *Array) Contents() string

func (*Array) Dump

func (a *Array) Dump() string

func (*Array) ID

func (a *Array) ID() int

func (*Array) Index

func (a *Array) Index() string

func (*Array) Info

func (a *Array) Info() Info

func (*Array) MarshalJSON

func (a *Array) MarshalJSON() ([]byte, error)

func (*Array) Name

func (a *Array) Name() string

func (*Array) ParentID

func (a *Array) ParentID() int

func (*Array) String

func (a *Array) String() string

func (*Array) Type

func (a *Array) Type() string

type CTF

type CTF struct {
	Header    header       `json:"header,omitempty"`
	Types     map[int]Type `json:"types,omitempty"`
	Globals   []global     `json:"globals,omitempty"`
	Functions []function   `json:"functions,omitempty"`
	// contains filtered or unexported fields
}

CTF is the Compact ANSI-C Type Format object

func Parse

func Parse(m *macho.File) (*CTF, error)

Parse parses the CTF data and returns an CTF object pointer

func (*CTF) GetDataObjects

func (c *CTF) GetDataObjects() error

GetDataObjects returns all the CTF data objects

func (*CTF) GetDataTypes

func (c *CTF) GetDataTypes() error

GetDataTypes returns all the CTF data type definitions

func (*CTF) GetFunctions

func (c *CTF) GetFunctions() error

GetFunctions returns all the CTF function definitions

type Const

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

func (*Const) Dump

func (p *Const) Dump() string

func (*Const) ID

func (p *Const) ID() int

func (*Const) Info

func (p *Const) Info() Info

func (*Const) MarshalJSON

func (p *Const) MarshalJSON() ([]byte, error)

func (*Const) Name

func (p *Const) Name() string

func (*Const) ParentID

func (p *Const) ParentID() int

func (*Const) Reference

func (p *Const) Reference() string

func (*Const) String

func (p *Const) String() string

func (*Const) Type

func (p *Const) Type() string

type Enum

type Enum struct {
	Fields []enumField
	// contains filtered or unexported fields
}

func (*Enum) Dump

func (e *Enum) Dump() string

func (*Enum) ID

func (e *Enum) ID() int

func (*Enum) Info

func (e *Enum) Info() Info

func (*Enum) MarshalJSON

func (e *Enum) MarshalJSON() ([]byte, error)

func (*Enum) Name

func (e *Enum) Name() string

func (*Enum) ParentID

func (e *Enum) ParentID() int

func (*Enum) String

func (e *Enum) String() string

func (*Enum) Type

func (e *Enum) Type() string

type Float

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

func (*Float) Bits

func (f *Float) Bits() uint32

func (*Float) Dump

func (f *Float) Dump() string

func (*Float) Encoding

func (f *Float) Encoding() string

func (*Float) ID

func (f *Float) ID() int

func (*Float) Info

func (f *Float) Info() Info

func (*Float) MarshalJSON

func (f *Float) MarshalJSON() ([]byte, error)

func (*Float) Name

func (f *Float) Name() string

func (*Float) Offset

func (f *Float) Offset() uint32

func (*Float) ParentID

func (f *Float) ParentID() int

func (*Float) String

func (f *Float) String() string

func (*Float) Type

func (f *Float) Type() string

type Forward

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

func (*Forward) Dump

func (f *Forward) Dump() string

func (*Forward) ID

func (f *Forward) ID() int

func (*Forward) Info

func (f *Forward) Info() Info

func (*Forward) MarshalJSON

func (f *Forward) MarshalJSON() ([]byte, error)

func (*Forward) Name

func (f *Forward) Name() string

func (*Forward) ParentID

func (f *Forward) ParentID() int

func (*Forward) String

func (f *Forward) String() string

func (*Forward) Type

func (f *Forward) Type() string

type Function

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

func (*Function) Args

func (f *Function) Args() string

func (*Function) Dump

func (f *Function) Dump() string

func (*Function) ID

func (f *Function) ID() int

func (*Function) Info

func (f *Function) Info() Info

func (*Function) MarshalJSON

func (f *Function) MarshalJSON() ([]byte, error)

func (*Function) Name

func (f *Function) Name() string

func (*Function) ParentID

func (f *Function) ParentID() int

func (*Function) Return

func (f *Function) Return() string

func (*Function) String

func (f *Function) String() string

func (*Function) Type

func (f *Function) Type() string

type Info

type Info interface {
	Kind() kind
	IsRoot() bool
	VarLen() uint16
	String() string
	MarshalJSON() ([]byte, error)
}

type Integer

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

func (*Integer) Bits

func (i *Integer) Bits() uint32

func (*Integer) Dump

func (i *Integer) Dump() string

func (*Integer) Encoding

func (i *Integer) Encoding() string

func (*Integer) ID

func (i *Integer) ID() int

func (*Integer) Info

func (i *Integer) Info() Info

func (*Integer) MarshalJSON

func (i *Integer) MarshalJSON() ([]byte, error)

func (*Integer) Name

func (i *Integer) Name() string

func (*Integer) Offset

func (i *Integer) Offset() uint32

func (*Integer) ParentID

func (i *Integer) ParentID() int

func (*Integer) String

func (i *Integer) String() string

func (*Integer) Type

func (i *Integer) Type() string

type Member

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

func (Member) MarshalJSON

func (m Member) MarshalJSON() ([]byte, error)

func (Member) Name

func (m Member) Name() string

func (Member) Offset

func (m Member) Offset() uint64

func (Member) ParentID

func (m Member) ParentID() int

func (Member) Type

func (m Member) Type() string

type Pointer

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

func (*Pointer) Dump

func (p *Pointer) Dump() string

func (*Pointer) ID

func (p *Pointer) ID() int

func (*Pointer) Info

func (p *Pointer) Info() Info

func (*Pointer) MarshalJSON

func (p *Pointer) MarshalJSON() ([]byte, error)

func (*Pointer) Name

func (p *Pointer) Name() string

func (*Pointer) ParentID

func (p *Pointer) ParentID() int

func (*Pointer) Reference

func (p *Pointer) Reference() string

func (*Pointer) String

func (p *Pointer) String() string

func (*Pointer) Type

func (p *Pointer) Type() string

type PtrAuth

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

func (*PtrAuth) Dump

func (p *PtrAuth) Dump() string

func (*PtrAuth) ID

func (p *PtrAuth) ID() int

func (*PtrAuth) Info

func (p *PtrAuth) Info() Info

func (*PtrAuth) MarshalJSON

func (p *PtrAuth) MarshalJSON() ([]byte, error)

func (*PtrAuth) Name

func (p *PtrAuth) Name() string

func (*PtrAuth) ParentID

func (p *PtrAuth) ParentID() int

func (*PtrAuth) Reference

func (p *PtrAuth) Reference() string

func (*PtrAuth) String

func (p *PtrAuth) String() string

func (*PtrAuth) Type

func (p *PtrAuth) Type() string

type Restrict

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

func (*Restrict) Dump

func (p *Restrict) Dump() string

func (*Restrict) ID

func (p *Restrict) ID() int

func (*Restrict) Info

func (p *Restrict) Info() Info

func (*Restrict) MarshalJSON

func (p *Restrict) MarshalJSON() ([]byte, error)

func (*Restrict) Name

func (p *Restrict) Name() string

func (*Restrict) ParentID

func (p *Restrict) ParentID() int

func (*Restrict) Reference

func (p *Restrict) Reference() string

func (*Restrict) String

func (p *Restrict) String() string

func (*Restrict) Type

func (p *Restrict) Type() string

type Struct

type Struct struct {
	Fields []Member
	// contains filtered or unexported fields
}

func (*Struct) Dump

func (s *Struct) Dump() string

func (*Struct) ID

func (s *Struct) ID() int

func (*Struct) Info

func (s *Struct) Info() Info

func (*Struct) MarshalJSON

func (s *Struct) MarshalJSON() ([]byte, error)

func (*Struct) Name

func (s *Struct) Name() string

func (*Struct) ParentID

func (s *Struct) ParentID() int

func (*Struct) Size

func (s *Struct) Size() uint64

func (*Struct) String

func (s *Struct) String() string

func (*Struct) Type

func (s *Struct) Type() string

type Type

type Type interface {
	ID() int
	Name() string
	Info() Info
	ParentID() int
	Type() string
	String() string
	Dump() string
}

type Typedef

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

func (*Typedef) Dump

func (p *Typedef) Dump() string

func (*Typedef) ID

func (p *Typedef) ID() int

func (*Typedef) Info

func (p *Typedef) Info() Info

func (*Typedef) MarshalJSON

func (p *Typedef) MarshalJSON() ([]byte, error)

func (*Typedef) Name

func (p *Typedef) Name() string

func (*Typedef) ParentID

func (p *Typedef) ParentID() int

func (*Typedef) Reference

func (p *Typedef) Reference() string

func (*Typedef) String

func (p *Typedef) String() string

func (*Typedef) Type

func (p *Typedef) Type() string

type Union

type Union struct {
	Fields []Member
	// contains filtered or unexported fields
}

func (*Union) Dump

func (s *Union) Dump() string

func (*Union) ID

func (s *Union) ID() int

func (*Union) Info

func (s *Union) Info() Info

func (*Union) MarshalJSON

func (s *Union) MarshalJSON() ([]byte, error)

func (*Union) Name

func (s *Union) Name() string

func (*Union) ParentID

func (s *Union) ParentID() int

func (*Union) Size

func (s *Union) Size() uint64

func (*Union) String

func (s *Union) String() string

func (*Union) Type

func (s *Union) Type() string

type Volatile

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

func (*Volatile) Dump

func (p *Volatile) Dump() string

func (*Volatile) ID

func (p *Volatile) ID() int

func (*Volatile) Info

func (p *Volatile) Info() Info

func (*Volatile) MarshalJSON

func (p *Volatile) MarshalJSON() ([]byte, error)

func (*Volatile) Name

func (p *Volatile) Name() string

func (*Volatile) ParentID

func (p *Volatile) ParentID() int

func (*Volatile) Reference

func (p *Volatile) Reference() string

func (*Volatile) String

func (p *Volatile) String() string

func (*Volatile) Type

func (p *Volatile) Type() string

Jump to

Keyboard shortcuts

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