From bda833d00cd95c57224145be1c596f5318f08759 Mon Sep 17 00:00:00 2001 From: Kris Van Hees Date: Tue, 23 Apr 2013 04:08:25 -0400 Subject: [PATCH] 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 --- dtrace/dtrace_isa.c | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/dtrace/dtrace_isa.c b/dtrace/dtrace_isa.c index 8c29b5ad981b..92023774b114 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; -- 2.50.1