Skip to content

Commit 253ad67

Browse files
committed
debug/dwarf: document DWARF class -> Go type mapping
Currently, the only way to know the Go type of an attribute of some DWARF attribute class was to read the dwarf package code (or experiment). This makes it hard to go from the DWARF specification to writing code that uses the dwarf package. Fix this by adding a table to the documentation comment of the Field type that gives the correspondence between DWARF attribute classes and Go types. Change-Id: I57c678a551fa1eb46f8207085d5a53d44985e3e7 Reviewed-on: https://go-review.googlesource.com/7280 Reviewed-by: Rob Pike <[email protected]> Reviewed-by: Nigel Tao <[email protected]>
1 parent faa9d1e commit 253ad67

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/debug/dwarf/entry.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,25 @@ type Entry struct {
102102
}
103103

104104
// A Field is a single attribute/value pair in an Entry.
105+
//
106+
// A value can be one of several "attribute classes" defined by DWARF.
107+
// The Go types corresponding to each class are:
108+
//
109+
// Class Go type
110+
// ----- -------
111+
// address uint64
112+
// block []byte
113+
// constant int64
114+
// flag bool
115+
// reference
116+
// to info dwarf.Offset (for use with Reader.Seek)
117+
// to type unit uint64 (type signature)
118+
// string string
119+
// exprloc []byte
120+
// lineptr int64
121+
// loclistptr int64
122+
// macptr int64
123+
// rangelistptr int64
105124
type Field struct {
106125
Attr Attr
107126
Val interface{}

0 commit comments

Comments
 (0)