diff options
| author | Austin Clements <austin@google.com> | 2019-08-21 15:05:26 -0400 |
|---|---|---|
| committer | Austin Clements <austin@google.com> | 2019-09-18 19:08:45 +0000 |
| commit | bc40294d47f100b6da4b21823cf85d11ce931c1b (patch) | |
| tree | f76ab0aecd797c684da96cd54ae7b30a741346fc /src/debug/dwarf/entry.go | |
| parent | 582d5194faec20c475ab93b45cf0520253dec4a9 (diff) | |
| download | go-bc40294d47f100b6da4b21823cf85d11ce931c1b.tar.xz | |
debug/dwarf: expose CU byte order
Currently, dwarf.Reader exposes the current compilation unit's address
size, but doesn't expose its byte order. Both are important for
decoding many attributes. For example, location descriptions include
addresses that are encoded in native form for the CU.
This CL exposes the byte order of the compilation unit in the same way
we already expose its address size, which makes it possible to decode
attributes containing native addresses.
Change-Id: I92f156818fe92b049d1dfc1613816bb1689cfadf
Reviewed-on: https://go-review.googlesource.com/c/go/+/192698
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src/debug/dwarf/entry.go')
| -rw-r--r-- | src/debug/dwarf/entry.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/debug/dwarf/entry.go b/src/debug/dwarf/entry.go index 43043f60dd..01f2190db7 100644 --- a/src/debug/dwarf/entry.go +++ b/src/debug/dwarf/entry.go @@ -11,6 +11,7 @@ package dwarf import ( + "encoding/binary" "errors" "strconv" ) @@ -735,6 +736,11 @@ func (r *Reader) AddressSize() int { return r.d.unit[r.unit].asize } +// ByteOrder returns the byte order in the current compilation unit. +func (r *Reader) ByteOrder() binary.ByteOrder { + return r.b.order +} + // Seek positions the Reader at offset off in the encoded entry stream. // Offset 0 can be used to denote the first entry. func (r *Reader) Seek(off Offset) { |
