| 1 |
// Copyright 2019 The Go Authors. All rights reserved. |
| 2 |
// Use of this source code is governed by a BSD-style |
| 3 |
// license that can be found in the LICENSE file. |
| 4 |
|
| 5 |
package sym |
| 6 |
|
| 7 |
import "cmd/internal/dwarf" |
| 8 |
|
| 9 |
// LoaderSym holds a loader.Sym value. We can't refer to this |
| 10 |
// type from the sym package since loader imports sym. |
| 11 |
type LoaderSym uint32 |
| 12 |
|
| 13 |
// A CompilationUnit represents a set of source files that are compiled |
| 14 |
// together. Since all Go sources in a Go package are compiled together, |
| 15 |
// there's one CompilationUnit per package that represents all Go sources in |
| 16 |
// that package, plus one for each assembly file. |
| 17 |
// |
| 18 |
// Equivalently, there's one CompilationUnit per object file in each Library |
| 19 |
// loaded by the linker. |
| 20 |
// |
| 21 |
// These are used for both DWARF and pclntab generation. |
| 22 |
type CompilationUnit struct { |
| 23 |
Lib *Library // Our library |
| 24 |
PclnIndex int // Index of this CU in pclntab |
| 25 |
PCs []dwarf.Range // PC ranges, relative to Textp[0] |
| 26 |
DWInfo *dwarf.DWDie // CU root DIE |
| 27 |
FileTable []string // The file table used in this compilation unit. |
| 28 |
|
| 29 |
Consts LoaderSym // Package constants DIEs |
| 30 |
FuncDIEs []LoaderSym // Function DIE subtrees |
| 31 |
VarDIEs []LoaderSym // Global variable DIEs |
| 32 |
AbsFnDIEs []LoaderSym // Abstract function DIE subtrees |
| 33 |
RangeSyms []LoaderSym // Symbols for debug_range |
| 34 |
Textp []LoaderSym // Text symbols in this CU |
| 35 |
Addrs map[LoaderSym]uint32 // slot in .debug_addr for fn sym (DWARF5) |
| 36 |
} |