Cc: Tomek Grabiec <[email protected]>
Signed-off-by: Vegard Nossum <[email protected]>
---
arch/x86/backtrace.c | 35 +++++++++++++++++++++++++++++++++++
1 files changed, 35 insertions(+), 0 deletions(-)
diff --git a/arch/x86/backtrace.c b/arch/x86/backtrace.c
index 6b2dde4..1651aa3 100644
--- a/arch/x86/backtrace.c
+++ b/arch/x86/backtrace.c
@@ -24,7 +24,12 @@
* Please refer to the file LICENSE for details.
*/
+#include "jit/bc-offset-mapping.h"
+#include "jit/compilation-unit.h"
+#include "jit/cu-mapping.h"
#include "vm/backtrace.h"
+#include "vm/class.h"
+#include "vm/method.h"
#include <bfd.h>
#include <execinfo.h>
@@ -121,10 +126,40 @@ failed:
goto out;
}
+static bool show_jit_function(void *addr)
+{
+ struct compilation_unit *cu;
+ long bytecode_offset;
+ struct vm_method *vmm;
+ struct vm_class *vmc;
+ int line_number;
+
+ cu = jit_lookup_cu((unsigned long) addr);
+ if (!cu)
+ return false;
+
+ bytecode_offset = native_ptr_to_bytecode_offset(cu, addr);
+
+ vmm = cu->method;
+ vmc = vmm->class;
+
+ line_number = bytecode_offset_to_line_no(vmm, bytecode_offset);
+
+ printf(" [<%08lx> %s.%s%s+%lx %s:%d]\n", (unsigned long) addr,
+ vmc->name, vmm->name, vmm->type,
+ vm_method_is_native(vmm)
+ ? 0 : native_ptr_to_bytecode_offset(cu, addr),
+ vmc->source_file_name, line_number >= 1
+ ? line_number : 0);
+ return true;
+}
+
static void show_function(void *addr)
{
if (show_exe_function(addr))
return;
+ if (show_jit_function(addr))
+ return;
printf(" [<%08lx> <unknown>]\n", (unsigned long) addr);
}
--
1.6.0.6
------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge
This is your chance to win up to $100,000 in prizes! For a limited time,
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Jatovm-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jatovm-devel