Remove old autovect-branch by moving to "dead" directory.
[official-gcc.git] / old-autovect-branch / libjava / sysdep / i386 / backtrace.h
blobb10840213a4448d2bdb12a7418c9197ef832fc4a
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
9 details. */
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. */
20 void
21 fallback_backtrace (_Jv_UnwindState *state)
23 register void *_ebp __asm__ ("ebp");
24 register void *_esp __asm__ ("esp");
25 unsigned int *rfp;
27 int i = state->pos;
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)
34 break;
36 state->frames[i].type = frame_native;
37 state->frames[i].ip = (void*)(rfp[1]-4);
38 i++;
40 state->pos = i;
42 #endif