aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Haley <aph@cygnus.com>2000-01-17 15:45:24 +0000
committerAndrew Haley <aph@gcc.gnu.org>2000-01-17 15:45:24 +0000
commit283a159fe38e477d93b189d43888f1e42043c0af (patch)
treee7424bbdd7c568c2f6f24481d328b24bade92628
parent1353681247458baa6a3df8375b786df8ace7664c (diff)
downloadgcc-283a159fe38e477d93b189d43888f1e42043c0af.zip
gcc-283a159fe38e477d93b189d43888f1e42043c0af.tar.gz
gcc-283a159fe38e477d93b189d43888f1e42043c0af.tar.bz2
natThrowable.cc: New file.
2000-01-14 Andrew Haley <aph@cygnus.com> * java/lang/natThrowable.cc: New file. * java/lang/Throwable.java (fillInStackTrace): Make native. (printStackTrace): Call native method to do this. (Throwable): Call fillInStackTrace. (stackTrace): New variable. * include/jvm.h: Add _Jv_ThisExecutable functions. * prims.cc: (_Jv_execName): New variable. (catch_segv): Call fillInStackTrace. (catch_fpe): Ditto. (_Jv_ThisExecutable): New functions. (JvRunMain): Set the name of this executable. * Makefile.am: Add java/lang/natThrowable.cc. Add name-finder.cc. * Makefile.in: Rebuilt. * acconfig.h: Add HAVE_PROC_SELF_EXE. * configure.in: Force link with __frame_state_for in FORCELIBGCCSPEC. Add new checks for backtrace. * include/config.h.in: Rebuilt. * name-finder.cc: New file. * include/name-finder.h: New file. From-SVN: r31460
-rw-r--r--libjava/ChangeLog30
-rw-r--r--libjava/Makefile.am3
-rw-r--r--libjava/Makefile.in9
-rw-r--r--libjava/acconfig.h3
-rwxr-xr-xlibjava/configure365
-rw-r--r--libjava/configure.in6
-rw-r--r--libjava/include/config.h.in22
-rw-r--r--libjava/include/jvm.h4
-rw-r--r--libjava/include/name-finder.h69
-rw-r--r--libjava/java/lang/Throwable.java71
-rw-r--r--libjava/java/lang/natThrowable.cc95
-rw-r--r--libjava/name-finder.cc180
-rw-r--r--libjava/prims.cc35
13 files changed, 731 insertions, 161 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog
index 8db6f2f..53f7788 100644
--- a/libjava/ChangeLog
+++ b/libjava/ChangeLog
@@ -1,3 +1,33 @@
+2000-01-14 Andrew Haley <aph@cygnus.com>
+
+ * java/lang/natThrowable.cc: New file.
+
+ * java/lang/Throwable.java (fillInStackTrace): Make native.
+ (printStackTrace): Call native method to do this.
+ (Throwable): Call fillInStackTrace.
+ (stackTrace): New variable.
+
+ * include/jvm.h: Add _Jv_ThisExecutable functions.
+
+ * prims.cc: (_Jv_execName): New variable.
+ (catch_segv): Call fillInStackTrace.
+ (catch_fpe): Ditto.
+ (_Jv_ThisExecutable): New functions.
+ (JvRunMain): Set the name of this executable.
+
+ * Makefile.am: Add java/lang/natThrowable.cc.
+ Add name-finder.cc.
+ * Makefile.in: Rebuilt.
+
+ * acconfig.h: Add HAVE_PROC_SELF_EXE.
+
+ * configure.in: Force link with __frame_state_for in
+ FORCELIBGCCSPEC. Add new checks for backtrace.
+ * include/config.h.in: Rebuilt.
+
+ * name-finder.cc: New file.
+ * include/name-finder.h: New file.
+
2000-01-16 Anthony Green <green@cygnus.com>
* java/lang/StringBuffer.java (StringBuffer): Don't special case
diff --git a/libjava/Makefile.am b/libjava/Makefile.am
index d15784d..bc828ce 100644
--- a/libjava/Makefile.am
+++ b/libjava/Makefile.am
@@ -112,7 +112,7 @@ javao_files = $(java_source_files:.java=.lo) \
libffi_files = `$(AR) t ../libffi/.libs/libffi.a 2>/dev/null | sed 's/\.o/\.lo/g' | sed 's/^/..\/libffi\//g'`
libgcj_la_SOURCES = prims.cc jni.cc exception.cc \
- resolve.cc defineclass.cc interpret.cc
+ resolve.cc defineclass.cc interpret.cc name-finder.cc
EXTRA_libgcj_la_SOURCES = boehm.cc nogc.cc posix-threads.cc no-threads.cc \
$(c_source_files) $(java_source_files) $(built_java_source_files)
libgcj_la_DEPENDENCIES = libgcj.zip $(javao_files) $(nat_files) \
@@ -804,6 +804,7 @@ java/lang/natRuntime.cc \
java/lang/natString.cc \
java/lang/natSystem.cc \
java/lang/natThread.cc \
+java/lang/natThrowable.cc \
java/lang/reflect/natArray.cc \
java/lang/reflect/natConstructor.cc \
java/lang/reflect/natField.cc \
diff --git a/libjava/Makefile.in b/libjava/Makefile.in
index feb516d..26ee2e3 100644
--- a/libjava/Makefile.in
+++ b/libjava/Makefile.in
@@ -184,7 +184,7 @@ javao_files = $(java_source_files:.java=.lo) \
libffi_files = `$(AR) t ../libffi/.libs/libffi.a 2>/dev/null | sed 's/\.o/\.lo/g' | sed 's/^/..\/libffi\//g'`
libgcj_la_SOURCES = prims.cc jni.cc exception.cc \
- resolve.cc defineclass.cc interpret.cc
+ resolve.cc defineclass.cc interpret.cc name-finder.cc
EXTRA_libgcj_la_SOURCES = boehm.cc nogc.cc posix-threads.cc no-threads.cc \
$(c_source_files) $(java_source_files) $(built_java_source_files)
@@ -618,6 +618,7 @@ java/lang/natRuntime.cc \
java/lang/natString.cc \
java/lang/natSystem.cc \
java/lang/natThread.cc \
+java/lang/natThrowable.cc \
java/lang/reflect/natArray.cc \
java/lang/reflect/natConstructor.cc \
java/lang/reflect/natField.cc \
@@ -699,7 +700,7 @@ libgcjdata_a_LIBADD =
LTLIBRARIES = $(toolexeclib_LTLIBRARIES)
libgcj_la_OBJECTS = prims.lo jni.lo exception.lo resolve.lo \
-defineclass.lo interpret.lo
+defineclass.lo interpret.lo name-finder.lo
@NATIVE_TRUE@bin_PROGRAMS = jv-convert$(EXEEXT) gij$(EXEEXT)
@NATIVE_TRUE@@MAINTAINER_MODE_TRUE@noinst_PROGRAMS = \
@NATIVE_TRUE@@MAINTAINER_MODE_TRUE@gen-from-JIS$(EXEEXT)
@@ -923,8 +924,8 @@ DEP_FILES = .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \
.deps/java/util/zip/ZipException.P .deps/java/util/zip/ZipFile.P \
.deps/java/util/zip/ZipInputStream.P \
.deps/java/util/zip/ZipOutputStream.P .deps/jni.P .deps/libgcjdata.P \
-.deps/no-threads.P .deps/nogc.P .deps/posix-threads.P .deps/prims.P \
-.deps/resolve.P
+.deps/name-finder.P .deps/no-threads.P .deps/nogc.P \
+.deps/posix-threads.P .deps/prims.P .deps/resolve.P
SOURCES = $(libgcjdata_a_SOURCES) $(libgcj_la_SOURCES) $(EXTRA_libgcj_la_SOURCES) $(jv_convert_SOURCES) $(EXTRA_jv_convert_SOURCES) $(gij_SOURCES) $(EXTRA_gij_SOURCES) $(gen_from_JIS_SOURCES) $(EXTRA_gen_from_JIS_SOURCES)
OBJECTS = $(libgcjdata_a_OBJECTS) $(libgcj_la_OBJECTS) $(jv_convert_OBJECTS) $(gij_OBJECTS) $(gen_from_JIS_OBJECTS)
diff --git a/libjava/acconfig.h b/libjava/acconfig.h
index ef2c513..75931b7 100644
--- a/libjava/acconfig.h
+++ b/libjava/acconfig.h
@@ -120,5 +120,8 @@
/* Define if using setjmp/longjmp exceptions. */
#undef SJLJ_EXCEPTIONS
+/* Define if you have /proc/self/exe */
+#undef HAVE_PROC_SELF_EXE
+
/* Define if getuid() and friends are missing. */
#undef NO_GETUID
diff --git a/libjava/configure b/libjava/configure
index 602829b..56183b8 100755
--- a/libjava/configure
+++ b/libjava/configure
@@ -2456,7 +2456,7 @@ fi
FORCELIBGCCSPEC=
if test "$ac_cv_prog_gnu_ld" = yes; then
- FORCELIBGCCSPEC="-u __rethrow -lgcc"
+ FORCELIBGCCSPEC="-u __rethrow -u __frame_state_for -lgcc"
fi
echo $ac_n "checking for data_start""... $ac_c" 1>&6
@@ -3224,16 +3224,147 @@ else
fi
done
+ for ac_func in backtrace fork execvp pipe
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:3231: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 3236 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:3259: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+ for ac_hdr in execinfo.h unistd.h dlfcn.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:3287: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 3292 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:3297: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=yes"
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+ for ac_file in /proc/self/exe
+do
+
+ac_safe=`echo "$ac_file" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_file""... $ac_c" 1>&6
+echo "configure:3328: checking for $ac_file" >&5
+if eval "test \"`echo '$''{'ac_cv_file_$ac_safe'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test "$cross_compiling" = yes; then
+ { echo "configure: error: Cannot check for file existence when cross compiling" 1>&2; exit 1; }
+else
+ if test -r $ac_file; then
+ eval "ac_cv_file_$ac_safe=yes"
+ else
+ eval "ac_cv_file_$ac_safe=no"
+ fi
+fi
+fi
+if eval "test \"`echo '$ac_cv_file_'$ac_safe`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_file=HAVE_`echo $ac_file | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_file 1
+EOF
+
+ cat >> confdefs.h <<\EOF
+#define HAVE_PROC_SELF_EXE 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+
+fi
+done
+
for ac_func in gethostbyname_r
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3232: checking for $ac_func" >&5
+echo "configure:3363: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3237 "configure"
+#line 3368 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -3256,7 +3387,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:3260: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3391: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -3283,7 +3414,7 @@ EOF
# We look for the one that returns `int'.
# Hopefully this check is robust enough.
cat > conftest.$ac_ext <<EOF
-#line 3287 "configure"
+#line 3418 "configure"
#include "confdefs.h"
#include <netdb.h>
EOF
@@ -3303,7 +3434,7 @@ rm -f conftest*
*" -D_REENTRANT "*) ;;
*)
echo $ac_n "checking whether gethostbyname_r declaration requires -D_REENTRANT""... $ac_c" 1>&6
-echo "configure:3307: checking whether gethostbyname_r declaration requires -D_REENTRANT" >&5
+echo "configure:3438: checking whether gethostbyname_r declaration requires -D_REENTRANT" >&5
if eval "test \"`echo '$''{'libjava_cv_gethostbyname_r_needs_reentrant'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -3316,14 +3447,14 @@ ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftes
cross_compiling=$ac_cv_prog_cxx_cross
cat > conftest.$ac_ext <<EOF
-#line 3320 "configure"
+#line 3451 "configure"
#include "confdefs.h"
#include <netdb.h>
int main() {
gethostbyname_r("", 0, 0);
; return 0; }
EOF
-if { (eval echo configure:3327: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3458: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
libjava_cv_gethostbyname_r_needs_reentrant=no
else
@@ -3333,14 +3464,14 @@ else
CPPFLAGS_SAVE="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS -D_REENTRANT"
cat > conftest.$ac_ext <<EOF
-#line 3337 "configure"
+#line 3468 "configure"
#include "confdefs.h"
#include <netdb.h>
int main() {
gethostbyname_r("", 0, 0);
; return 0; }
EOF
-if { (eval echo configure:3344: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3475: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
libjava_cv_gethostbyname_r_needs_reentrant=yes
else
@@ -3375,12 +3506,12 @@ EOF
esac
echo $ac_n "checking for struct hostent_data""... $ac_c" 1>&6
-echo "configure:3379: checking for struct hostent_data" >&5
+echo "configure:3510: checking for struct hostent_data" >&5
if eval "test \"`echo '$''{'libjava_cv_struct_hostent_data'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3384 "configure"
+#line 3515 "configure"
#include "confdefs.h"
#if GETHOSTBYNAME_R_NEEDS_REENTRANT && !defined(_REENTRANT)
@@ -3391,7 +3522,7 @@ int main() {
struct hostent_data data;
; return 0; }
EOF
-if { (eval echo configure:3395: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3526: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
libjava_cv_struct_hostent_data=yes
else
@@ -3420,12 +3551,12 @@ done
for ac_func in gethostbyaddr_r
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3424: checking for $ac_func" >&5
+echo "configure:3555: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3429 "configure"
+#line 3560 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -3448,7 +3579,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:3452: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3583: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -3475,7 +3606,7 @@ EOF
# We look for the one that returns `int'.
# Hopefully this check is robust enough.
cat > conftest.$ac_ext <<EOF
-#line 3479 "configure"
+#line 3610 "configure"
#include "confdefs.h"
#include <netdb.h>
EOF
@@ -3499,12 +3630,12 @@ done
for ac_func in gethostname
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3503: checking for $ac_func" >&5
+echo "configure:3634: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3508 "configure"
+#line 3639 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -3527,7 +3658,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:3531: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3662: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -3551,7 +3682,7 @@ EOF
EOF
cat > conftest.$ac_ext <<EOF
-#line 3555 "configure"
+#line 3686 "configure"
#include "confdefs.h"
#include <unistd.h>
EOF
@@ -3582,12 +3713,12 @@ done
for ac_func in pthread_mutexattr_settype pthread_mutexattr_setkind_np
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3586: checking for $ac_func" >&5
+echo "configure:3717: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3591 "configure"
+#line 3722 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -3610,7 +3741,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:3614: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3745: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -3640,12 +3771,12 @@ done
for ac_func in sched_yield
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3644: checking for $ac_func" >&5
+echo "configure:3775: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3649 "configure"
+#line 3780 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -3668,7 +3799,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:3672: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3803: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -3690,7 +3821,7 @@ EOF
else
echo "$ac_t""no" 1>&6
echo $ac_n "checking for sched_yield in -lrt""... $ac_c" 1>&6
-echo "configure:3694: checking for sched_yield in -lrt" >&5
+echo "configure:3825: checking for sched_yield in -lrt" >&5
ac_lib_var=`echo rt'_'sched_yield | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -3698,7 +3829,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lrt $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 3702 "configure"
+#line 3833 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -3709,7 +3840,7 @@ int main() {
sched_yield()
; return 0; }
EOF
-if { (eval echo configure:3713: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3844: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -3735,7 +3866,7 @@ else
echo "$ac_t""no" 1>&6
echo $ac_n "checking for sched_yield in -lposix4""... $ac_c" 1>&6
-echo "configure:3739: checking for sched_yield in -lposix4" >&5
+echo "configure:3870: checking for sched_yield in -lposix4" >&5
ac_lib_var=`echo posix4'_'sched_yield | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -3743,7 +3874,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lposix4 $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 3747 "configure"
+#line 3878 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -3754,7 +3885,7 @@ int main() {
sched_yield()
; return 0; }
EOF
-if { (eval echo configure:3758: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3889: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -3790,7 +3921,7 @@ done
# We can save a little space at runtime if the mutex has m_count
# or __m_count. This is a nice hack for Linux.
cat > conftest.$ac_ext <<EOF
-#line 3794 "configure"
+#line 3925 "configure"
#include "confdefs.h"
#include <pthread.h>
int main() {
@@ -3799,7 +3930,7 @@ int main() {
; return 0; }
EOF
-if { (eval echo configure:3803: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3934: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
cat >> confdefs.h <<\EOF
#define PTHREAD_MUTEX_HAVE_M_COUNT 1
@@ -3811,7 +3942,7 @@ else
rm -rf conftest*
cat > conftest.$ac_ext <<EOF
-#line 3815 "configure"
+#line 3946 "configure"
#include "confdefs.h"
#include <pthread.h>
int main() {
@@ -3820,7 +3951,7 @@ int main() {
; return 0; }
EOF
-if { (eval echo configure:3824: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3955: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
cat >> confdefs.h <<\EOF
#define PTHREAD_MUTEX_HAVE___M_COUNT 1
@@ -3840,12 +3971,12 @@ rm -f conftest*
for ac_func in gettimeofday time ftime
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3844: checking for $ac_func" >&5
+echo "configure:3975: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3849 "configure"
+#line 3980 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -3868,7 +3999,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:3872: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4003: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -3899,12 +4030,12 @@ done
for ac_func in memmove
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3903: checking for $ac_func" >&5
+echo "configure:4034: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3908 "configure"
+#line 4039 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -3927,7 +4058,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:3931: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4062: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -3957,12 +4088,12 @@ done
for ac_func in memcpy
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3961: checking for $ac_func" >&5
+echo "configure:4092: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3966 "configure"
+#line 4097 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -3985,7 +4116,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:3989: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4120: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -4033,7 +4164,7 @@ done
#--------------------------------------------------------------------
echo $ac_n "checking for socket libraries""... $ac_c" 1>&6
-echo "configure:4037: checking for socket libraries" >&5
+echo "configure:4168: checking for socket libraries" >&5
if eval "test \"`echo '$''{'gcj_cv_lib_sockets'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -4041,12 +4172,12 @@ else
gcj_checkBoth=0
unset ac_cv_func_connect
echo $ac_n "checking for connect""... $ac_c" 1>&6
-echo "configure:4045: checking for connect" >&5
+echo "configure:4176: checking for connect" >&5
if eval "test \"`echo '$''{'ac_cv_func_connect'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4050 "configure"
+#line 4181 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char connect(); below. */
@@ -4069,7 +4200,7 @@ connect();
; return 0; }
EOF
-if { (eval echo configure:4073: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4204: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_connect=yes"
else
@@ -4092,7 +4223,7 @@ fi
if test "$gcj_checkSocket" = 1; then
unset ac_cv_func_connect
echo $ac_n "checking for main in -lsocket""... $ac_c" 1>&6
-echo "configure:4096: checking for main in -lsocket" >&5
+echo "configure:4227: checking for main in -lsocket" >&5
ac_lib_var=`echo socket'_'main | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -4100,14 +4231,14 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lsocket $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 4104 "configure"
+#line 4235 "configure"
#include "confdefs.h"
int main() {
main()
; return 0; }
EOF
-if { (eval echo configure:4111: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4242: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -4134,12 +4265,12 @@ fi
LIBS="$LIBS -lsocket -lnsl"
unset ac_cv_func_accept
echo $ac_n "checking for accept""... $ac_c" 1>&6
-echo "configure:4138: checking for accept" >&5
+echo "configure:4269: checking for accept" >&5
if eval "test \"`echo '$''{'ac_cv_func_accept'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4143 "configure"
+#line 4274 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char accept(); below. */
@@ -4162,7 +4293,7 @@ accept();
; return 0; }
EOF
-if { (eval echo configure:4166: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4297: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_accept=yes"
else
@@ -4189,12 +4320,12 @@ fi
gcj_oldLibs=$LIBS
LIBS="$LIBS $gcj_cv_lib_sockets"
echo $ac_n "checking for gethostbyname""... $ac_c" 1>&6
-echo "configure:4193: checking for gethostbyname" >&5
+echo "configure:4324: checking for gethostbyname" >&5
if eval "test \"`echo '$''{'ac_cv_func_gethostbyname'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4198 "configure"
+#line 4329 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char gethostbyname(); below. */
@@ -4217,7 +4348,7 @@ gethostbyname();
; return 0; }
EOF
-if { (eval echo configure:4221: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4352: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_gethostbyname=yes"
else
@@ -4235,7 +4366,7 @@ if eval "test \"`echo '$ac_cv_func_'gethostbyname`\" = yes"; then
else
echo "$ac_t""no" 1>&6
echo $ac_n "checking for main in -lnsl""... $ac_c" 1>&6
-echo "configure:4239: checking for main in -lnsl" >&5
+echo "configure:4370: checking for main in -lnsl" >&5
ac_lib_var=`echo nsl'_'main | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -4243,14 +4374,14 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lnsl $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 4247 "configure"
+#line 4378 "configure"
#include "confdefs.h"
int main() {
main()
; return 0; }
EOF
-if { (eval echo configure:4254: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4385: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -4282,7 +4413,7 @@ echo "$ac_t""$gcj_cv_lib_sockets" 1>&6
if test "$with_system_zlib" = yes; then
echo $ac_n "checking for deflate in -lz""... $ac_c" 1>&6
-echo "configure:4286: checking for deflate in -lz" >&5
+echo "configure:4417: checking for deflate in -lz" >&5
ac_lib_var=`echo z'_'deflate | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -4290,7 +4421,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lz $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 4294 "configure"
+#line 4425 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -4301,7 +4432,7 @@ int main() {
deflate()
; return 0; }
EOF
-if { (eval echo configure:4305: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4436: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -4330,7 +4461,7 @@ fi
# requires -ldl.
if test "$GC" = boehm; then
echo $ac_n "checking for main in -ldl""... $ac_c" 1>&6
-echo "configure:4334: checking for main in -ldl" >&5
+echo "configure:4465: checking for main in -ldl" >&5
ac_lib_var=`echo dl'_'main | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -4338,14 +4469,14 @@ else
ac_save_LIBS="$LIBS"
LIBS="-ldl $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 4342 "configure"
+#line 4473 "configure"
#include "confdefs.h"
int main() {
main()
; return 0; }
EOF
-if { (eval echo configure:4349: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4480: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -4465,7 +4596,7 @@ EOF
# See if gcj supports -fuse-divide-subroutine. gcc 2.95 does not, and
# we want to continue to support that version.
echo $ac_n "checking whether gcj supports -fuse-divide-subroutine""... $ac_c" 1>&6
-echo "configure:4469: checking whether gcj supports -fuse-divide-subroutine" >&5
+echo "configure:4600: checking whether gcj supports -fuse-divide-subroutine" >&5
cat > conftest.java << 'END'
public class conftest { }
END
@@ -4485,17 +4616,17 @@ for ac_hdr in unistd.h bstring.h sys/time.h sys/types.h fcntl.h sys/ioctl.h sys/
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:4489: checking for $ac_hdr" >&5
+echo "configure:4620: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4494 "configure"
+#line 4625 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4499: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4630: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -4525,17 +4656,17 @@ for ac_hdr in dirent.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:4529: checking for $ac_hdr" >&5
+echo "configure:4660: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4534 "configure"
+#line 4665 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4539: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4670: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -4563,12 +4694,12 @@ done
echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:4567: checking for ANSI C header files" >&5
+echo "configure:4698: checking for ANSI C header files" >&5
if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4572 "configure"
+#line 4703 "configure"
#include "confdefs.h"
#include <stdlib.h>
#include <stdarg.h>
@@ -4576,7 +4707,7 @@ else
#include <float.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4580: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4711: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -4593,7 +4724,7 @@ rm -f conftest*
if test $ac_cv_header_stdc = yes; then
# SunOS 4.x string.h does not declare mem*, contrary to ANSI.
cat > conftest.$ac_ext <<EOF
-#line 4597 "configure"
+#line 4728 "configure"
#include "confdefs.h"
#include <string.h>
EOF
@@ -4611,7 +4742,7 @@ fi
if test $ac_cv_header_stdc = yes; then
# ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
cat > conftest.$ac_ext <<EOF
-#line 4615 "configure"
+#line 4746 "configure"
#include "confdefs.h"
#include <stdlib.h>
EOF
@@ -4632,7 +4763,7 @@ if test "$cross_compiling" = yes; then
:
else
cat > conftest.$ac_ext <<EOF
-#line 4636 "configure"
+#line 4767 "configure"
#include "confdefs.h"
#include <ctype.h>
#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
@@ -4643,7 +4774,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
exit (0); }
EOF
-if { (eval echo configure:4647: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4778: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
:
else
@@ -4667,12 +4798,12 @@ EOF
fi
echo $ac_n "checking for ssize_t""... $ac_c" 1>&6
-echo "configure:4671: checking for ssize_t" >&5
+echo "configure:4802: checking for ssize_t" >&5
if eval "test \"`echo '$''{'ac_cv_type_ssize_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4676 "configure"
+#line 4807 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
@@ -4701,9 +4832,9 @@ fi
echo $ac_n "checking for in_addr_t""... $ac_c" 1>&6
-echo "configure:4705: checking for in_addr_t" >&5
+echo "configure:4836: checking for in_addr_t" >&5
cat > conftest.$ac_ext <<EOF
-#line 4707 "configure"
+#line 4838 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
@@ -4717,7 +4848,7 @@ int main() {
in_addr_t foo;
; return 0; }
EOF
-if { (eval echo configure:4721: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4852: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
cat >> confdefs.h <<\EOF
#define HAVE_IN_ADDR_T 1
@@ -4733,16 +4864,16 @@ fi
rm -f conftest*
echo $ac_n "checking whether struct ip_mreq is in netinet/in.h""... $ac_c" 1>&6
-echo "configure:4737: checking whether struct ip_mreq is in netinet/in.h" >&5
+echo "configure:4868: checking whether struct ip_mreq is in netinet/in.h" >&5
cat > conftest.$ac_ext <<EOF
-#line 4739 "configure"
+#line 4870 "configure"
#include "confdefs.h"
#include <netinet/in.h>
int main() {
struct ip_mreq mreq;
; return 0; }
EOF
-if { (eval echo configure:4746: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4877: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
cat >> confdefs.h <<\EOF
#define HAVE_STRUCT_IP_MREQ 1
@@ -4758,16 +4889,16 @@ fi
rm -f conftest*
echo $ac_n "checking whether struct sockaddr_in6 is in netinet/in.h""... $ac_c" 1>&6
-echo "configure:4762: checking whether struct sockaddr_in6 is in netinet/in.h" >&5
+echo "configure:4893: checking whether struct sockaddr_in6 is in netinet/in.h" >&5
cat > conftest.$ac_ext <<EOF
-#line 4764 "configure"
+#line 4895 "configure"
#include "confdefs.h"
#include <netinet/in.h>
int main() {
struct sockaddr_in6 addr6;
; return 0; }
EOF
-if { (eval echo configure:4771: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4902: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
cat >> confdefs.h <<\EOF
#define HAVE_INET6 1
@@ -4783,16 +4914,16 @@ fi
rm -f conftest*
echo $ac_n "checking for socklen_t in sys/socket.h""... $ac_c" 1>&6
-echo "configure:4787: checking for socklen_t in sys/socket.h" >&5
+echo "configure:4918: checking for socklen_t in sys/socket.h" >&5
cat > conftest.$ac_ext <<EOF
-#line 4789 "configure"
+#line 4920 "configure"
#include "confdefs.h"
#include <sys/socket.h>
int main() {
socklen_t x = 5;
; return 0; }
EOF
-if { (eval echo configure:4796: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4927: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
cat >> confdefs.h <<\EOF
#define HAVE_SOCKLEN_T 1
@@ -4808,16 +4939,16 @@ fi
rm -f conftest*
echo $ac_n "checking for tm_gmtoff in struct tm""... $ac_c" 1>&6
-echo "configure:4812: checking for tm_gmtoff in struct tm" >&5
+echo "configure:4943: checking for tm_gmtoff in struct tm" >&5
cat > conftest.$ac_ext <<EOF
-#line 4814 "configure"
+#line 4945 "configure"
#include "confdefs.h"
#include <time.h>
int main() {
struct tm tim; tim.tm_gmtoff = 0;
; return 0; }
EOF
-if { (eval echo configure:4821: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4952: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
cat >> confdefs.h <<\EOF
#define STRUCT_TM_HAS_GMTOFF 1
@@ -4830,16 +4961,16 @@ else
rm -rf conftest*
echo "$ac_t""no" 1>&6
echo $ac_n "checking for global timezone variable""... $ac_c" 1>&6
-echo "configure:4834: checking for global timezone variable" >&5
+echo "configure:4965: checking for global timezone variable" >&5
cat > conftest.$ac_ext <<EOF
-#line 4836 "configure"
+#line 4967 "configure"
#include "confdefs.h"
#include <time.h>
int main() {
long z2 = timezone;
; return 0; }
EOF
-if { (eval echo configure:4843: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4974: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
cat >> confdefs.h <<\EOF
#define HAVE_TIMEZONE 1
@@ -4859,19 +4990,19 @@ rm -f conftest*
# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
# for constant arguments. Useless!
echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6
-echo "configure:4863: checking for working alloca.h" >&5
+echo "configure:4994: checking for working alloca.h" >&5
if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4868 "configure"
+#line 4999 "configure"
#include "confdefs.h"
#include <alloca.h>
int main() {
char *p = alloca(2 * sizeof(int));
; return 0; }
EOF
-if { (eval echo configure:4875: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5006: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ac_cv_header_alloca_h=yes
else
@@ -4892,12 +5023,12 @@ EOF
fi
echo $ac_n "checking for alloca""... $ac_c" 1>&6
-echo "configure:4896: checking for alloca" >&5
+echo "configure:5027: checking for alloca" >&5
if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4901 "configure"
+#line 5032 "configure"
#include "confdefs.h"
#ifdef __GNUC__
@@ -4925,7 +5056,7 @@ int main() {
char *p = (char *) alloca(1);
; return 0; }
EOF
-if { (eval echo configure:4929: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5060: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ac_cv_func_alloca_works=yes
else
@@ -4957,12 +5088,12 @@ EOF
echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6
-echo "configure:4961: checking whether alloca needs Cray hooks" >&5
+echo "configure:5092: checking whether alloca needs Cray hooks" >&5
if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4966 "configure"
+#line 5097 "configure"
#include "confdefs.h"
#if defined(CRAY) && ! defined(CRAY2)
webecray
@@ -4987,12 +5118,12 @@ echo "$ac_t""$ac_cv_os_cray" 1>&6
if test $ac_cv_os_cray = yes; then
for ac_func in _getb67 GETB67 getb67; do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:4991: checking for $ac_func" >&5
+echo "configure:5122: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4996 "configure"
+#line 5127 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -5015,7 +5146,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:5019: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5150: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -5042,7 +5173,7 @@ done
fi
echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6
-echo "configure:5046: checking stack direction for C alloca" >&5
+echo "configure:5177: checking stack direction for C alloca" >&5
if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -5050,7 +5181,7 @@ else
ac_cv_c_stack_direction=0
else
cat > conftest.$ac_ext <<EOF
-#line 5054 "configure"
+#line 5185 "configure"
#include "confdefs.h"
find_stack_direction ()
{
@@ -5069,7 +5200,7 @@ main ()
exit (find_stack_direction() < 0);
}
EOF
-if { (eval echo configure:5073: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:5204: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ac_cv_c_stack_direction=1
else
@@ -5096,7 +5227,7 @@ do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:5100: checking for $ac_word" >&5
+echo "configure:5231: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_PERL'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
diff --git a/libjava/configure.in b/libjava/configure.in
index 080146a..612b30f 100644
--- a/libjava/configure.in
+++ b/libjava/configure.in
@@ -86,7 +86,7 @@ fi
FORCELIBGCCSPEC=
dnl Work around libgcc design flaw.
if test "$ac_cv_prog_gnu_ld" = yes; then
- FORCELIBGCCSPEC="-u __rethrow -lgcc"
+ FORCELIBGCCSPEC="-u __rethrow -u __frame_state_for -lgcc"
fi
AC_MSG_CHECKING([for data_start])
@@ -360,6 +360,10 @@ else
AC_CHECK_FUNCS(access stat mkdir rename rmdir unlink realpath)
AC_CHECK_FUNCS(inet_aton inet_addr, break)
AC_CHECK_FUNCS(inet_pton uname inet_ntoa)
+ AC_CHECK_FUNCS(backtrace fork execvp pipe)
+ AC_CHECK_HEADERS(execinfo.h unistd.h dlfcn.h)
+ AC_CHECK_FILES(/proc/self/exe, [
+ AC_DEFINE(HAVE_PROC_SELF_EXE)])
AC_CHECK_FUNCS(gethostbyname_r, [
AC_DEFINE(HAVE_GETHOSTBYNAME_R)
diff --git a/libjava/include/config.h.in b/libjava/include/config.h.in
index 8dbdc5d..c636c93 100644
--- a/libjava/include/config.h.in
+++ b/libjava/include/config.h.in
@@ -135,12 +135,25 @@
/* Define if using setjmp/longjmp exceptions. */
#undef SJLJ_EXCEPTIONS
+/* Define if you have /proc/self/exe */
+#undef HAVE_PROC_SELF_EXE
+
+
/* Define if getuid() and friends are missing. */
#undef NO_GETUID
/* Define if you have the access function. */
#undef HAVE_ACCESS
+/* Define if you have the backtrace function. */
+#undef HAVE_BACKTRACE
+
+/* Define if you have the execvp function. */
+#undef HAVE_EXECVP
+
+/* Define if you have the fork function. */
+#undef HAVE_FORK
+
/* Define if you have the fstat function. */
#undef HAVE_FSTAT
@@ -201,6 +214,9 @@
/* Define if you have the open function. */
#undef HAVE_OPEN
+/* Define if you have the pipe function. */
+#undef HAVE_PIPE
+
/* Define if you have the pthread_mutexattr_setkind_np function. */
#undef HAVE_PTHREAD_MUTEXATTR_SETKIND_NP
@@ -252,6 +268,12 @@
/* Define if you have the <dirent.h> header file. */
#undef HAVE_DIRENT_H
+/* Define if you have the <dlfcn.h> header file. */
+#undef HAVE_DLFCN_H
+
+/* Define if you have the <execinfo.h> header file. */
+#undef HAVE_EXECINFO_H
+
/* Define if you have the <fcntl.h> header file. */
#undef HAVE_FCNTL_H
diff --git a/libjava/include/jvm.h b/libjava/include/jvm.h
index 3b59b8d..49fc47b 100644
--- a/libjava/include/jvm.h
+++ b/libjava/include/jvm.h
@@ -182,4 +182,8 @@ extern "C"
jlong _Jv_remJ (jlong, jlong);
}
+/* get/set the name of the running executable. */
+extern char *_Jv_ThisExecutable (void);
+extern void _Jv_ThisExecutable (const char *);
+
#endif /* __JAVA_JVM_H__ */
diff --git a/libjava/include/name-finder.h b/libjava/include/name-finder.h
new file mode 100644
index 0000000..9a1d7df
--- /dev/null
+++ b/libjava/include/name-finder.h
@@ -0,0 +1,69 @@
+// name-finder.h - Convert addresses to names
+
+/* Copyright (C) 2000 Red Hat Inc
+
+ This file is part of libgcj.
+
+This software is copyrighted work licensed under the terms of the
+Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
+details. */
+
+/**
+ * @author Andrew Haley <aph@cygnus.com>
+ * @date Jan 6 2000
+ */
+
+#include <gcj/cni.h>
+#include <jvm.h>
+
+#include <sys/types.h>
+
+#include <string.h>
+#include <stdio.h>
+
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+/* _Jv_name_finder is a class wrapper around a mechanism that can
+ convert addresses of methods to their names and the names of files
+ in which they appear. */
+
+class _Jv_name_finder
+{
+public:
+ _Jv_name_finder (char *executable);
+ ~_Jv_name_finder ()
+ {
+#if defined (HAVE_PIPE) && defined (HAVE_FORK)
+ close (f_pipe[1]);
+ fclose (b_pipe_fd);
+#endif
+ }
+
+/* Given a pointer to a function or method, try to convert it into a
+ name and the appropriate line and source file. The caller passes
+ the code pointer in p.
+
+ Returns false if the lookup fails. Even if this happens, the field
+ hex will have been correctly filled in with the pointer.
+
+ The other fields are method_name and file_name, which lookup will
+ attempt to fill appropriately. If the lookup has failed, these
+ fields contain garbage.*/
+ bool lookup (void *p);
+
+ char method_name[1024];
+ char file_name[1024];
+ char hex[sizeof (void *) * 2 + 5];
+
+private:
+ void toHex (void *p);
+#if defined (HAVE_PIPE) && defined (HAVE_FORK)
+ int pid;
+ int f_pipe[2], b_pipe[2];
+ FILE *b_pipe_fd;
+ int error;
+#endif
+};
+
diff --git a/libjava/java/lang/Throwable.java b/libjava/java/lang/Throwable.java
index 5ae39ae..faba2be 100644
--- a/libjava/java/lang/Throwable.java
+++ b/libjava/java/lang/Throwable.java
@@ -12,6 +12,7 @@ package java.lang;
import java.io.PrintStream;
import java.io.PrintWriter;
import java.io.Serializable;
+import java.io.OutputStreamWriter;
/**
* @author Tom Tromey <tromey@cygnus.com>
@@ -26,55 +27,51 @@ import java.io.Serializable;
public class Throwable implements Serializable
{
- public Throwable fillInStackTrace ()
- {
- return this;
- }
+ public native Throwable fillInStackTrace ();
public String getLocalizedMessage ()
- {
- return getMessage ();
- }
+ {
+ return getMessage ();
+ }
public String getMessage ()
- {
- return detailMessage;
- }
+ {
+ return detailMessage;
+ }
public void printStackTrace ()
- {
- printStackTrace (System.err);
- }
-
- public void printStackTrace (PrintStream s)
- {
- // No stack trace, but we can still print this object.
- s.println(toString ());
- }
-
- public void printStackTrace (PrintWriter wr)
- {
- // No stack trace, but we can still print this object.
- wr.println(toString ());
- }
-
+ {
+ printStackTrace (System.err);
+ }
+
+ public void printStackTrace (PrintStream ps)
+ {
+ printStackTrace (new PrintWriter(new OutputStreamWriter(ps)));
+ }
+
+ public native void printStackTrace (PrintWriter wr);
+
public Throwable ()
- {
- detailMessage = null;
- }
+ {
+ detailMessage = null;
+ fillInStackTrace ();
+ }
public Throwable (String message)
- {
- detailMessage = message;
- }
+ {
+ detailMessage = message;
+ fillInStackTrace ();
+ }
public String toString ()
- {
- return ((detailMessage == null)
- ? getClass().getName()
- : getClass().getName() + ": " + getMessage ());
- }
+ {
+ return ((detailMessage == null)
+ ? getClass().getName()
+ : getClass().getName() + ": " + getMessage ());
+ }
// Name of this field comes from serialization spec.
private String detailMessage;
+
+ private byte stackTrace[];
}
diff --git a/libjava/java/lang/natThrowable.cc b/libjava/java/lang/natThrowable.cc
new file mode 100644
index 0000000..2227e7d
--- /dev/null
+++ b/libjava/java/lang/natThrowable.cc
@@ -0,0 +1,95 @@
+// natThrowable.cc - Superclass for all exceptions.
+
+/* Copyright (C) 2000 Red Hat Inc
+
+ This file is part of libgcj.
+
+This software is copyrighted work licensed under the terms of the
+Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
+details. */
+
+/**
+ * @author Andrew Haley <aph@cygnus.com>
+ * @date Jan 6 2000
+ */
+
+#include <config.h>
+
+#include <string.h>
+
+#pragma implementation "Throwable.h"
+
+#include <gcj/cni.h>
+#include <jvm.h>
+#include <java/lang/Object.h>
+#include <java-threads.h>
+#include <java/lang/Throwable.h>
+#include <java/io/PrintStream.h>
+#include <java/io/PrintWriter.h>
+
+#include <sys/types.h>
+
+#include <stdlib.h>
+#include <stdio.h>
+
+#include <unistd.h>
+
+#ifdef HAVE_EXECINFO_H
+#include <execinfo.h>
+#endif
+
+#include <name-finder.h>
+
+/* 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. */
+
+java::lang::Throwable *
+java::lang::Throwable::fillInStackTrace (void)
+{
+#ifdef HAVE_BACKTRACE
+ 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.
+ int n = backtrace (p, 128) - 1;
+
+ // ??? 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]));
+
+ return this;
+#endif
+}
+
+void
+java::lang::Throwable::printStackTrace (java::io::PrintWriter *wr)
+{
+ wr->println (toString ());
+#ifdef HAVE_BACKTRACE
+ if (!stackTrace)
+ return;
+
+ void **p = (void **)elements (stackTrace);
+ int depth = stackTrace->length / sizeof p[0];
+
+ _Jv_name_finder finder (_Jv_ThisExecutable ());
+
+ for (int i = 0; i < depth; i++)
+ {
+ bool found = finder.lookup (p[i]);
+ wr->print (JvNewStringLatin1 (" at "));
+ wr->print (JvNewStringLatin1 (finder.hex));
+ if (found)
+ {
+ wr->print (JvNewStringLatin1 (": "));
+ wr->print (JvNewStringLatin1 (finder.method_name));
+ wr->print (JvNewStringLatin1 (" ("));
+ wr->print (JvNewStringLatin1 (finder.file_name));
+ wr->print (JvNewStringLatin1 (")"));
+ }
+ wr->println ();
+ }
+#endif /* HAVE_BACKTRACE */
+}
+
diff --git a/libjava/name-finder.cc b/libjava/name-finder.cc
new file mode 100644
index 0000000..ba8a5ae
--- /dev/null
+++ b/libjava/name-finder.cc
@@ -0,0 +1,180 @@
+// name-finder.cc - Convert addresses to names
+
+/* Copyright (C) 2000 Red Hat Inc
+
+ This file is part of libgcj.
+
+This software is copyrighted work licensed under the terms of the
+Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
+details. */
+
+/**
+ * @author Andrew Haley <aph@cygnus.com>
+ * @date Jan 6 2000
+ */
+
+/* _Jv_name_finder is a class wrapper around a mechanism that can
+ convert address of methods to their names and the names of files in
+ which they appear.
+
+ Right now, the only implementation of this involves running a copy
+ of addr2line, but at some point it is worth building this
+ functionality into libgcj, if only for embedded systems. */
+
+
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE 1
+#endif
+
+#include <config.h>
+
+#include <string.h>
+
+#include <gcj/cni.h>
+#include <jvm.h>
+#include <java/lang/Object.h>
+#include <java-threads.h>
+#include <java/lang/Throwable.h>
+#include <java/io/PrintStream.h>
+#include <java/io/PrintWriter.h>
+
+#include <sys/types.h>
+
+#include <stdlib.h>
+#include <stdio.h>
+
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+#ifdef HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <name-finder.h>
+
+/* Create a new name finder which will perform address lookups on an
+ executable. */
+
+_Jv_name_finder::_Jv_name_finder (char *executable)
+{
+#if defined (HAVE_PIPE) && defined (HAVE_FORK) && defined (HAVE_EXECVP)
+ error = 0;
+
+ char *argv[6];
+ {
+ int arg = 0;
+ argv[arg++] = "addr2line";
+ argv[arg++] = "-C";
+ argv[arg++] = "-f";
+ argv[arg++] = "-e";
+ argv[arg++] = executable;
+ argv[arg] = NULL;
+ }
+
+ error |= pipe (f_pipe) < 0;
+ error |= pipe (b_pipe) < 0;
+
+ if (error)
+ return;
+
+ pid = fork ();
+ if (pid == 0)
+ {
+ close (f_pipe[1]);
+ close (b_pipe[0]);
+ dup2 (f_pipe[0], fileno (stdin));
+ dup2 (b_pipe[1], fileno (stdout));
+ execvp (argv[0], argv);
+ _exit (127);
+ }
+
+ close (f_pipe [0]);
+ close (b_pipe [1]);
+
+ if (pid < 0)
+ {
+ error |= 1;
+ return;
+ }
+
+ b_pipe_fd = fdopen (b_pipe[0], "r");
+ error |= !b_pipe_fd;
+#endif
+}
+
+/* Convert a pointer to hex. */
+
+void
+_Jv_name_finder::toHex (void *p)
+{
+ unsigned long long n = (unsigned long long)p;
+ int digits = sizeof (void *) * 2;
+
+ strcpy (hex, "0x");
+ for (int i = digits - 1; i >= 0; i--)
+ {
+ int digit = n % 16;
+
+ n /= 16;
+ hex[i+2] = digit > 9 ? 'a' + digit - 10 : '0' + digit;
+ }
+ hex [digits+2] = 0;
+}
+
+/* Given a pointer to a function or method, try to convert it into a
+ name and the appropriate line and source file. The caller passes
+ the code pointer in p.
+
+ Returns false if the lookup fails. Even if this happens, the field
+ he will have been correctly filled in with the pointer. */
+
+bool
+_Jv_name_finder::lookup (void *p)
+{
+ toHex (p);
+
+#ifdef HAVE_DLFCN_H
+ {
+ Dl_info dl_info;
+
+ if (dladdr (p, &dl_info))
+ {
+ strncpy (file_name, dl_info.dli_fname, sizeof file_name);
+ strncpy (method_name, dl_info.dli_sname, sizeof method_name);
+ return true;
+ }
+ }
+#endif
+
+#if defined (HAVE_PIPE) && defined (HAVE_FORK) && defined (HAVE_EXECVP)
+ if (error)
+ return false;
+
+ error |= write (f_pipe[1], hex, strlen (hex)) < 0;
+ if (error)
+ return false;
+ error |= write (f_pipe[1], "\n", 1) < 0;
+ if (error)
+ return false;
+
+ error |= (fgets (method_name, sizeof method_name, b_pipe_fd) == NULL);
+ if (error)
+ return false;
+ error |= (fgets (file_name, sizeof file_name, b_pipe_fd) == NULL);
+ if (error)
+ return false;
+
+ char *newline = strchr (method_name, '\n');
+ if (newline)
+ *newline = 0;
+ newline = strchr (file_name, '\n');
+ if (newline)
+ *newline = 0;
+
+ return true;
+
+#else
+ return false;
+#endif /* defined (HAVE_PIPE) && defined (HAVE_FORK) && defined (HAVE_EXECVP) */
+}
diff --git a/libjava/prims.cc b/libjava/prims.cc
index 2a413ae..f427a5a 100644
--- a/libjava/prims.cc
+++ b/libjava/prims.cc
@@ -16,6 +16,10 @@ details. */
#include <string.h>
#include <signal.h>
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
#include <gcj/cni.h>
#include <jvm.h>
#include <java-signal.h>
@@ -68,6 +72,10 @@ const char **_Jv_Compiler_Properties;
// Property key/value pairs.
property_pair *_Jv_Environment_Properties;
#endif
+
+// The name of this executable.
+static char * _Jv_execName;
+
#ifdef HANDLE_SEGV
@@ -75,6 +83,7 @@ static java::lang::NullPointerException *nullp;
SIGNAL_HANDLER (catch_segv)
{
MAKE_THROW_FRAME;
+ nullp->fillInStackTrace ();
_Jv_Throw (nullp);
}
#endif
@@ -89,6 +98,7 @@ SIGNAL_HANDLER (catch_fpe)
#else
MAKE_THROW_FRAME;
#endif
+ arithexception->fillInStackTrace ();
_Jv_Throw (arithexception);
}
#endif
@@ -638,8 +648,24 @@ static java::lang::ThreadGroup *main_group;
// The primary thread.
static java::lang::Thread *main_thread;
+char *
+_Jv_ThisExecutable (void)
+{
+ return _Jv_execName;
+}
+
+void
+_Jv_ThisExecutable (const char *name)
+{
+ if (name)
+ {
+ _Jv_execName = new char[strlen (name) + 1];
+ strcpy (_Jv_execName, name);
+ }
+}
+
static void
-main_init (void)
+main_init ()
{
INIT_SEGV;
#ifdef HANDLE_FPE
@@ -812,6 +838,13 @@ JvRunMain (jclass klass, int argc, const char **argv)
PROCESS_GCJ_PROPERTIES;
main_init ();
+#ifdef HAVE_PROC_SELF_EXE
+ char exec_name[20];
+ sprintf (exec_name, "/proc/%d/exe", getpid ());
+ _Jv_ThisExecutable (exec_name);
+#else
+ _Jv_ThisExecutable (argv[0]);
+#endif
arg_vec = JvConvertArgv (argc - 1, argv + 1);
main_group = new java::lang::ThreadGroup (23);