From: Kris Van Hees Date: Tue, 23 Apr 2013 08:08:25 +0000 (-0400) Subject: Ensure PID is passed as first element for ustack. X-Git-Tag: v4.1.12-111.0.20170907_2225~3^2~3^2~163 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=bda833d00cd95c57224145be1c596f5318f08759;p=users%2Fjedix%2Flinux-maple.git Ensure PID is passed as first element for ustack. Code that uses getupcstack and getufpstack expects to see the PID of the associated process in the first slot of the program counter array. Signed-off-by: Kris Van Hees --- diff --git a/dtrace/dtrace_isa.c b/dtrace/dtrace_isa.c index 8c29b5ad981bc..92023774b1141 100644 --- a/dtrace/dtrace_isa.c +++ b/dtrace/dtrace_isa.c @@ -446,11 +446,7 @@ void dtrace_getpcstack(uint64_t *pcstack, int pcstack_limit, int aframes, STACKTRACE_KERNEL }; -#if 0 - dump_trace(NULL, NULL, NULL, 0, &dtrace_tracetrace_ops, &st); -#else dtrace_stacktrace(&st); -#endif while (st.depth < st.limit) pcstack[st.depth++] = 0; @@ -459,18 +455,16 @@ void dtrace_getpcstack(uint64_t *pcstack, int pcstack_limit, int aframes, void dtrace_getupcstack(uint64_t *pcstack, int pcstack_limit) { struct stacktrace_state st = { - pcstack, + pcstack + 1, /* 0 = PID */ NULL, - pcstack_limit, + pcstack_limit - 1, /* skip PID */ 0, STACKTRACE_USER }; -#if 0 - dump_trace(NULL, NULL, NULL, 0, &dtrace_tracetrace_ops, &st); -#else + *pcstack++ = (uint64_t)current->pid; + dtrace_stacktrace(&st); -#endif while (st.depth < st.limit) pcstack[st.depth++] = 0; @@ -480,18 +474,16 @@ void dtrace_getufpstack(uint64_t *pcstack, uint64_t *fpstack, int pcstack_limit) { struct stacktrace_state st = { - pcstack, + pcstack + 1, /* 0 = PID */ fpstack, - pcstack_limit, + pcstack_limit - 1, /* skip PID */ 0, STACKTRACE_USER }; -#if 0 - dump_trace(NULL, NULL, NULL, 0, &dtrace_tracetrace_ops_alt, &st); -#else + *pcstack++ = (uint64_t)current->pid; + dtrace_stacktrace(&st); -#endif while (st.depth < st.limit) { fpstack[st.depth] = 0;