Files
Ian Lance Taylor 142d9852da 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>
2016-03-22 14:06:09 +00:00

26 lines
415 B
C

// 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;
}