diff options
author | Adam Megacz <adam@xwt.org> | 2002-04-24 01:33:19 +0000 |
---|---|---|
committer | Adam Megacz <megacz@gcc.gnu.org> | 2002-04-24 01:33:19 +0000 |
commit | c2a6704f600a3227e7bcc1d2a4ecbafb2c08086c (patch) | |
tree | b09f0ef88666b7cf5f7e6c1694bf7db50ac9508f | |
parent | 9385d9cb0d46686a89108fa6b82b75e4d36b6e0f (diff) | |
download | gcc-c2a6704f600a3227e7bcc1d2a4ecbafb2c08086c.zip gcc-c2a6704f600a3227e7bcc1d2a4ecbafb2c08086c.tar.gz gcc-c2a6704f600a3227e7bcc1d2a4ecbafb2c08086c.tar.bz2 |
win32.cc, win32.cc (backtrace): Added this function because Win32 does not supply it.
2002-04-23 Adam Megacz <adam@xwt.org>
* win32.cc, include/win32.cc (backtrace): Added this function
because Win32 does not supply it.
From-SVN: r52701
-rw-r--r-- | libjava/ChangeLog | 5 | ||||
-rw-r--r-- | libjava/include/win32.h | 6 | ||||
-rw-r--r-- | libjava/win32.cc | 22 |
3 files changed, 33 insertions, 0 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog index 3f08237..d084656 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,8 @@ +2002-04-23 Adam Megacz <adam@xwt.org> + + * win32.cc, include/win32.cc (backtrace): Added this function + because Win32 does not supply it. + 2002-04-21 David S. Miller <davem@redhat.com> * include/dwarf2-signal.h (MAKE_THROW_FRAME, sparc32): Document diff --git a/libjava/include/win32.h b/libjava/include/win32.h index 9a8a769..8fbe393 100644 --- a/libjava/include/win32.h +++ b/libjava/include/win32.h @@ -29,4 +29,10 @@ _Jv_platform_close_on_exec (jint) // Ignore. } +#define HAVE_BACKTRACE + +/* Store up to SIZE return address of the current program state in + ARRAY and return the exact number of values stored. */ +extern int backtrace (void **__array, int __size); + #endif /* __JV_WIN32_H__ */ diff --git a/libjava/win32.cc b/libjava/win32.cc index c5f4340..af1163f 100644 --- a/libjava/win32.cc +++ b/libjava/win32.cc @@ -195,3 +195,25 @@ _Jv_platform_initProperties (java::util::Properties* newprops) break; } } + +/* Store up to SIZE return address of the current program state in + ARRAY and return the exact number of values stored. */ +int +backtrace (void **__array, int __size) +{ + register void *_ebp __asm__ ("ebp"); + register void *_esp __asm__ ("esp"); + unsigned int *rfp; + + int i=0; + for (rfp = *(unsigned int**)_ebp; + rfp && i < __size; + rfp = *(unsigned int **)rfp) + { + int diff = *rfp - (unsigned int)rfp; + if ((void*)rfp < _esp || diff > 4 * 1024 || diff < 0) break; + + __array[i++] = (void*)(rfp[1]-4); + } + return i; +} |