#include <stdint.h>
-#include "mm/memory.h"
-
-#include "threads/threads-common.h"
+#include "mm/memory.hpp"
#include "toolbox/avl.h"
#include "vm/jit/asmpart.h"
#include "vm/jit/methodtree.h"
+#include "vm/jit/stacktrace.hpp"
/* methodtree_element *********************************************************/
{
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);
#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;
-#if defined(ENABLE_THREADS)
- /* XXX michi: This should be available even without threads! */
- threads_print_stacktrace();
-#endif
+ // Actually try to dump a stacktrace.
+ log_println("Dumping the current stacktrace:");
+ stacktrace_print_current();
vm_abort("Exiting...");
}