]> granicus.if.org Git - gc/commitdiff
Fix save_callers for multi-threaded case if built-in backtrace unavailable
authorIvan Maidanski <ivmai@mail.ru>
Mon, 22 Apr 2019 21:44:52 +0000 (00:44 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Mon, 22 Apr 2019 21:44:52 +0000 (00:44 +0300)
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.

os_dep.c

index 23a83e45ffcfab48ec43f5bfbb195eb1b75c4671..1e713252ebe0269f15a30761e9dd1347d86a2769 100644 (file)
--- 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