func (lh *lineHeader) Read(br *binary.BinaryReader) error { start, _ := br.Seek(0, 1) err := br.ReadInterface(&lh.Header) if err != nil { return err } if lh.is64 { lh.header_length, err = br.Int64() } else { var v uint32 v, err = br.Uint32() lh.header_length = int64(v) } if err != nil { return err } if lh.minimum_instruction_length, err = br.Uint8(); err != nil { return err } lh.maximum_operations_per_instruction = 1 // TODO: // if lh.maximum_operations_per_instruction, err = br.Uint8(); err != nil { // return err // } if err = br.ReadInterface(&lh.default_is_stmt); err != nil { return err } else if lh.line_base, err = br.Int8(); err != nil { return err } else if lh.line_range, err = br.Uint8(); err != nil { return err } else if lh.opcode_base, err = br.Uint8(); err != nil { return err } lh.standard_opcode_lengths = make([]uint8, lh.opcode_base-1) if err := br.ReadInterface(&lh.standard_opcode_lengths); err != nil { return err } for { var s string if err := br.ReadInterface(&s); err != nil { return err } else if s == "" { break } else { lh.include_directories = append(lh.include_directories, s) } } for { var f fileEntry pos, _ := br.Seek(0, 1) if v, err := br.Uint8(); err != nil { return err } else if v == '\u0000' { break } else { br.Seek(pos, 0) } if err := br.ReadInterface(&f); err != nil { return err } else { lh.file_names = append(lh.file_names, f) } } var s state s.header = lh s.reset() pos, _ := br.Seek(0, 1) for (pos - 4 - start) < int64(lh.Length) { var op DW_LNS if err := br.ReadInterface(&op); err != nil { return err } if op == 0 { var length LEB128 if err := br.ReadInterface(&length); err != nil { return err } var op2 DW_LNE if err := br.ReadInterface(&op2); err != nil { return err } s.executeLNE(op2, length-1, br) } else { s.execute(op, br) } pos, _ = br.Seek(0, 1) } return nil }