diff options
| author | aph <aph@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-01-17 15:45:24 +0000 |
|---|---|---|
| committer | aph <aph@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-01-17 15:45:24 +0000 |
| commit | 15159a4eb6d1af9b463ef539b769ae451b83e362 (patch) | |
| tree | e7424bbdd7c568c2f6f24481d328b24bade92628 /libjava/include | |
| parent | c70f711149bb09e66d312cb18a1325e309e1a46c (diff) | |
| download | ppe42-gcc-15159a4eb6d1af9b463ef539b769ae451b83e362.tar.gz ppe42-gcc-15159a4eb6d1af9b463ef539b769ae451b83e362.zip | |
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/include')
| -rw-r--r-- | libjava/include/config.h.in | 22 | ||||
| -rw-r--r-- | libjava/include/jvm.h | 4 | ||||
| -rw-r--r-- | libjava/include/name-finder.h | 69 |
3 files changed, 95 insertions, 0 deletions
diff --git a/libjava/include/config.h.in b/libjava/include/config.h.in index 8dbdc5d4e67..c636c93f210 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 3b59b8dfe7c..49fc47b0b9e 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 00000000000..9a1d7dfdaac --- /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 +}; + |

