srcmap

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type InstrMapping

type InstrMapping struct {
	S int32 // start offset in bytes within source (negative when non-existent!)
	L int32 // length in bytes within source (negative when non-existent!)
	F int32 // file index of source (negative when non-existent!)
	J byte  // jump type (i=into, o=out, -=regular)
	M int32 // modifier depth
}

type LineCol

type LineCol struct {
	Line uint32
	Col  uint32
}

type SourceMap

type SourceMap struct {
	// source names
	Sources []string
	// per source, source offset -> line/col
	PosData [][]LineCol
	// per bytecode byte, byte index -> instr
	Instr []InstrMapping
}

func ParseSourceMap

func ParseSourceMap(sources []string, bytecode []byte, sourceMap string) (*SourceMap, error)

ParseSourceMap parses a solidity sourcemap: mapping bytecode indices to source references. See https://docs.soliditylang.org/en/latest/internals/source_mappings.html

Sources is the list of source files, which will be read from the filesystem to transform token numbers into line/column numbers. The sources are as referenced in the source-map by index. Not all sources are necessary, some indices may be unknown.

func (*SourceMap) FormattedInfo

func (s *SourceMap) FormattedInfo(pc uint64) string

func (*SourceMap) Info

func (s *SourceMap) Info(pc uint64) (source string, line uint32, col uint32)

type SourceMapTracer

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

func NewSourceMapTracer

func NewSourceMapTracer(srcMaps map[common.Address]*SourceMap, out io.Writer) *SourceMapTracer

func (*SourceMapTracer) CaptureEnd

func (s *SourceMapTracer) CaptureEnd(output []byte, gasUsed uint64, err error)

func (*SourceMapTracer) CaptureEnter

func (s *SourceMapTracer) CaptureEnter(typ vm.OpCode, from common.Address, to common.Address, input []byte, gas uint64, value *big.Int)

func (*SourceMapTracer) CaptureExit

func (s *SourceMapTracer) CaptureExit(output []byte, gasUsed uint64, err error)

func (*SourceMapTracer) CaptureFault

func (s *SourceMapTracer) CaptureFault(pc uint64, op vm.OpCode, gas, cost uint64, scope *vm.ScopeContext, depth int, err error)

func (*SourceMapTracer) CaptureStart

func (s *SourceMapTracer) CaptureStart(env *vm.EVM, from common.Address, to common.Address, create bool, input []byte, gas uint64, value *big.Int)

func (*SourceMapTracer) CaptureState

func (s *SourceMapTracer) CaptureState(pc uint64, op vm.OpCode, gas, cost uint64, scope *vm.ScopeContext, rData []byte, depth int, err error)

func (*SourceMapTracer) CaptureStateAfter

func (s *SourceMapTracer) CaptureStateAfter(pc uint64, op vm.OpCode, gas, cost uint64, scope *vm.ScopeContext, rData []byte, depth int, err error)

func (*SourceMapTracer) CaptureTxEnd

func (s *SourceMapTracer) CaptureTxEnd(restGas uint64)

func (*SourceMapTracer) CaptureTxStart

func (s *SourceMapTracer) CaptureTxStart(gasLimit uint64)

Jump to

Keyboard shortcuts

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