| // Copyright 2009 The Go Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style |
| // license that can be found in the LICENSE file. |
| // DWARF debug info is split into a sequence of compilation units. |
| // Each unit has its own abbreviation table and address size. |
| base Offset // byte offset of header within the aggregate info |
| off Offset // byte offset of data within the aggregate info |
| func (d *Data) parseUnits() ([]unit, error) { |
| b := makeBuf(d, "info", 0, d.info, 0) |
| // Again, this time writing them down. |
| b = makeBuf(d, "info", 0, d.info, 0) |
| units := make([]unit, nunit) |
| if vers := b.uint16(); vers != 2 { |
| b.error("unsupported DWARF version " + strconv.Itoa(int(vers))) |
| atable, err := d.parseAbbrev(b.uint32()) |
| u.addrsize = int(b.uint8()) |
| u.data = b.bytes(int(n - (2 + 4 + 1))) |