harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ge...@apache.org
Subject svn commit: r470932 - in /incubator/harmony/enhanced/drlvm/trunk/vm/vmcore: include/jvmti_internal.h src/exception/exceptions_jit.cpp src/jit/compile.cpp src/jit/ini.cpp src/jvmti/jvmti_event.cpp src/jvmti/jvmti_step.cpp
Date Fri, 03 Nov 2006 18:17:35 GMT
Author: geirm
Date: Fri Nov  3 10:17:35 2006
New Revision: 470932

URL: http://svn.apache.org/viewvc?view=rev&rev=470932
Log:
HARMONY-1772

[drlvm][jvmti] SingleStep event isn't reported after compilation of a method

Ubuntu 6 - smoke, c-unit, ~kernel


Modified:
    incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/jvmti_internal.h
    incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/exception/exceptions_jit.cpp
    incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jit/compile.cpp
    incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jit/ini.cpp
    incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_event.cpp
    incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_step.cpp

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/jvmti_internal.h
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/jvmti_internal.h?view=diff&rev=470932&r1=470931&r2=470932
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/jvmti_internal.h (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/jvmti_internal.h Fri Nov  3 10:17:35
2006
@@ -312,7 +312,7 @@
 
         bool is_single_step_enabled(void)
         {
-            return single_step_enabled;
+            return single_step_enabled && (phase == JVMTI_PHASE_LIVE);
         }
 
         // Single step functions
@@ -353,6 +353,8 @@
 void jvmti_set_single_step_breakpoints(DebugUtilsTI *ti,
     VM_thread *vm_thread, jvmti_StepLocation *locations,
     unsigned locations_number);
+void jvmti_set_single_step_breakpoints_for_method(DebugUtilsTI *ti,
+    VM_thread *vm_thread, Method* method);
 void jvmti_remove_single_step_breakpoints(DebugUtilsTI *ti, VM_thread *vm_thread);
 
 // Object check functions

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/exception/exceptions_jit.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/exception/exceptions_jit.cpp?view=diff&rev=470932&r1=470931&r2=470932
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/exception/exceptions_jit.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/exception/exceptions_jit.cpp Fri
Nov  3 10:17:35 2006
@@ -222,11 +222,12 @@
     if (ti->isEnabled() && ti->is_single_step_enabled())
     {
         VM_thread *vm_thread = p_TLS_vmthread;
-        LMAutoUnlock lock(ti->vm_brpt->get_lock());
+        ti->vm_brpt->lock();
         if (NULL != vm_thread->ss_state)
         {
             jvmti_remove_single_step_breakpoints(ti, vm_thread);
         }
+        ti->vm_brpt->unlock();
     }
 
     bool same_frame = true;
@@ -265,11 +266,10 @@
                 si_set_ip(si, handler->get_handler_ip(), false);
 
                 // Start single step in exception handler
-                if (ti->isEnabled() && ti->is_single_step_enabled() &&
-                    ti->getPhase() == JVMTI_PHASE_LIVE)
+                if (ti->isEnabled() && ti->is_single_step_enabled())
                 {
                     VM_thread *vm_thread = p_TLS_vmthread;
-                    LMAutoUnlock lock(ti->vm_brpt->get_lock());
+                    ti->vm_brpt->lock();
                     if (NULL != vm_thread->ss_state)
                     {
                         uint16 bc;
@@ -283,6 +283,7 @@
                         jvmti_set_single_step_breakpoints(ti, vm_thread,
                                 &method_start, 1);
                     }
+                    ti->vm_brpt->unlock();
                 }
 
                 // Create exception if necessary

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jit/compile.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jit/compile.cpp?view=diff&rev=470932&r1=470931&r2=470932
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jit/compile.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jit/compile.cpp Fri Nov  3 10:17:35
2006
@@ -37,6 +37,7 @@
 #include "lil_code_generator.h"
 #include "stack_iterator.h"
 #include "interpreter.h"
+#include "jvmti_internal.h"
 #include "jvmti_break_intf.h"
 
 #include "vm_stats.h"
@@ -839,6 +840,13 @@
 
         if (method->get_pending_breakpoints() != 0)
             jvmti_set_pending_breakpoints(method);
+        DebugUtilsTI *ti = VM_Global_State::loader_env->TI;
+        if(ti->isEnabled() && ti->is_single_step_enabled()
+            && !method->is_native())
+        {
+            jvmti_set_single_step_breakpoints_for_method(ti, p_TLS_vmthread, method);
+        }
+
         return entry_point;
     }
 

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jit/ini.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jit/ini.cpp?view=diff&rev=470932&r1=470931&r2=470932
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jit/ini.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jit/ini.cpp Fri Nov  3 10:17:35 2006
@@ -41,20 +41,11 @@
     assert(NULL != VM_Global_State::loader_env->em_interface);
     assert(NULL != VM_Global_State::loader_env->em_interface->ExecuteMethod);
 
+    // Start single stepping a new Java method
     DebugUtilsTI *ti = VM_Global_State::loader_env->TI;
-    if (ti->isEnabled() && ti->is_single_step_enabled() &&
-        ti->getPhase() == JVMTI_PHASE_LIVE)
-    {
-        VM_thread *vm_thread = p_TLS_vmthread;
-        LMAutoUnlock lock(ti->vm_brpt->get_lock());
-        if (NULL != vm_thread->ss_state)
-        {
-            // Start single stepping a new Java method
-            jvmti_remove_single_step_breakpoints(ti, vm_thread);
-
-            jvmti_StepLocation method_start = {(Method *)method, 0};
-            jvmti_set_single_step_breakpoints(ti, vm_thread, &method_start, 1);
-        }
+    if(ti->isEnabled() && ti->is_single_step_enabled()) {
+        // Start single stepping a new Java method
+        jvmti_set_single_step_breakpoints_for_method(ti, p_TLS_vmthread, (Method*)method);
     }
 
     VM_Global_State::loader_env->em_interface->ExecuteMethod(method, result, args);
@@ -62,16 +53,17 @@
 
     // Return from native code. It is necessary to set up a breakpoint
     // in the method which called us
-    if (ti->isEnabled() && ti->is_single_step_enabled() &&
-        ti->getPhase() == JVMTI_PHASE_LIVE)
+    if (ti->isEnabled() && ti->is_single_step_enabled())
     {
         VM_thread *vm_thread = p_TLS_vmthread;
         LMAutoUnlock lock(ti->vm_brpt->get_lock());
         if (NULL != vm_thread->ss_state)
         {
+            // Start single stepping a new Java method
+            jvmti_remove_single_step_breakpoints(ti, vm_thread);
+
             jvmti_StepLocation *method_return;
             unsigned locations_number;
-
             jvmtiError errorCode = jvmti_get_next_bytecodes_from_native(
                 vm_thread, &method_return, &locations_number, false);
             assert (JVMTI_ERROR_NONE == errorCode);

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_event.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_event.cpp?view=diff&rev=470932&r1=470931&r2=470932
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_event.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_event.cpp Fri Nov  3
10:17:35 2006
@@ -1817,7 +1817,7 @@
     {
         process_jvmti_event(JVMTI_EVENT_THREAD_START, 0, 0);
 
-        if (ti->is_single_step_enabled() && ti->getPhase() == JVMTI_PHASE_LIVE)
+        if (ti->is_single_step_enabled())
         {
             // Init single step state for the thread
             VM_thread *vm_thread = p_TLS_vmthread;

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_step.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_step.cpp?view=diff&rev=470932&r1=470931&r2=470932
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_step.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_step.cpp Fri Nov  3 10:17:35
2006
@@ -451,6 +451,24 @@
     jvmti_set_single_step_breakpoints(ti, vm_thread, locations, locations_count);
 }
 
+void
+jvmti_set_single_step_breakpoints_for_method(DebugUtilsTI *ti,
+                                             VM_thread *vm_thread,
+                                             Method *method)
+{
+    if (ti->isEnabled() && ti->is_single_step_enabled())
+    {
+        LMAutoUnlock lock(ti->vm_brpt->get_lock());
+        if (NULL != vm_thread->ss_state)
+        {
+            jvmti_remove_single_step_breakpoints(ti, vm_thread);
+
+            jvmti_StepLocation method_start = {method, NULL, 0, false};
+            jvmti_set_single_step_breakpoints(ti, vm_thread, &method_start, 1);
+        }
+    }
+}
+
 static void jvmti_start_single_step_in_virtual_method(DebugUtilsTI *ti, VMBreakPoint* bp,
                                                       void *data)
 {
@@ -514,17 +532,10 @@
 
     TRACE2("jvmti.break.ss", "Removing VIRTUAL single step breakpoint: " << bp->addr);
 
-    // lock breakpoints
-    VMBreakPoints* vm_brpt = VM_Global_State::loader_env->TI->vm_brpt;
-    LMAutoUnlock lock(vm_brpt->get_lock());
-
     // The determined method is the one which is called by
     // invokevirtual or invokeinterface bytecodes. It should be
     // started to be single stepped from the beginning
-    jvmti_remove_single_step_breakpoints(ti, vm_thread);
-
-    jvmti_StepLocation method_start = {(Method *)method, 0};
-    jvmti_set_single_step_breakpoints(ti, vm_thread, &method_start, 1);
+    jvmti_set_single_step_breakpoints_for_method(ti, vm_thread, method);
 }
 
 // Callback function for JVMTI single step processing
@@ -808,28 +819,24 @@
                 NativeCodePtr call_ip = NULL;
                 do
                 {
+                    // Bytecode may be either invokevirtual or
+                    // invokeinterface which generate indirect calls or
+                    // invokestatic or invokespecial which generate
+                    // relative calls
+                    if (disasm.get_type() == InstructionDisassembler::INDIRECT_CALL ||
+                        disasm.get_type() == InstructionDisassembler::RELATIVE_CALL)
+                        call_ip = ip2;
+
                     ip2 = (NativeCodePtr)((POINTER_SIZE_INT)ip2 + disasm.get_length_with_prefix());
 
                     // Another thread could have instrumented this location for
                     // prediction of invokevirtual or invokeinterface, so it is
                     // necessary to check that location may be instrumented
-                    uint8 b = *((uint8 *)ip2);
-                    if (b == INSTRUMENTATION_BYTE)
-                    {
-                        bp = vm_brpt->find_breakpoint(ip2);
-                        assert(bp);
+                    bp = vm_brpt->find_breakpoint(ip2);
+                    if (bp)
                         disasm = *bp->disasm;
-                    }
                     else
                         disasm = ip2;
-
-                    // Bytecode may be either invokevirtual or
-                    // invokeinterface which generate indirect calls or
-                    // invokestatic or invokespecial which generate
-                    // relative calls
-                    if (disasm.get_type() == InstructionDisassembler::INDIRECT_CALL ||
-                        disasm.get_type() == InstructionDisassembler::RELATIVE_CALL)
-                        call_ip = ip2;
                 }
                 while (ip2 < next_ip);
 



Mime
View raw message