diff options
| author | Ian Lance Taylor <iant@golang.org> | 2016-03-16 14:15:54 -0700 |
|---|---|---|
| committer | Ian Lance Taylor <iant@golang.org> | 2016-03-22 14:06:09 +0000 |
| commit | d1b8871f13203cd99d5e7d686170f0e266760084 (patch) | |
| tree | 7458f93ff93d8c7b849eab786932a1682657337b /src/debug/elf | |
| parent | 77f4b773e72b0840a1ce0b314cba44dff9fbaf31 (diff) | |
| download | go-d1b8871f13203cd99d5e7d686170f0e266760084.tar.xz | |
debug/dwarf: add Reader.SeekPC and Data.Ranges
These new methods help find the compilation unit to pass to the
LineReader method in order to find the line information for a PC.
The Ranges method also helps identify the specific function for a PC,
needed to determine the function name.
This uses the .debug.ranges section if necessary, and changes the object
file format packages to pass in the section contents if available.
Change-Id: I5ebc3d27faaf1a126ffb17a1e6027efdf64af836
Reviewed-on: https://go-review.googlesource.com/20769
Reviewed-by: Austin Clements <austin@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'src/debug/elf')
| -rw-r--r-- | src/debug/elf/file.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/debug/elf/file.go b/src/debug/elf/file.go index 17bf76b29e..72796d535f 100644 --- a/src/debug/elf/file.go +++ b/src/debug/elf/file.go @@ -958,7 +958,7 @@ func (f *File) DWARF() (*dwarf.Data, error) { // There are many other DWARF sections, but these // are the ones the debug/dwarf package uses. // Don't bother loading others. - var dat = map[string][]byte{"abbrev": nil, "info": nil, "str": nil, "line": nil} + var dat = map[string][]byte{"abbrev": nil, "info": nil, "str": nil, "line": nil, "ranges": nil} for i, s := range f.Sections { suffix := "" switch { @@ -979,7 +979,7 @@ func (f *File) DWARF() (*dwarf.Data, error) { dat[suffix] = b } - d, err := dwarf.New(dat["abbrev"], nil, nil, dat["info"], dat["line"], nil, nil, dat["str"]) + d, err := dwarf.New(dat["abbrev"], nil, nil, dat["info"], dat["line"], nil, dat["ranges"], dat["str"]) if err != nil { return nil, err } |
