summaryrefslogtreecommitdiff
path: root/libjava/prims.cc
diff options
context:
space:
mode:
authoraph <aph@138bc75d-0d04-0410-961f-82ee72b054a4>2000-01-17 15:45:24 +0000
committeraph <aph@138bc75d-0d04-0410-961f-82ee72b054a4>2000-01-17 15:45:24 +0000
commit15159a4eb6d1af9b463ef539b769ae451b83e362 (patch)
treee7424bbdd7c568c2f6f24481d328b24bade92628 /libjava/prims.cc
parentc70f711149bb09e66d312cb18a1325e309e1a46c (diff)
downloadgcc-15159a4eb6d1af9b463ef539b769ae451b83e362.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@31460 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/prims.cc')
-rw-r--r--libjava/prims.cc35
1 files changed, 34 insertions, 1 deletions
diff --git a/libjava/prims.cc b/libjava/prims.cc
index 2a413ae3403..f427a5adf36 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);