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
This commit is contained in:
Adam Megacz 2002-04-24 01:33:19 +00:00 committed by Adam Megacz
parent 9385d9cb0d
commit c2a6704f60
3 changed files with 33 additions and 0 deletions

View file

@ -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

View file

@ -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__ */

View file

@ -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;
}