aboutsummaryrefslogtreecommitdiff
path: root/libgo/runtime
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2019-06-03 23:07:54 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2019-06-03 23:07:54 +0000
commitc533ffe04d5fc1baa85dddd8fd5f651128cf11ed (patch)
tree9b0df7f8a2130484fd7458745c8ec0361f3f9850 /libgo/runtime
parent3e6f8fe1bc4c60859113bca7970b0b8db56eb442 (diff)
downloadgcc-c533ffe04d5fc1baa85dddd8fd5f651128cf11ed.zip
gcc-c533ffe04d5fc1baa85dddd8fd5f651128cf11ed.tar.gz
gcc-c533ffe04d5fc1baa85dddd8fd5f651128cf11ed.tar.bz2
libgo: delay applying profile stack-frame skip until fixup
When the runtime collects a stack trace to associate it with some profiling event (mem alloc, mutex, etc) there is a skip count passed to runtime.Callers (or equivalent) to skip some known count of frames in order to get to the "interesting" frame corresponding to the profile event. Now that the profiling mechanism uses lazy fixup (when removing compiler artifacts like thunks, morestack calls etc), we also need to move the frame skipping logic after the fixup, so as to insure that the skip count isn't thrown off by these artifacts. Fixes golang/go#32290. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/179740 From-SVN: r271892
Diffstat (limited to 'libgo/runtime')
-rw-r--r--libgo/runtime/go-callers.c10
1 files changed, 1 insertions, 9 deletions
diff --git a/libgo/runtime/go-callers.c b/libgo/runtime/go-callers.c
index 4a9c1a7..e7d53a3 100644
--- a/libgo/runtime/go-callers.c
+++ b/libgo/runtime/go-callers.c
@@ -268,7 +268,6 @@ Callers (intgo skip, struct __go_open_array pc)
struct callersRaw_data
{
uintptr* pcbuf;
- int skip;
int index;
int max;
};
@@ -280,12 +279,6 @@ static int callback_raw (void *data, uintptr_t pc)
{
struct callersRaw_data *arg = (struct callersRaw_data *) data;
- if (arg->skip > 0)
- {
- --arg->skip;
- return 0;
- }
-
/* On the call to backtrace_simple the pc value was most likely
decremented if there was a normal call, since the pc referred to
the instruction where the call returned and not the call itself.
@@ -306,13 +299,12 @@ static int callback_raw (void *data, uintptr_t pc)
/* runtime_callersRaw is similar to runtime_callers() above, but
it returns raw PC values as opposed to file/func/line locations. */
int32
-runtime_callersRaw (int32 skip, uintptr *pcbuf, int32 m)
+runtime_callersRaw (uintptr *pcbuf, int32 m)
{
struct callersRaw_data data;
struct backtrace_state* state;
data.pcbuf = pcbuf;
- data.skip = skip + 1;
data.index = 0;
data.max = m;
runtime_xadd (&__go_runtime_in_callers, 1);