We cannot use vm/stack-trace.o in unit tests because it requires
correct VM initialization which is not available in unit tests.

This fixes bug reported by Vegard Nossum which prevented
backtrace output on failed assertions.

Reported-by: Vegard Nossum <vegard.nos...@gmail.com>
Signed-off-by: Tomek Grabiec <tgrab...@gmail.com>
---
 test/arch-x86/Makefile     |    4 ++--
 test/vm/stack-trace-stub.c |   23 +++++++++++++++++++++++
 2 files changed, 25 insertions(+), 2 deletions(-)

diff --git a/test/arch-x86/Makefile b/test/arch-x86/Makefile
index de408a5..83dd125 100644
--- a/test/arch-x86/Makefile
+++ b/test/arch-x86/Makefile
@@ -64,7 +64,6 @@ TOPLEVEL_OBJS := \
        vm/method.o \
        vm/object.o \
        vm/stack.o \
-       vm/stack-trace.o \
        vm/static.o \
        vm/thread.o \
        vm/trace.o \
@@ -79,7 +78,8 @@ TOPLEVEL_OBJS := \
        test/libharness/libharness.o \
        test/vm/classloader-stub.o \
        test/vm/preload-stub.o \
-       test/vm/signal-stub.o
+       test/vm/signal-stub.o \
+       test/vm/stack-trace-stub.o
 
 TEST_OBJS := \
        emit-code-test$(ARCH_POSTFIX).o \
diff --git a/test/vm/stack-trace-stub.c b/test/vm/stack-trace-stub.c
index 7278b4d..f54172a 100644
--- a/test/vm/stack-trace-stub.c
+++ b/test/vm/stack-trace-stub.c
@@ -5,6 +5,29 @@
 #include "vm/stack-trace.h"
 #include "vm/trace.h"
 
+void *vm_native_stack_offset_guard;
+void *vm_native_stack_badoffset;
+void *jni_stack_offset_guard;
+void *jni_stack_badoffset;
+
+__thread struct jni_stack_entry jni_stack[JNI_STACK_SIZE];
+__thread unsigned long jni_stack_offset;
+__thread struct vm_native_stack_entry vm_native_stack[VM_NATIVE_STACK_SIZE];
+__thread unsigned long vm_native_stack_offset;
+
+void vm_print_exception(struct vm_object *exception)
+{
+}
+
+int vm_enter_vm_native(void *target, void *stack_ptr)
+{
+       return 0;
+}
+
+void vm_leave_vm_native(void)
+{
+}
+
 int vm_enter_jni(void *caller_frame, unsigned long call_site_addr,
                 struct vm_method *method)
 {
-- 
1.6.0.6


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Jatovm-devel mailing list
Jatovm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jatovm-devel

Reply via email to