This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
[RFA] Thread debugging support
- From: Keith Seitz <keiths at redhat dot com>
- To: Java Patch List <java-patches at gcc dot gnu dot org>
- Date: Fri, 16 Jun 2006 20:30:00 -0700
- Subject: [RFA] Thread debugging support
Hi,
This patch simply adds three functions which add the support needed for
JDWP thread suspension. Right now, they are all just stub methods, since
we are awaiting official word on the necessary GC patches needed to
properly implement them. [I only have an implementation for
posix-threads, though, since I don't have a way to test win32.]
I thought I would add these now so that I could submit some of the other
patches that I've been hoarding which rely on these.
Keith
ChangeLog
2006-06-16 Keith Seitz <keiths@redhat.com>
* include/posix-threads.h (_Jv_ThreadDebugSuspend): Declare.
(_Jv_ThreadDebugResume): Declare.
(_Jv_ThreadDebugSuspendCount): Declare.
* posix-threads.cc (_Jv_ThreadDebugSuspend): New function.
(_Jv_ThreadDebugSuspendCount): New function.
(_Jv_ThreadDebugResume): New function.
* include/win32-threads.h (_Jv_ThreadDebugSuspend): Declare.
(_Jv_ThreadDebugResume): Declare.
(_Jv_ThreadDebugSuspendCount): Declare.
* win32-threads.cc (_Jv_ThreadDebugSuspend): New function.
(_Jv_ThreadDebugSuspendCount): New function.
(_Jv_ThreadDebugResume): New function.
Index: include/posix-threads.h
===================================================================
--- include/posix-threads.h (revision 114727)
+++ include/posix-threads.h (working copy)
@@ -1,7 +1,7 @@
// -*- c++ -*-
// posix-threads.h - Defines for using POSIX threads.
-/* Copyright (C) 1998, 1999, 2001, 2003 Free Software Foundation
+/* Copyright (C) 1998, 1999, 2001, 2003, 2006 Free Software Foundation
This file is part of libgcj.
@@ -366,4 +366,18 @@
void _Jv_ThreadInterrupt (_Jv_Thread_t *data);
+// Increases a thread's suspend count. If the thread's previous
+// suspend count was zero, i.e., it is not suspended, this function
+// will suspend the thread. This function may be used to suspend
+// any thread from any other thread (or suspend itself).
+void _Jv_ThreadDebugSuspend (_Jv_Thread_t* data);
+
+// Decreases a thread's suspend count. If the thread's new thread
+// count is zero, the thread is resumed. This function may be used
+// by any thread to resume any other thread.
+void _Jv_ThreadDebugResume (_Jv_Thread_t* data);
+
+// Get the suspend count for a thread
+jint _Jv_ThreadDebugSuspendCount (_Jv_Thread_t* data);
+
#endif /* __JV_POSIX_THREADS__ */
Index: posix-threads.cc
===================================================================
--- posix-threads.cc (revision 114727)
+++ posix-threads.cc (working copy)
@@ -1,6 +1,6 @@
// posix-threads.cc - interface between libjava and POSIX threads.
-/* Copyright (C) 1998, 1999, 2000, 2001, 2004 Free Software Foundation
+/* Copyright (C) 1998, 1999, 2000, 2001, 2004, 2006 Free Software Foundation
This file is part of libgcj.
@@ -505,6 +505,22 @@
pthread_mutex_unlock (&daemon_mutex);
}
+void
+_Jv_ThreadDebugSuspend (_Jv_Thread_t* data)
+{
+}
+
+void
+_Jv_ThreadDebugResume (_Jv_Thread_t* data)
+{
+}
+
+jint
+_Jv_ThreadDebugSuspendCount (_Jv_Thread_t* data)
+{
+ return -1;
+}
+
#if defined(SLOW_PTHREAD_SELF)
#include "sysdep/locks.h"
Index: include/win32-threads.h
===================================================================
--- include/win32-threads.h (revision 114727)
+++ include/win32-threads.h (working copy)
@@ -1,7 +1,7 @@
// -*- c++ -*-
// win32-threads.h - Defines for using Win32 threads.
-/* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Free Software
+/* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2006 Free Software
Foundation
This file is part of libgcj.
@@ -184,6 +184,20 @@
// See java/lang/natWin32Process.cc (waitFor) for an example.
HANDLE _Jv_Win32GetInterruptEvent (void);
+// Increases a thread's suspend count. If the thread's previous
+// suspend count was zero, i.e., it is not suspended, this function
+// will suspend the thread. This function may be used to suspend
+// any thread from any other thread (or suspend itself).
+void _Jv_ThreadDebugSuspend (_Jv_Thread_t* data);
+
+// Decreases a thread's suspend count. If the thread's new thread
+// count is zero, the thread is resumed. This function may be used
+// by any thread to resume any other thread.
+void _Jv_ThreadDebugResume (_Jv_Thread_t* data);
+
+// Get the suspend count for a thread
+jint _Jv_ThreadDebugSuspendCount (_Jv_Thread_t* data);
+
// Remove defines from <windows.h> that conflict with various things in libgcj code
#undef TRUE
Index: win32-threads.cc
===================================================================
--- win32-threads.cc (revision 114727)
+++ win32-threads.cc (working copy)
@@ -1,6 +1,6 @@
// win32-threads.cc - interface between libjava and Win32 threads.
-/* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Free Software
+/* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2006 Free Software
Foundation, Inc.
This file is part of libgcj.
@@ -419,3 +419,20 @@
SetEvent (data->interrupt_event);
LeaveCriticalSection (&data->interrupt_mutex);
}
+
+void
+_Jv_ThreadDebugSuspend (_Jv_Thread_t* data)
+{
+}
+
+void
+_Jv_ThreadDebugResume (_Jv_Thread_t* data)
+{
+}
+
+jint
+_Jv_ThreadDebugSuspendCount (_Jv_Thread_t* data)
+{
+ return -1;
+}
+