natThrowable.cc (printRawStackTrace): removed.

* java/lang/natThrowable.cc (printRawStackTrace): removed.
	(getStackTrace0): new method.
	* java/lang/Throwable.java (CPlusPlusDemangler): removed.
	(printStackTrace(PrintWriter)): replace with pure java implementation.
	(printRawStackTrace): removed.
	(getStackTrace0): new method.
	* java/lang/StackTraceElement.java (toString): add extra whitespace.
	* gcj/javaprims.h: regenerate class list.
	* include/name-finder.h (lookup): new returns StackTraceElement*.
	(method_name, file_name): fields removed.
	(pid2, f2_pipe, b2_pipe, b2_pipe_fd): new fields.
	(~_Jv_name_finder): close new descriptors.
	* name-finder.cc(_Jv_name_finder): setup c++filt helper process.
	(createStackTraceElement): new method.
	(lookup): returns StackTraceElement*, uses createStackTraceElement().

From-SVN: r55424
This commit is contained in:
Mark Wielaard
2002-07-12 12:52:44 +00:00
committed by Mark Wielaard
parent 26af4041b7
commit dc7b1dda60
7 changed files with 337 additions and 159 deletions
+24 -12
View File
@@ -29,6 +29,8 @@ details. */
#include <unistd.h>
#endif
#include <java/lang/StackTraceElement.h>
/* _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. */
@@ -47,12 +49,26 @@ public:
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
}
@@ -60,25 +76,21 @@ public:
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.
Returns NULL 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);
java::lang::StackTraceElement* lookup (void *p);
char method_name[1024];
char file_name[1024];
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;
int f_pipe[2], b_pipe[2];
FILE *b_pipe_fd;
int error;
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)