aboutsummaryrefslogtreecommitdiff
path: root/libjava/java/lang/natThrowable.cc
diff options
context:
space:
mode:
authorTom Tromey <tromey@gcc.gnu.org>2000-05-19 17:55:34 +0000
committerTom Tromey <tromey@gcc.gnu.org>2000-05-19 17:55:34 +0000
commit6c80c45e3010bfe992b41dd8800d2c4b65e0d5ef (patch)
tree88cf0d32aea197ea8e8198e1206b04c820308615 /libjava/java/lang/natThrowable.cc
parent021c89ed68c151c45021fccf1bb5338ee817314c (diff)
downloadgcc-6c80c45e3010bfe992b41dd8800d2c4b65e0d5ef.zip
gcc-6c80c45e3010bfe992b41dd8800d2c4b65e0d5ef.tar.gz
gcc-6c80c45e3010bfe992b41dd8800d2c4b65e0d5ef.tar.bz2
Jumbo patch:
* Imported beans and serialization * Updated IA-64 port * Miscellaneous bug fixes From-SVN: r34028
Diffstat (limited to 'libjava/java/lang/natThrowable.cc')
-rw-r--r--libjava/java/lang/natThrowable.cc21
1 files changed, 17 insertions, 4 deletions
diff --git a/libjava/java/lang/natThrowable.cc b/libjava/java/lang/natThrowable.cc
index bbe18c2..eeb4e41e 100644
--- a/libjava/java/lang/natThrowable.cc
+++ b/libjava/java/lang/natThrowable.cc
@@ -39,6 +39,10 @@ details. */
#include <name-finder.h>
+#ifdef __ia64__
+extern "C" int _Jv_ia64_backtrace (void **array, int size);
+#endif
+
/* FIXME: size of the stack trace is limited to 128 elements. It's
undoubtedly sensible to limit the stack trace, but 128 is rather
arbitrary. It may be better to configure this. */
@@ -46,16 +50,21 @@ details. */
java::lang::Throwable *
java::lang::Throwable::fillInStackTrace (void)
{
-#ifdef HAVE_BACKTRACE
+#if defined (HAVE_BACKTRACE) || defined (__ia64__)
void *p[128];
// We subtract 1 from the number of elements because we don't want
// to include the call to fillInStackTrace in the trace.
+#if defined (__ia64__)
+ int n = _Jv_ia64_backtrace (p, 128) - 1;
+#else
int n = backtrace (p, 128) - 1;
+#endif
// ??? Might this cause a problem if the byte array isn't aligned?
stackTrace = JvNewByteArray (n * sizeof p[0]);
memcpy (elements (stackTrace), p+1, (n * sizeof p[0]));
+
#endif
return this;
@@ -83,11 +92,15 @@ java::lang::Throwable::printRawStackTrace (java::io::PrintWriter *wr)
{
wr->print (JvNewStringLatin1 (": "));
wr->print (JvNewStringLatin1 (finder.method_name));
- wr->print (JvNewStringLatin1 (" ("));
- wr->print (JvNewStringLatin1 (finder.file_name));
- wr->print (JvNewStringLatin1 (")"));
+ if (finder.file_name[0])
+ {
+ wr->print (JvNewStringLatin1 (" ("));
+ wr->print (JvNewStringLatin1 (finder.file_name));
+ wr->print (JvNewStringLatin1 (")"));
+ }
}
wr->println ();
}
#endif /* HAVE_BACKTRACE */
+ wr->flush ();
}