diff options
author | Andrew Haley <aph@redhat.com> | 2001-03-14 15:49:06 +0000 |
---|---|---|
committer | Andrew Haley <aph@gcc.gnu.org> | 2001-03-14 15:49:06 +0000 |
commit | a58dc194c8b0e7a0af35389e21d9d02b27301539 (patch) | |
tree | 3f5120b02b4760f44f6fcc3e8ff18093960a2945 | |
parent | 1a06f5fe3fe23768a0336c4a2dc97f42207a3b10 (diff) | |
download | gcc-a58dc194c8b0e7a0af35389e21d9d02b27301539.zip gcc-a58dc194c8b0e7a0af35389e21d9d02b27301539.tar.gz gcc-a58dc194c8b0e7a0af35389e21d9d02b27301539.tar.bz2 |
natThrowable.cc (printRawStackTrace): Copy the stackTrace buffer to a correctly aligned pointer array.
2001-03-01 Andrew Haley <aph@redhat.com>
* java/lang/natThrowable.cc (printRawStackTrace): Copy the
stackTrace buffer to a correctly aligned pointer array.
From-SVN: r40456
-rw-r--r-- | libjava/ChangeLog | 5 | ||||
-rw-r--r-- | libjava/java/lang/natThrowable.cc | 7 |
2 files changed, 9 insertions, 3 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog index 44a3bd8..218639e 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,8 @@ +2001-03-01 Andrew Haley <aph@redhat.com> + + * java/lang/natThrowable.cc (printRawStackTrace): Copy the + stackTrace buffer to a correctly aligned pointer array. + 2001-03-12 Bryce McKinlay <bryce@albatross.co.nz> * java/lang/Runtime.java (_exit): Declare new package-private native. diff --git a/libjava/java/lang/natThrowable.cc b/libjava/java/lang/natThrowable.cc index dab3ba6..6080ea3 100644 --- a/libjava/java/lang/natThrowable.cc +++ b/libjava/java/lang/natThrowable.cc @@ -65,7 +65,7 @@ java::lang::Throwable::fillInStackTrace (void) if (n > 0) { - // ??? Might this cause a problem if the byte array isn't aligned? + // We copy the array below to deal with alignment issues. stackTrace = JvNewByteArray (n * sizeof p[0]); memcpy (elements (stackTrace), p+1, (n * sizeof p[0])); } @@ -83,8 +83,9 @@ java::lang::Throwable::printRawStackTrace (java::io::PrintWriter *wr) if (!stackTrace) return; - void **p = (void **)elements (stackTrace); - int depth = stackTrace->length / sizeof p[0]; + int depth = stackTrace->length / sizeof (void *); + void *p[depth]; + memcpy (p, elements (stackTrace), sizeof p); _Jv_name_finder finder (_Jv_ThisExecutable ()); |