summaryrefslogtreecommitdiff
path: root/libgo/go/debug/dwarf/open.go
diff options
context:
space:
mode:
Diffstat (limited to 'libgo/go/debug/dwarf/open.go')
-rw-r--r--libgo/go/debug/dwarf/open.go25
1 files changed, 25 insertions, 0 deletions
diff --git a/libgo/go/debug/dwarf/open.go b/libgo/go/debug/dwarf/open.go
index 938186998ff..d6d4f78b27f 100644
--- a/libgo/go/debug/dwarf/open.go
+++ b/libgo/go/debug/dwarf/open.go
@@ -22,8 +22,14 @@ type Data struct {
ranges []byte
str []byte
+ // New sections added in DWARF 5.
+ addr []byte
+ lineStr []byte
+ strOffsets []byte
+
// parsed data
abbrevCache map[uint64]abbrevTable
+ bigEndian bool
order binary.ByteOrder
typeCache map[Offset]Type
typeSigs map[uint64]*typeUnit
@@ -72,8 +78,10 @@ func New(abbrev, aranges, frame, info, line, pubnames, ranges, str []byte) (*Dat
case x == 0 && y == 0:
return nil, DecodeError{"info", 4, "unsupported version 0"}
case x == 0:
+ d.bigEndian = true
d.order = binary.BigEndian
case y == 0:
+ d.bigEndian = false
d.order = binary.LittleEndian
default:
return nil, DecodeError{"info", 4, "cannot determine byte order"}
@@ -94,3 +102,20 @@ func New(abbrev, aranges, frame, info, line, pubnames, ranges, str []byte) (*Dat
func (d *Data) AddTypes(name string, types []byte) error {
return d.parseTypes(name, types)
}
+
+// AddSection adds another DWARF section by name. The name should be a
+// DWARF section name such as ".debug_addr", ".debug_str_offsets", and
+// so forth. This approach is used for new DWARF sections added in
+// DWARF 5 and later.
+func (d *Data) AddSection(name string, contents []byte) error {
+ switch name {
+ case ".debug_addr":
+ d.addr = contents
+ case ".debug_line_str":
+ d.lineStr = contents
+ case ".debug_str_offsets":
+ d.strOffsets = contents
+ }
+ // Just ignore names that we don't yet support.
+ return nil
+}