unsafer

package module
v0.0.0-...-1c3adc8 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2015 License: MIT Imports: 8 Imported by: 0

README

unsafer

More unsafe than unsafe

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	StopTheWorld  func(string)
	StartTheWorld func()
)
View Source
var DMA []byte

Functions

func AllGs

func AllGs(f func(*Goroutine))

func InsertFunction

func InsertFunction(name string, receiver interface{}) error

func TracebackOthers

func TracebackOthers()

Types

type ArrayType

type ArrayType struct {
	Type
	Element *Type
	Slice   *Type
	Length  uintptr
}

func (*ArrayType) Sizeof

func (t *ArrayType) Sizeof() uintptr

func (*ArrayType) ToType

func (t *ArrayType) ToType() *Type

type BitVector

type BitVector struct {
	N        int32 // # of bits
	ByteData *uint8
}

type ChanType

type ChanType struct {
	Type
	Element   *Type
	Direction uintptr
}

func (*ChanType) Sizeof

func (t *ChanType) Sizeof() uintptr

func (*ChanType) ToType

func (t *ChanType) ToType() *Type

type Defer

type Defer struct {
	Size    int32
	Started bool
	SP      uintptr // sp at time of defer
	PC      uintptr
	Fn      *FuncVal
	Panic   *Panic // panic that is running defer
	Link    *Defer
}

type FuncTab

type FuncTab struct {
	Entry      uintptr
	FuncOffset uintptr
}

type FuncType

type FuncType struct {
	Type
	DotDotDot bool
	In        []*Type
	Out       []*Type
}

func (*FuncType) Sizeof

func (t *FuncType) Sizeof() uintptr

func (*FuncType) ToType

func (t *FuncType) ToType() *Type

type FuncVal

type FuncVal struct {
	PC uintptr
}

type Gcstats

type Gcstats struct {
	Nhandoff    uint64
	Nhandoffcnt uint64
	Nprocyield  uint64
	Nosyield    uint64
	Nsleep      uint64
}

type GenericType

type GenericType struct {
	Type
}

func (*GenericType) Sizeof

func (t *GenericType) Sizeof() uintptr

func (*GenericType) ToType

func (t *GenericType) ToType() *Type

type GoBuf

type GoBuf struct {
	// The offsets of sp, pc, and g are known to (hard-coded in) libmach.
	Sp   uintptr
	Pc   uintptr
	G    *Goroutine
	Ctxt unsafe.Pointer // this has to be a pointer so that gc scans it
	Ret  uintptr
	Lr   uintptr
	Bp   uintptr // for GOEXPERIMENT=framepointer
}

type Goroutine

type Goroutine struct {
	Stack struct {
		Lo, Hi uintptr
	}
	Stackguard0, Stackguard1 uintptr

	Panic      uintptr
	Defer      *Defer
	M          *M      // current m; offset known to arm liblink
	StackAlloc uintptr // stack allocation is [stack.lo,stack.lo+stackAlloc)
	Sched      GoBuf
	Syscallsp  uintptr // if status==Gsyscall, syscallsp = sched.sp to use during gc
	Syscallpc  uintptr // if status==Gsyscall, syscallpc = sched.pc to use during gc
	Stkbar     []struct {
		SavedLRPtr, SavedLRVal uintptr // stack barriers, from low to high
	}
	StkbarPos      uintptr        // index of lowest stack barrier not hit
	Param          unsafe.Pointer // passed parameter on wakeup
	Atomicstatus   uint32
	StackLock      uint32 // sigprof/scang lock; TODO: fold in to atomicstatus
	Goid           int64
	Waitsince      int64  // approx time when the g become blocked
	Waitreason     string // if status==Gwaiting
	Schedlink      *Goroutine
	Preempt        bool   // preemption signal, duplicates stackguard0 = stackpreempt
	Paniconfault   bool   // panic (instead of crash) on unexpected fault address
	Preemptscan    bool   // preempted g does scan for gc
	Gcscandone     bool   // g has scanned stack; protected by _Gscan bit in status
	Gcscanvalid    bool   // false at start of gc cycle, true if G has not run since last scan
	Throwsplit     bool   // must not split stack
	Raceignore     int8   // ignore race detection events
	Sysblocktraced bool   // StartTrace has emitted EvGoInSyscall about this goroutine
	Sysexitticks   int64  // cputicks when syscall has returned (for tracing)
	Sysexitseq     uint64 // trace seq when syscall has returned (for tracing)
	Lockedm        uintptr
	Sig            uint32
	Writebuf       []byte
	Sigcode0       uintptr
	Sigcode1       uintptr
	Sigpc          uintptr
	Gopc           uintptr // pc of go statement that created this goroutine
	Startpc        uintptr // pc of goroutine function
	Racectx        uintptr
	Waiting        uintptr // sudog structures this g is waiting on (that have a valid elem ptr)
	Readyg         uintptr // scratch for readyExecute

	// Per-G gcController state
	Gcalloc    uintptr // bytes allocated during this GC cycle
	Gcscanwork int64   // scan work done (or stolen) this GC cycle
}

func GetG

func GetG() *Goroutine

type IMethod

type IMethod struct {
	Name    *string
	PkgPath *string
	Type    *Type
}

type InterfaceType

type InterfaceType struct {
	Type
	Mhdr []IMethod
}

func (*InterfaceType) Sizeof

func (t *InterfaceType) Sizeof() uintptr

func (*InterfaceType) ToType

func (t *InterfaceType) ToType() *Type

type M

type M struct {
	G0      *Goroutine // goroutine with scheduling stack
	Morebuf GoBuf      // gobuf arg to morestack
	Divmod  uint32     // div/mod denominator for arm - known to liblink

	// Fields not known to debuggers.
	Procid        uint64     // for debuggers, but offset not hard-coded
	Gsignal       *Goroutine // signal-handling g
	Sigmask       [4]uintptr // storage for saved signal mask
	Tls           [4]uintptr // thread-local storage (for x86 extern register)
	Mstartfn      func()
	Curg          *Goroutine // current running goroutine
	Caughtsig     uintptr    // goroutine running during fatal signal
	P             uintptr    // attached p for executing go code (nil if not executing go code)
	Nextp         uintptr
	ID            int32
	Mallocing     int32
	Throwing      int32
	Preemptoff    string // if != "", keep curg running on this m
	Locks         int32
	Softfloat     int32
	Dying         int32
	Profilehz     int32
	Helpgc        int32
	Spinning      bool // m is out of work and is actively looking for work
	Blocked       bool // m is blocked on a note
	Inwb          bool // m is executing a write barrier
	Printlock     int8
	Fastrand      uint32
	Ncgocall      uint64 // number of cgo calls in total
	Ncgo          int32  // number of cgo calls currently in progress
	Park          uintptr
	Alllink       *M // on allm
	Schedlink     uintptr
	Machport      uint32 // return address for mach ipc (os x)
	Mcache        uintptr
	Lockedg       *Goroutine
	Createstack   [32]uintptr // stack that created this thread.
	Freglo        [16]uint32  // d[i] lsb and f[i]
	Freghi        [16]uint32  // d[i] msb and f[i+16]
	Fflag         uint32      // floating point compare flags
	Locked        uint32      // tracking for lockosthread
	Nextwaitm     uintptr     // next m waiting for lock
	Waitsema      uintptr     // semaphore for parking on locks
	Waitsemacount uint32
	Waitsemalock  uint32
	Gcstats       Gcstats
	Needextram    bool
	Traceback     uint8
	Waitunlockf   unsafe.Pointer // todo go func(*g, unsafe.pointer) bool
	Waitlock      unsafe.Pointer
	Waittraceev   byte
	Waittraceskip int
	Startingtrace bool
	Syscalltick   uint32
}

type MapType

type MapType struct {
	Type
	Key     *Type
	Element *Type
	// contains filtered or unexported fields
}

func (*MapType) Sizeof

func (t *MapType) Sizeof() uintptr

func (*MapType) ToType

func (t *MapType) ToType() *Type

type Method

type Method struct {
	Name    *string
	PkgPath *string
	MType   *Type
	Type    *Type
	Ifn     unsafe.Pointer
	Tfn     unsafe.Pointer
}

type ModuleData

type ModuleData struct {
	PclnData     []byte
	Ftab         []FuncTab
	Filetab      []uint32
	FindFuncTab  uintptr
	MinPC, MaxPC uintptr

	Text, EText           uintptr
	NoPtrData, ENoPtrData uintptr
	Data, EData           uintptr
	Bss, EBss             uintptr
	NoPtrBss, ENoPtrBss   uintptr
	End, GCData, GCBss    uintptr

	TypeLinks []*Type

	Name   string
	Hashes []ModuleHash

	GcDataMask, GcBssMask BitVector

	Next *ModuleData
}

runtime.moduledata

var (
	FirstModuleData, LastModuleData *ModuleData
)

func (*ModuleData) AllTypes

func (m *ModuleData) AllTypes(f func(*Type))

type ModuleHash

type ModuleHash struct {
	ModuleName   string
	LinktimeHash string
	RuntimeHash  *string
}

type Panic

type Panic struct {
	Argp      unsafe.Pointer // pointer to arguments of deferred call run during panic; cannot move - known to liblink
	Arg       interface{}    // argument to panic
	Link      *Panic         // link to earlier panic
	Recovered bool           // whether this panic is over
	Aborted   bool           // the panic was aborted
}

* panics

type PtrType

type PtrType struct {
	Type
	Element *Type
}

func (*PtrType) Sizeof

func (t *PtrType) Sizeof() uintptr

func (*PtrType) ToType

func (t *PtrType) ToType() *Type

type SliceType

type SliceType struct {
	Type
	Element *Type
}

func (*SliceType) Sizeof

func (t *SliceType) Sizeof() uintptr

func (*SliceType) ToType

func (t *SliceType) ToType() *Type

type SpecificType

type SpecificType interface {
	ToType() *Type
	Sizeof() uintptr
}

type StructField

type StructField struct {
	Name    *string
	PkgPath *string
	Type    *Type
	Tag     *string
	Offset  uintptr
}

type StructType

type StructType struct {
	Type
	Fields []StructField
}

func (*StructType) Sizeof

func (t *StructType) Sizeof() uintptr

func (*StructType) ToType

func (t *StructType) ToType() *Type

type Type

type Type struct {
	Size    uintptr
	PtrData uintptr // size of memory prefix holding all pointers
	Hash    uint32

	Align      uint8
	FieldAlign uint8
	Kind       uint8
	Alg        uintptr
	// gcdata stores the GC type data for the garbage collector.
	// If the KindGCProg bit is set in kind, gcdata is a GC program.
	// Otherwise it is a ptrmask bitmap. See mbitmap.go for details.
	GCData *byte
	String *string
	X      *UncommonType
	PtrTo  *Type
	Zero   *byte // ptr to the zero value for this type
	// contains filtered or unexported fields
}

runtime._type

func (*Type) Reflect

func (t *Type) Reflect() reflect.Type

func (*Type) ToSpecificType

func (t *Type) ToSpecificType() SpecificType

type UncommonType

type UncommonType struct {
	Name    *string
	PkgPath *string
	Mhdr    []Method
}

Jump to

Keyboard shortcuts

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