This is the mail archive of the java-patches@sourceware.cygnus.com mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Patch: Thread.dumpStack()


Now that we have Throwable.printStackTrace() we can implement Thread.dumpStack()
too.

        * java/lang/natThread.cc (dumpStack): Removed.
        * java/lang/Thread.java (dumpStack): Implemented.

  [ bryce ]

Index: libjava/java/lang/Thread.java
===================================================================
RCS file: /cvs/java/libgcj/libjava/java/lang/Thread.java,v
retrieving revision 1.5
diff -u -r1.5 Thread.java
--- Thread.java	2000/02/10 20:31:48	1.5
+++ Thread.java	2000/02/15 06:36:07
@@ -49,7 +49,11 @@
   public native int countStackFrames ();
   public static native Thread currentThread ();
   public native void destroy ();
-  public static native void dumpStack ();
+  
+  public static void dumpStack ()
+  {
+    (new Exception ("Stack trace")).printStackTrace ();
+  }
 
   public static int enumerate (Thread[] threads)
   {
Index: libjava/java/lang/natThread.cc
===================================================================
RCS file: /cvs/java/libgcj/libjava/java/lang/natThread.cc,v
retrieving revision 1.12
diff -u -r1.12 natThread.cc
--- natThread.cc	2000/02/10 20:31:48	1.12
+++ natThread.cc	2000/02/15 06:36:08
@@ -123,15 +123,6 @@
 }
 
 void
-java::lang::Thread::dumpStack (void)
-{
-  // We don't implement this because it is very hard.  Once we have a
-  // VM, this could potentially ask the VM to do the dump in cases
-  // where it makes sense.
-  JvFail ("java::lang::Thread::dumpStack unimplemented");
-}
-
-void
 java::lang::Thread::interrupt (void)
 {
   interrupt_flag = true;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]