public inbox for java-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [RFA] JVMTI Breakpoints
@ 2007-01-24 20:23 Keith Seitz
  2007-01-24 22:58 ` Tom Tromey
  0 siblings, 1 reply; 3+ messages in thread
From: Keith Seitz @ 2007-01-24 20:23 UTC (permalink / raw)
  To: Java Patch List

[-- Attachment #1: Type: text/plain, Size: 381 bytes --]

Hi,

The following patch implements the breakpoint instruction in the 
interpreter, including the JVMTI notification of the event.

Keith

ChangeLog
2007-01-24  Keith Seitz  <keiths@redhat.com>

         * interpret.cc: Include gnu/gcj/jvmti/Breakpoint.h,
         gnu/gcj/jvmti/BreakpointManager.h, jvmti.h, and jvmti-int.h
         * interpret-run.cc: Implement insn_breakpoint.

[-- Attachment #2: jvmti-bp.patch --]
[-- Type: text/x-patch, Size: 2034 bytes --]

Index: interpret.cc
===================================================================
--- interpret.cc	(revision 121081)
+++ interpret.cc	(working copy)
@@ -1,6 +1,6 @@
 // interpret.cc - Code for the interpreter
 
-/* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation
+/* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation
 
    This file is part of libgcj.
 
@@ -37,7 +37,12 @@
 #include <execution.h>
 #include <java/lang/reflect/Modifier.h>
 
+#include <jvmti.h>
+#include "jvmti-int.h"
+
 #include <gnu/classpath/jdwp/Jdwp.h>
+#include <gnu/gcj/jvmti/Breakpoint.h>
+#include <gnu/gcj/jvmti/BreakpointManager.h>
 
 #ifdef INTERPRETER
 
Index: interpret-run.cc
===================================================================
--- interpret-run.cc	(revision 121081)
+++ interpret-run.cc	(working copy)
@@ -1,6 +1,6 @@
 // interpret-run.cc - Code to interpret bytecode
 
-/* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation
+/* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation
 
    This file is part of libgcj.
 
@@ -2466,7 +2466,32 @@
 
     insn_breakpoint:
       {
-	// nothing just yet
+	JvAssert (JVMTI_REQUESTED_EVENT (Breakpoint));
+
+	// Send JVMTI notification
+	using namespace ::java::lang;
+	jmethodID method = meth->self;
+	jlocation location = meth->insn_index (pc - 1);
+	Thread *thread = Thread::currentThread ();
+	JNIEnv *jni_env = _Jv_GetCurrentJNIEnv ();
+
+	_Jv_JVMTI_PostEvent (JVMTI_EVENT_BREAKPOINT, thread, jni_env,
+			     method, location);
+
+	// Continue execution
+	using namespace gnu::gcj::jvmti;
+	Breakpoint *bp
+	  = BreakpointManager::getBreakpoint (reinterpret_cast<jlong> (method),
+					      location);
+	JvAssert (bp != NULL);
+
+	pc_t opc = reinterpret_cast<pc_t> (bp->getInsn ());
+
+#ifdef DIRECT_THREADED
+	goto *(opc->insn);
+#else
+	goto *(insn_target[*opc]);
+#endif
       }
     }
   catch (java::lang::Throwable *ex)

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [RFA] JVMTI Breakpoints
  2007-01-24 20:23 [RFA] JVMTI Breakpoints Keith Seitz
@ 2007-01-24 22:58 ` Tom Tromey
  2007-01-25  0:41   ` Keith Seitz
  0 siblings, 1 reply; 3+ messages in thread
From: Tom Tromey @ 2007-01-24 22:58 UTC (permalink / raw)
  To: Keith Seitz; +Cc: Java Patch List

>>>>> "Keith" == Keith Seitz <keiths@redhat.com> writes:

Keith> The following patch implements the breakpoint instruction in the
Keith> interpreter, including the JVMTI notification of the event.

Looks good!  Please check in.

Tom

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [RFA] JVMTI Breakpoints
  2007-01-24 22:58 ` Tom Tromey
@ 2007-01-25  0:41   ` Keith Seitz
  0 siblings, 0 replies; 3+ messages in thread
From: Keith Seitz @ 2007-01-25  0:41 UTC (permalink / raw)
  To: Java Patch List

Tom Tromey wrote:

> Looks good!  Please check in.

Done. Thanks.

Keith

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-01-25  0:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-01-24 20:23 [RFA] JVMTI Breakpoints Keith Seitz
2007-01-24 22:58 ` Tom Tromey
2007-01-25  0:41   ` Keith Seitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).