Commit a58dc194 by Andrew Haley Committed by Andrew Haley

natThrowable.cc (printRawStackTrace): Copy the stackTrace buffer to a correctly…

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
parent 1a06f5fe
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> 2001-03-12 Bryce McKinlay <bryce@albatross.co.nz>
* java/lang/Runtime.java (_exit): Declare new package-private native. * java/lang/Runtime.java (_exit): Declare new package-private native.
......
...@@ -65,7 +65,7 @@ java::lang::Throwable::fillInStackTrace (void) ...@@ -65,7 +65,7 @@ java::lang::Throwable::fillInStackTrace (void)
if (n > 0) 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]); stackTrace = JvNewByteArray (n * sizeof p[0]);
memcpy (elements (stackTrace), p+1, (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) ...@@ -83,8 +83,9 @@ java::lang::Throwable::printRawStackTrace (java::io::PrintWriter *wr)
if (!stackTrace) if (!stackTrace)
return; return;
void **p = (void **)elements (stackTrace); int depth = stackTrace->length / sizeof (void *);
int depth = stackTrace->length / sizeof p[0]; void *p[depth];
memcpy (p, elements (stackTrace), sizeof p);
_Jv_name_finder finder (_Jv_ThisExecutable ()); _Jv_name_finder finder (_Jv_ThisExecutable ());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment