Java: backtrace alignment fault

Andrew Haley aph@redhat.com
Wed Mar 14 07:53:00 GMT 2001


This is a critical patch for all 64-bit Java systems.
The backtrace code contained an illegal pointer cast which, with the
new ABI, caused failures on 64-bit machines.
I have checked this in to 3.0 and the trunk.
Andrew.
2001年03月01日 Andrew Haley <aph@redhat.com>
	* java/lang/natThrowable.cc (printRawStackTrace): Copy the
	stackTrace buffer to a correctly aligned pointer array.
 
Index: java/lang/natThrowable.cc
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/lang/natThrowable.cc,v
retrieving revision 1.8
diff -p -2 -c -r1.8 natThrowable.cc
*** java/lang/natThrowable.cc	2000年12月22日 06:19:24	1.8
--- java/lang/natThrowable.cc	2001年03月14日 15:40:27
*************** java::lang::Throwable::fillInStackTrace 
*** 66,70 ****
 if (n > 0)
 {
! // ??? 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]));
--- 66,70 ----
 if (n > 0)
 {
! // 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]));
*************** java::lang::Throwable::printRawStackTrac
*** 84,89 ****
 return;
 
! void **p = (void **)elements (stackTrace);
! int depth = stackTrace->length / sizeof p[0];
 
 _Jv_name_finder finder (_Jv_ThisExecutable ());
--- 84,90 ----
 return;
 
! int depth = stackTrace->length / sizeof (void *);
! void *p[depth];
! memcpy (p, elements (stackTrace), sizeof p);
 
 _Jv_name_finder finder (_Jv_ThisExecutable ());


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /