Stack traces for x86_64
Andrew Haley
aph@redhat.com
Tue Jan 28 19:01:00 GMT 2003
Stack traces don't work on x86_64. With some programming languages
that's just a minor annoyance but with Java it means we can't
implement the API.
It turns out that the reason for the non-functionality is very simple:
programs are compiled with -fomit-frame-pointer by default, unlike our
other platforms. The fix is similarly simple, and seems to work well:
java.lang.Throwable
at bloop.foo() (/home/aph/gcc/build/bloop.java:5)
at baz.foo() (/home/aph/gcc/build/baz.java:11)
at foo.bar() (/home/aph/gcc/build/foo.java:13)
at foo.main(java.lang.String[]) (/home/aph/gcc/build/foo.java:19)
It might be that one day we'll use the DWARF unwinder machinery to get
stack traces, and then we won't need to do this.
In a related note: sibling calls also break stack traces, so we might
have to disable them too when we need compliance with the Java
security sandbox model.
Andrew.
2003-01-28 Andrew Haley <aph@redhat.com>
* libgcj.spec.in (jc1): Add BACKTRACESPEC.
* configure.host (x86_64): Default to -fno-omit-frame-pointer.
* configure.in (BACKTRACESPEC): New.
* configure: Regenerate.
Index: configure.host
===================================================================
RCS file: /cvs/gcc/gcc/libjava/configure.host,v
retrieving revision 1.44
diff -u -r1.44 configure.host
--- configure.host 22 Jan 2003 17:50:38 -0000 1.44
+++ configure.host 28 Jan 2003 18:38:43 -0000
@@ -98,12 +98,12 @@
x86_64-*)
CHECKREFSPEC="%{m32:-fcheck-references}"
sysdeps_dir=x86-64
- libgcj_flags="${libgcj_flags} -ffloat-store"
+ libgcj_flags="${libgcj_flags} -ffloat-store -fno-omit-frame-pointer"
libgcj_cxxflags="-D__NO_MATH_INLINES"
libgcj_cflags="-D__NO_MATH_INLINES"
enable_hash_synchronization_default=yes
slow_pthread_self=yes
;;
alpha*-*)
sysdeps_dir=alpha
Index: configure.in
===================================================================
RCS file: /cvs/gcc/gcc/libjava/configure.in,v
retrieving revision 1.144
diff -u -r1.144 configure.in
--- configure.in 14 Jan 2003 13:51:13 -0000 1.144
+++ configure.in 28 Jan 2003 18:38:44 -0000
@@ -937,6 +937,15 @@
SIGNAL_HANDLER=include/default-signal.h
fi
+# Define here any compiler flags that you need in order to make backtrace() work.
+BACKTRACESPEC=
+case "${host}" in
+ x86_64*-*-linux*)
+ BACKTRACESPEC=-fno-omit-frame-pointer
+ ;;
+esac
+AC_SUBST(BACKTRACESPEC)
+
AC_SUBST(SYSDEP_SOURCES)
AC_LINK_FILES($SIGNAL_HANDLER, include/java-signal.h)
Index: libgcj.spec.in
===================================================================
RCS file: /cvs/gcc/gcc/libjava/libgcj.spec.in,v
retrieving revision 1.23
diff -u -r1.23 libgcj.spec.in
--- libgcj.spec.in 31 Mar 2002 18:24:59 -0000 1.23
+++ libgcj.spec.in 28 Jan 2003 18:38:44 -0000
@@ -6,4 +6,4 @@
%rename lib liborig
*lib: -lgcj -lm @LIBICONV@ @GCSPEC@ @THREADSPEC@ @ZLIBSPEC@ @SYSTEMSPEC@ %(libgcc) %(liborig)
-*jc1: @HASH_SYNC_SPEC@ @DIVIDESPEC@ @CHECKREFSPEC@ @JC1GCSPEC@ @EXCEPTIONSPEC@ -fkeep-inline-functions
+*jc1: @HASH_SYNC_SPEC@ @DIVIDESPEC@ @CHECKREFSPEC@ @JC1GCSPEC@ @EXCEPTIONSPEC@ @BACKTRACESPEC@ -fkeep-inline-functions
More information about the Java
mailing list