From 6e0532cdf6f9fb4776bfa0f05a29c06a362d466b Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Sat, 24 Aug 2002 22:46:19 +0000 Subject: Makefile.am (libgcj_la_SOURCES): Remove name-finder.cc. * Makefile.am (libgcj_la_SOURCES): Remove name-finder.cc. (core_java_source_files): Add VMThrowable.java and NameFinder.java (nat_source_files): Remove natThrowable.cc, add natVMThrowable.cc and natNameFinder.cc. * Makefile.in: Regenerate. * prims.cc: Use trace_enabled from VMThrowable. * name-finder.cc: Removed. * gcj/javaprims.h: Add class VMThrowable. * gnu/gcj/runtime/NameFinder.java: New file. * gnu/gcj/runtime/natNameFinder.cc: Likewise. * include/name-finder.h: Removed. * java/lang/Throwable.java (printStackTrace (PrintStream)): Use new method stackTraceString(). (printStackTrace (PrintWriter)): Likewise. (stackTraceString): Complete rewrite of old printStackTrace using StringBuffer. (stackTraceStringBuffer): New helper method for stackTraceString(). (fillInStackTrace): Delegate to VMTrowable. (getStackTrace): Likewise. (getStackTrace0): Removed. (trace_enabled, stackTraceBytes): Moved to new VMThrowable.java. (setStackTrace): Copy given array. * java/lang/natThrowable.cc: Removed (replaced by natVMThrowable). * java/lang/VMThrowable.java: New class. * java/lang/natVMThrowable.cc: New file. From-SVN: r56556 --- libjava/include/name-finder.h | 103 ------------------------------------------ 1 file changed, 103 deletions(-) delete mode 100644 libjava/include/name-finder.h (limited to 'libjava/include') diff --git a/libjava/include/name-finder.h b/libjava/include/name-finder.h deleted file mode 100644 index 67ae058..0000000 --- a/libjava/include/name-finder.h +++ /dev/null @@ -1,103 +0,0 @@ -// name-finder.h - Convert addresses to names - -/* Copyright (C) 2000, 2002 Free Software Foundation, 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 - * @date Jan 6 2000 - */ - -#include -#include - -#include - -#ifdef HAVE_SYS_WAIT_H -#include -#endif - -#include -#include - -#ifdef HAVE_UNISTD_H -#include -#endif - -#include - -/* _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) - myclose (f_pipe[0]); - myclose (f_pipe[1]); - myclose (b_pipe[0]); - myclose (b_pipe[1]); - if (b_pipe_fd != NULL) - fclose (b_pipe_fd); - - myclose (f2_pipe[0]); - myclose (f2_pipe[1]); - myclose (b2_pipe[0]); - myclose (b2_pipe[1]); - if (b2_pipe_fd != NULL) - fclose (b2_pipe_fd); - - if (pid >= 0) - { - int wstat; - // We don't care about errors here. - waitpid (pid, &wstat, 0); - } - - if (pid2 >= 0) - { - int wstat; - // We don't care about errors here. - waitpid (pid2, &wstat, 0); - } -#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 NULL if the lookup fails. Even if this happens, the field - hex will have been correctly filled in with the pointer. */ - - java::lang::StackTraceElement* lookup (void *p); - - char hex[sizeof (void *) * 2 + 5]; - -private: - void toHex (void *p); - java::lang::StackTraceElement* createStackTraceElement(char *s, char *f); -#if defined (HAVE_PIPE) && defined (HAVE_FORK) - pid_t pid, pid2; - int f_pipe[2], b_pipe[2], f2_pipe[2], b2_pipe[2]; - FILE *b_pipe_fd, *b2_pipe_fd; - int demangling_error, lookup_error; - - // Close a descriptor only if it has not been closed. - void myclose (int fd) - { - if (fd != -1) - close (fd); - } - -#endif -}; -- cgit v1.1