From cc6596c13cb0a56680228ded93a77683cccbeb50 Mon Sep 17 00:00:00 2001 From: Kris Van Hees Date: Wed, 24 May 2017 01:00:34 -0400 Subject: [PATCH] dtrace: ensure ustackdepth returns correct value 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 Acked-by: Nick Alcock --- dtrace/dtrace_isa.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/dtrace/dtrace_isa.c b/dtrace/dtrace_isa.c index 124806026547..f2dcd5123886 100644 --- a/dtrace/dtrace_isa.c +++ b/dtrace/dtrace_isa.c @@ -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); } -- 2.50.1