From: Ivan Maidanski Date: Mon, 22 Apr 2019 21:44:52 +0000 (+0300) Subject: Fix save_callers for multi-threaded case if built-in backtrace unavailable X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a8c5ee41a95a1a541f088582de909f537a6827d9;p=gc Fix save_callers for multi-threaded case if built-in backtrace unavailable GC_stackbottom could be used only in the single-threaded case. * os_dep.c [SAVE_CALL_CHAIN && (NARGS!=0 || NFRAMES%2!=0 || !GC_HAVE_BUILTIN_BACKTRACE) && THREADS] (GC_save_callers): Do not compare fp to GC_stackbottom. * os_dep.c [SAVE_CALL_CHAIN && (NARGS!=0 || NFRAMES%2!=0 || !GC_HAVE_BUILTIN_BACKTRACE) && THREADS && STACK_GROWS_UP] (GC_save_callers): Break the loop if fp is NULL. --- diff --git a/os_dep.c b/os_dep.c index 23a83e45..1e713252 100644 --- a/os_dep.c +++ b/os_dep.c @@ -4597,7 +4597,11 @@ GC_INNER void GC_save_callers(struct callinfo info[NFRAMES]) #endif for (; !((word)fp HOTTER_THAN (word)frame) - && !((word)GC_stackbottom HOTTER_THAN (word)fp) +# ifndef THREADS + && !((word)GC_stackbottom HOTTER_THAN (word)fp) +# elif defined(STACK_GROWS_UP) + && fp != NULL +# endif && nframes < NFRAMES; fp = (struct frame *)((long) fp -> FR_SAVFP + BIAS), nframes++) { # if NARGS > 0