]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
dtrace: ensure ustackdepth returns correct value
authorKris Van Hees <kris.van.hees@oracle.com>
Wed, 24 May 2017 05:00:34 +0000 (01:00 -0400)
committerKris Van Hees <kris.van.hees@oracle.com>
Wed, 24 May 2017 16:42:22 +0000 (12:42 -0400)
The implementation for ustackdepth was causing it to always return 1,
regardless of the depth of the ustack().  The commit ensures that the
underlying code can walk the stack (without actually collecting PCs)
and determine the depth.

Orabug: 25949692
Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
Acked-by: Nick Alcock <nick.alcock@oracle.com>
dtrace/dtrace_isa.c

index 124806026547a539b8806b2fe628904148584d27..f2dcd512388668a8cfa00852820e0483760ccd6f 100644 (file)
@@ -176,11 +176,12 @@ unsigned long dtrace_getufpstack(uint64_t *pcstack, uint64_t *fpstack,
        dtrace_stacktrace(&st);
 
        depth = st.depth;
-        while (st.depth < st.limit) {
-               if (pcstack)
+       if (pcstack) {
+               while (st.depth < st.limit) {
                        pcstack[st.depth++] = 0;
-               if (fpstack)
-                       fpstack[st.depth++] = 0;
+                       if (fpstack)
+                               fpstack[st.depth++] = 0;
+               }
        }
 
        return depth;
@@ -231,5 +232,5 @@ int dtrace_getstackdepth(dtrace_mstate_t *mstate, int aframes)
 
 int dtrace_getustackdepth(void)
 {
-       return dtrace_getufpstack(NULL, NULL, 0);
+       return dtrace_getufpstack(NULL, NULL, INT_MAX);
 }