diff options
author | Pekka Enberg <penberg@kernel.org> | 2013-06-06 21:30:48 +0300 |
---|---|---|
committer | Pekka Enberg <penberg@kernel.org> | 2013-06-06 21:30:48 +0300 |
commit | a49d3cbbe251617942ed45d47a153ab156b6e488 (patch) | |
tree | de112cfbb1cc8d8ef7fc7ecc1a0818c2b3084925 | |
parent | 11d9db8ec4e6c64ae87be0d16f01db9d8536a341 (diff) | |
download | jato-a49d3cbbe251617942ed45d47a153ab156b6e488.tar.gz |
x86: Improve check_stack_align() error message
Make the error more readable and add information about number of
arguments passed on the stack:
[penberg@tux jruby-1.7.3]$ jato -Xdebug:stack -jar lib/jruby.jar -v
Error: stack is 8 bytes misaligned when entering function:
gnu/java/net/loader/JarURLLoader.<init>(Ljava/net/URLClassLoader;Lgnu/java/net/loader/URLStreamHandlerCache;Ljava/net/URLStreamHandlerFactory;Ljava/net/URL;Ljava/net/URL;)V.
which has 0 arguments passed on the stack.
Aborted
Signed-off-by: Pekka Enberg <penberg@kernel.org>
-rw-r--r-- | arch/x86/debug.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/arch/x86/debug.c b/arch/x86/debug.c index e73ab16c..5f83f616 100644 --- a/arch/x86/debug.c +++ b/arch/x86/debug.c @@ -3,6 +3,7 @@ #include "arch/stack-frame.h" #include "vm/method.h" #include "vm/class.h" +#include "jit/args.h" #include <stdlib.h> #include <stdio.h> @@ -14,10 +15,16 @@ void check_stack_align(struct vm_method *vmm) #else register unsigned long fp __asm__("rbp"); #endif + unsigned long nr_stack_args; + + nr_stack_args = get_stack_args_count(vmm); if (fp % X86_STACK_ALIGN != 0) { - fprintf(stderr, "Error: stack is %lu bytes misaligned when entering %s.%s%s.\n", - fp % X86_STACK_ALIGN, vmm->class->name, vmm->name, vmm->type); + fprintf(stderr, + "Error: stack is %lu bytes misaligned when entering function:" + "\n\n %s.%s%s.\n\n" + "which has %lu arguments passed on the stack.\n", + fp % X86_STACK_ALIGN, vmm->class->name, vmm->name, vmm->type, nr_stack_args); abort(); } } |