]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
Ensure PID is passed as first element for ustack.
authorKris Van Hees <kris.van.hees@oracle.com>
Tue, 23 Apr 2013 08:08:25 +0000 (04:08 -0400)
committerKris Van Hees <kris.van.hees@oracle.com>
Tue, 23 Apr 2013 08:08:25 +0000 (04:08 -0400)
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 <kris.van.hees@oracle.com>
dtrace/dtrace_isa.c

index 8c29b5ad981bc3e609942657cb72d67149171910..92023774b1141d39ada60f94f717d480e601a22b 100644 (file)
@@ -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;