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/dwarf/testdata | |
| 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/dwarf/testdata')
| -rw-r--r-- | src/debug/dwarf/testdata/ranges.c | 25 | ||||
| -rwxr-xr-x | src/debug/dwarf/testdata/ranges.elf | bin | 0 -> 10348 bytes |
2 files changed, 25 insertions, 0 deletions
diff --git a/src/debug/dwarf/testdata/ranges.c b/src/debug/dwarf/testdata/ranges.c new file mode 100644 index 0000000000..2f208e591c --- /dev/null +++ b/src/debug/dwarf/testdata/ranges.c @@ -0,0 +1,25 @@ +// gcc -g -O2 -freorder-blocks-and-partition + +const char *arr[10000]; +const char *hot = "hot"; +const char *cold = "cold"; + +__attribute__((noinline)) +void fn(int path) { + int i; + + if (path) { + for (i = 0; i < sizeof arr / sizeof arr[0]; i++) { + arr[i] = hot; + } + } else { + for (i = 0; i < sizeof arr / sizeof arr[0]; i++) { + arr[i] = cold; + } + } +} + +int main(int argc, char *argv[]) { + fn(argc); + return 0; +} diff --git a/src/debug/dwarf/testdata/ranges.elf b/src/debug/dwarf/testdata/ranges.elf Binary files differnew file mode 100755 index 0000000000..7f54138cff --- /dev/null +++ b/src/debug/dwarf/testdata/ranges.elf |
