diff options
author | megacz <megacz@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-04-24 01:33:19 +0000 |
---|---|---|
committer | megacz <megacz@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-04-24 01:33:19 +0000 |
commit | 22b229f4ba9db2aad1adee4c220318c6a2967f49 (patch) | |
tree | b09f0ef88666b7cf5f7e6c1694bf7db50ac9508f /libjava/win32.cc | |
parent | cb135e40a10c4d219e1560af4427e9f279f1fa8e (diff) | |
download | gcc-22b229f4ba9db2aad1adee4c220318c6a2967f49.tar.gz |
2002-04-23 Adam Megacz <adam@xwt.org>
* win32.cc, include/win32.cc (backtrace): Added this function
because Win32 does not supply it.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@52701 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/win32.cc')
-rw-r--r-- | libjava/win32.cc | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/libjava/win32.cc b/libjava/win32.cc index c5f434029e0..af1163fbfa9 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; +} |