1 // backtrace.h - Fallback backtrace implementation. i386 implementation.
3 /* Copyright (C) 2005 Free Software Foundation
5 This file is part of libgcj.
7 This software is copyrighted work licensed under the terms of the
8 Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
11 #ifndef __SYSDEP_BACKTRACE_H__
12 #define __SYSDEP_BACKTRACE_H__
14 #include <java-stack.h>
16 #define HAVE_FALLBACK_BACKTRACE
18 /* Store return addresses of the current program stack in
19 STATE and return the exact number of values stored. */
21 fallback_backtrace (_Jv_UnwindState *state)
23 register void *_ebp __asm__ ("ebp");
24 register void *_esp __asm__ ("esp");
28 for (rfp = *(unsigned int**)_ebp;
29 rfp && i < state->length;
30 rfp = *(unsigned int **)rfp)
32 int diff = *rfp - (unsigned int)rfp;
33 if ((void*)rfp < _esp || diff > 4 * 1024 || diff < 0)
36 state->frames[i].type = frame_native;
37 state->frames[i].ip = (void*)(rfp[1]-4);