1 /* src/vm/jit/stacktrace.h - header file for stacktrace generation
3 Copyright (C) 1996-2005, 2006, 2007, 2008
5 This file is part of CACAO.
7 This program is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public License as
9 published by the Free Software Foundation; either version 2, or (at
10 your option) any later version.
12 This program is distributed in the hope that it will be useful, but
13 WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
28 /* forward typedefs ***********************************************************/
30 typedef struct stackframeinfo_t stackframeinfo_t;
31 typedef struct stacktrace_entry_t stacktrace_entry_t;
32 typedef struct stacktrace_t stacktrace_t;
42 #include "vm/global.h"
44 #include "vm/jit/code.h"
46 #include "vmcore/class.h"
49 /* stackframeinfo **************************************************************
51 ATTENTION: Keep the number of elements of this structure even, to
52 make sure that the stack keeps aligned (e.g. 16-bytes for x86_64).
54 *******************************************************************************/
56 struct stackframeinfo_t {
57 stackframeinfo_t *prev; /* pointer to prev stackframeinfo */
58 codeinfo *code; /* codeinfo of current method */
59 u1 *pv; /* PV of current function */
60 u1 *sp; /* SP of parent Java function */
61 u1 *ra; /* RA to parent Java function */
62 u1 *xpc; /* XPC (for inline stubs) */
63 #if defined(ENABLE_GC_CACAO)
65 * The exact GC needs to be able to recover saved registers, so the
66 * native-stub saves these registers here
68 # if defined(HAS_ADDRESS_REGISTER_FILE)
69 uintptr_t adrregs[ADR_SAV_CNT];
71 uintptr_t intregs[INT_SAV_CNT];
77 /* stacktrace_entry_t *********************************************************/
79 struct stacktrace_entry_t {
80 codeinfo *code; /* codeinfo pointer of this method */
81 void *pc; /* PC in this method */
85 /* stacktrace_t ***************************************************************/
88 int32_t length; /* length of the entries array */
89 stacktrace_entry_t entries[1]; /* stacktrace entries */
93 /* function prototypes ********************************************************/
95 void stacktrace_stackframeinfo_add(stackframeinfo_t *sfi, u1 *pv, u1 *sp, u1 *ra, u1 *xpc);
96 void stacktrace_stackframeinfo_remove(stackframeinfo_t *sfi);
98 java_handle_bytearray_t *stacktrace_get(stackframeinfo_t *sfi);
99 java_handle_bytearray_t *stacktrace_get_current(void);
101 #if defined(ENABLE_JAVASE)
102 classloader *stacktrace_first_nonnull_classloader(void);
103 java_handle_objectarray_t *stacktrace_getClassContext(void);
104 classinfo *stacktrace_get_current_class(void);
105 java_handle_objectarray_t *stacktrace_get_stack(void);
108 void stacktrace_print(stacktrace_t *st);
109 void stacktrace_print_exception(java_handle_t *h);
111 /* machine dependent functions (code in ARCH_DIR/md.c) */
113 #if defined(ENABLE_JIT)
114 # if defined(__SPARC_64__)
115 u1 *md_get_framepointer(u1 *sp);
116 u1 *md_get_pv_from_stackframe(u1 *sp);
120 #if defined(ENABLE_INTRP)
121 u1 *intrp_md_stacktrace_get_returnaddress(u1 *sp, u4 framesize);
124 #if defined(ENABLE_CYCLES_STATS)
125 void stacktrace_print_cycles_stats(FILE *file);
128 #endif /* _STACKTRACE_H */
132 * These are local overrides for various environment variables in Emacs.
133 * Please do not remove this and leave it at the end of the file, where
134 * Emacs will automagically detect them.
135 * ---------------------------------------------------------------------
138 * indent-tabs-mode: t
142 * vim:noexpandtab:sw=4:ts=4: