func defcfa(frame *FrameContext) { reg, _ := util.DecodeULEB128(frame.buf) offset, _ := util.DecodeULEB128(frame.buf) frame.cfa.register = reg frame.cfa.offset = int64(offset) }
func parseCIE(ctx *parseContext) parsefunc { data := ctx.buf.Next(int(ctx.length)) buf := bytes.NewBuffer(data) // parse version ctx.common.Version = data[0] // parse augmentation ctx.common.Augmentation, _ = util.ParseString(buf) // parse code alignment factor ctx.common.CodeAlignmentFactor, _ = util.DecodeULEB128(buf) // parse data alignment factor ctx.common.DataAlignmentFactor, _ = util.DecodeSLEB128(buf) // parse return address register ctx.common.ReturnAddressRegister, _ = util.DecodeULEB128(buf) // parse initial instructions // The rest of this entry consists of the instructions // so we can just grab all of the data from the buffer // cursor to length. ctx.common.InitialInstructions = buf.Bytes() //ctx.buf.Next(int(ctx.length)) ctx.length = 0 return parselength }
func valoffset(frame *FrameContext) { var ( reg, _ = util.DecodeULEB128(frame.buf) offset, _ = util.DecodeULEB128(frame.buf) ) frame.regs[reg] = DWRule{offset: int64(offset), rule: rule_valoffset} }
func offsetextended(frame *FrameContext) { var ( reg, _ = util.DecodeULEB128(frame.buf) offset, _ = util.DecodeULEB128(frame.buf) ) frame.regs[reg] = DWRule{offset: int64(offset) * frame.dataAlignment, rule: rule_offset} }
func valexpression(frame *FrameContext) { var ( reg, _ = util.DecodeULEB128(frame.buf) l, _ = util.DecodeULEB128(frame.buf) expr = frame.buf.Next(int(l)) ) frame.regs[reg] = DWRule{rule: rule_valexpression, expression: expr} }
func definefile(sm *StateMachine, buf *bytes.Buffer) { var ( _, _ = util.ParseString(buf) _, _ = util.DecodeULEB128(buf) _, _ = util.DecodeULEB128(buf) _, _ = util.DecodeULEB128(buf) ) // Don't do anything here yet. }
func defcfasf(frame *FrameContext) { reg, _ := util.DecodeULEB128(frame.buf) offset, _ := util.DecodeSLEB128(frame.buf) frame.cfa.register = reg frame.cfa.offset = offset * frame.dataAlignment }
func valoffsetsf(frame *FrameContext) { var ( reg, _ = util.DecodeULEB128(frame.buf) offset, _ = util.DecodeSLEB128(frame.buf) ) frame.regs[reg] = DWRule{offset: offset * frame.dataAlignment, rule: rule_valoffset} }
func parseFileEntries(info *DebugLineInfo, buf *bytes.Buffer) { for { entry := new(FileEntry) name, _ := util.ParseString(buf) if name == "" { break } entry.Name = name entry.DirIdx, _ = util.DecodeULEB128(buf) entry.LastModTime, _ = util.DecodeULEB128(buf) entry.Length, _ = util.DecodeULEB128(buf) info.FileNames = append(info.FileNames, entry) } }
func defcfaexpression(frame *FrameContext) { var ( l, _ = util.DecodeULEB128(frame.buf) expr = frame.buf.Next(int(l)) ) frame.cfa.expression = expr frame.cfa.rule = rule_expression }
func restoreextended(frame *FrameContext) { reg, _ := util.DecodeULEB128(frame.buf) oldrule, ok := frame.initialRegs[reg] if ok { frame.regs[reg] = DWRule{offset: oldrule.offset, rule: rule_offset} } else { frame.regs[reg] = DWRule{rule: rule_undefined} } }
func execExtendedOpcode(sm *StateMachine, instr byte, buf *bytes.Buffer) { _, _ = util.DecodeULEB128(buf) b, _ := buf.ReadByte() fn, ok := extendedopcodes[b] if !ok { panic(fmt.Sprintf("Encountered unknown extended opcode %#v\n", b)) } sm.lastWasStandard = false fn(sm, buf) }
func offset(frame *FrameContext) { b, err := frame.buf.ReadByte() if err != nil { panic(err) } var ( reg = b & low_6_offset offset, _ = util.DecodeULEB128(frame.buf) ) frame.regs[uint64(reg)] = DWRule{offset: int64(offset) * frame.dataAlignment, rule: rule_offset} }
func samevalue(frame *FrameContext) { reg, _ := util.DecodeULEB128(frame.buf) frame.regs[reg] = DWRule{rule: rule_sameval} }
func advancepc(sm *StateMachine, buf *bytes.Buffer) { addr, _ := util.DecodeULEB128(buf) sm.address += addr * uint64(sm.dbl.Prologue.MinInstrLength) }
func defcfaoffset(frame *FrameContext) { offset, _ := util.DecodeULEB128(frame.buf) frame.cfa.offset = int64(offset) }
func defcfaregister(frame *FrameContext) { reg, _ := util.DecodeULEB128(frame.buf) frame.cfa.register = reg }
func setfile(sm *StateMachine, buf *bytes.Buffer) { i, _ := util.DecodeULEB128(buf) sm.file = sm.dbl.FileNames[i-1].Name }
func setcolumn(sm *StateMachine, buf *bytes.Buffer) { c, _ := util.DecodeULEB128(buf) sm.column = uint(c) }
func undefined(frame *FrameContext) { reg, _ := util.DecodeULEB128(frame.buf) frame.regs[reg] = DWRule{rule: rule_undefined} }
func plusuconsts(buf *bytes.Buffer, stack []int64, cfa int64) ([]int64, error) { slen := len(stack) num, _ := util.DecodeULEB128(buf) stack[slen-1] = stack[slen-1] + int64(num) return stack, nil }
func register(frame *FrameContext) { reg1, _ := util.DecodeULEB128(frame.buf) reg2, _ := util.DecodeULEB128(frame.buf) frame.regs[reg1] = DWRule{newreg: reg2, rule: rule_register} }