From: Michael Starzinger Date: Mon, 31 Aug 2009 14:51:16 +0000 (+0200) Subject: * src/vm/jit/methodtree.c (methodtree_find): Detect and avoid endless loop when X-Git-Url: http://wien.tomnetworks.com/gitweb/?p=cacao.git;a=commitdiff_plain;h=a972dc38e7ed2303de37afe2952f3f398fb44c51 * src/vm/jit/methodtree.c (methodtree_find): Detect and avoid endless loop when methodtree lookup fails during stacktrace creation. --- diff --git a/src/vm/jit/methodtree.c b/src/vm/jit/methodtree.c index 2d125364a..e8dd331aa 100644 --- a/src/vm/jit/methodtree.c +++ b/src/vm/jit/methodtree.c @@ -175,6 +175,10 @@ void *methodtree_find(void *pc) { void *pv; + // This flag indicates whether a methodtree lookup is failing. We need + // to keep track of this to avoid endless loops during stacktrace creation. + static bool methodtree_find_failing = false; + /* Try to find a method. */ pv = methodtree_find_nocheck(pc); @@ -196,8 +200,14 @@ void *methodtree_find(void *pc) #endif log_println(""); - log_println("Dumping the current stacktrace:"); + // Detect and avoid endless loops. + if (methodtree_find_failing) + vm_abort("Exiting without stacktrace..."); + else + methodtree_find_failing = true; + // Actually try to dump a stacktrace. + log_println("Dumping the current stacktrace:"); stacktrace_print_current(); vm_abort("Exiting...");