parser

package
v0.0.0-...-8742a2b Latest Latest
Warning

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

Go to latest
Published: May 9, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const AND = 57360
View Source
const ARROW = 57358
View Source
const COLON = 57383
View Source
const COMMA = 57371
View Source
const DATETIME = 57350
View Source
const DOUBLE = 57356
View Source
const EQUALAT = 57382
View Source
const EQUALS = 57378
View Source
const FLAG = 57349
View Source
const FORWARDSLASH = 57384
View Source
const IDENTIFIER = 57348
View Source
const INT = 57354
View Source
const IPV6 = 57347
View Source
const LAND = 57363
View Source
const LBRACKET = 57372
View Source
const LBRACKET_SQUARE = 57374
View Source
const LEQUAL = 57364
View Source
const LOR = 57361
View Source
const LOWEST = 57385
View Source
const LPAREN = 57376
View Source
const LSHIFT = 57366
View Source
const MAC = 57353
View Source
const MINUS = 57369
View Source
const NEG = 57387
View Source
const NOFLAG = 57386
View Source
const NOT = 57368
View Source
const NULL = 57381
View Source
const ONESCOMP = 57365
View Source
const OR = 57359
View Source
const PLUS = 57370
View Source
const QUESTION = 57357
View Source
const RBRACKET = 57373
View Source
const RBRACKET_SQUARE = 57375
View Source
const RESUMED = 57380
View Source
const RPAREN = 57377
View Source
const RSHIFT = 57367
View Source
const SIGNAL_MINUS = 57352
View Source
const SIGNAL_PLUS = 57351
View Source
const STRING_LITERAL = 57346
View Source
const StraceEofCode = 1
View Source
const StraceErrCode = 2
View Source
const StraceFlag = -1000
View Source
const StraceInitialStackSize = 16
View Source
const StraceLast = 378
View Source
const StracePrivate = 57344
View Source
const TIMES = 57362
View Source
const UINT = 57355
View Source
const UNFINISHED = 57379

Variables

View Source
var (
	StraceDebug        = 0
	StraceErrorVerbose = false
)
View Source
var StraceAct = [...]int{}/* 378 elements not displayed */
View Source
var StraceChk = [...]int{}/* 115 elements not displayed */
View Source
var StraceDef = [...]int{}/* 115 elements not displayed */
View Source
var StraceErrorMessages = [...]struct {
	state int
	token int
	msg   string
}{}
View Source
var StraceExca = [...]int{
	-1, 1,
	1, -1,
	-2, 0,
}
View Source
var StracePact = [...]int{}/* 115 elements not displayed */
View Source
var StracePgo = [...]int{

	0, 125, 2, 105, 0, 5, 1, 10, 4, 103,
	182,
}
View Source
var StraceR1 = [...]int{

	0, 1, 1, 1, 1, 1, 1, 1, 1, 1,
	1, 1, 1, 7, 7, 6, 6, 6, 6, 6,
	6, 6, 6, 6, 6, 6, 2, 2, 2, 10,
	10, 10, 8, 8, 8, 8, 8, 5, 5, 5,
	5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
	4, 4, 4, 9, 9, 9, 9, 9, 3, 3,
	3, 3,
}
View Source
var StraceR2 = [...]int{

	0, 4, 5, 6, 5, 5, 8, 9, 6, 6,
	10, 9, 2, 1, 2, 1, 1, 1, 1, 1,
	1, 1, 1, 1, 1, 1, 1, 1, 2, 0,
	3, 2, 1, 1, 1, 1, 2, 1, 1, 1,
	3, 3, 3, 3, 3, 3, 3, 3, 2, 2,
	3, 3, 4, 3, 3, 3, 3, 6, 1, 1,
	1, 1,
}
View Source
var StraceStatenames = [...]string{}
View Source
var StraceTok1 = [...]int{

	1,
}
View Source
var StraceTok2 = [...]int{

	2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
	12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
	22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
	32, 33, 34, 35, 36, 37, 38, 39, 40, 41,
	42, 43, 44, 45,
}
View Source
var StraceTok3 = [...]int{
	0,
}
View Source
var StraceToknames = [...]string{
	"$end",
	"error",
	"$unk",
	"STRING_LITERAL",
	"IPV6",
	"IDENTIFIER",
	"FLAG",
	"DATETIME",
	"SIGNAL_PLUS",
	"SIGNAL_MINUS",
	"MAC",
	"INT",
	"UINT",
	"DOUBLE",
	"QUESTION",
	"ARROW",
	"OR",
	"AND",
	"LOR",
	"TIMES",
	"LAND",
	"LEQUAL",
	"ONESCOMP",
	"LSHIFT",
	"RSHIFT",
	"NOT",
	"MINUS",
	"PLUS",
	"COMMA",
	"LBRACKET",
	"RBRACKET",
	"LBRACKET_SQUARE",
	"RBRACKET_SQUARE",
	"LPAREN",
	"RPAREN",
	"EQUALS",
	"UNFINISHED",
	"RESUMED",
	"NULL",
	"EQUALAT",
	"COLON",
	"FORWARDSLASH",
	"LOWEST",
	"NOFLAG",
	"NEG",
}

Functions

func ParseString

func ParseString(s string) string

func StraceErrorMessage

func StraceErrorMessage(state, lookAhead int) string

func StraceParse

func StraceParse(Stracelex StraceLexer) int

func StraceStatname

func StraceStatname(s int) string

func StraceTokname

func StraceTokname(c int) string

func Stracelex1

func Stracelex1(lex StraceLexer, lval *StraceSymType) (char, token int)

Types

type BufferType

type BufferType struct {
	Val string
}

BufferType contains strings

func (*BufferType) String

func (b *BufferType) String() string

String implements IrType String()

type Constant

type Constant uint64

Constant represents all evaluated expressions produced by strace Constant types are evaluated at parse time

func (Constant) String

func (c Constant) String() string

func (Constant) Val

func (c Constant) Val() uint64

type GroupType

type GroupType struct {
	Elems []IrType
}

GroupType contains arrays and structs

func (*GroupType) String

func (a *GroupType) String() string

String implements IrType String()

type IrType

type IrType interface {
	String() string
}

IrType is the intermediate representation of the strace output Every argument of a system call should be represented in an intermediate type

type StraceLexer

type StraceLexer interface {
	Lex(lval *StraceSymType) int
	Error(s string)
}

type StraceParser

type StraceParser interface {
	Parse(StraceLexer) int
	Lookahead() int
}

func StraceNewParser

func StraceNewParser() StraceParser

type StraceParserImpl

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

func (*StraceParserImpl) Lookahead

func (p *StraceParserImpl) Lookahead() int

func (*StraceParserImpl) Parse

func (Stracercvr *StraceParserImpl) Parse(Stracelex StraceLexer) int

type StraceSymType

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

type Stracelexer

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

func (*Stracelexer) Error

func (lex *Stracelexer) Error(e string)

func (*Stracelexer) Lex

func (lex *Stracelexer) Lex(out *StraceSymType) int

type Syscall

type Syscall struct {
	CallName string
	Args     []IrType
	Pid      int64
	Ret      int64
	Paused   bool
	Resumed  bool
}

Syscall struct is the IR type for any system call

func NewSyscall

func NewSyscall(pid int64, name string, args []IrType, ret int64, paused, resumed bool) (sys *Syscall)

NewSyscall - constructor

func (*Syscall) String

func (s *Syscall) String() string

type Trace

type Trace struct {
	Calls []*Syscall
}

Trace is just a list of system calls

type TraceTree

type TraceTree struct {
	TraceMap map[int64]*Trace
	Ptree    map[int64][]int64
	RootPid  int64
}

TraceTree struct contains intermediate representation of trace. If a trace is multiprocess it constructs a trace for each type.

func NewTraceTree

func NewTraceTree() *TraceTree

NewTraceTree initializes a TraceTree.

func ParseData

func ParseData(data []byte) (*TraceTree, error)

ParseLoop parses each line of a strace file in a loop.

Jump to

Keyboard shortcuts

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