JDK-4294585 : HotSpot 1.3fcs-P generates unexpected JVMDI_EVENT_BREAKPOINT events on Solaris
  • Type: Bug
  • Component: vm-legacy
  • Sub-Component: jvmdi
  • Affected Version: 2.0,1.3.0
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • OS: generic,solaris_7
  • CPU: generic,sparc
  • Submitted: 1999-11-24
  • Updated: 2002-09-06
  • Resolved: 2002-09-06
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
1.3.0 sol-betaFixed
Related Reports
Duplicate :  
Duplicate :  
Relates :  
Relates :  
Relates :  
Relates :  
Description

Name: dkC59003			Date: 11/24/99


The regression test (testbase_nsk) nsk/regression/b4289109 fails
under the HotSpot 1.3fcs-P on Solaris.
The expected result of the test is 10 JVMDI_EVENT_BREAKPOINT events,
but the produced result is 21 JVMDI_EVENT_BREAKPOINT events.
To reproduce the bug run doit.sh in
GammaBase/Bugs/<this bug number>.

See logs:

% java -version
java version "1.3.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-O)
Java HotSpot(TM) Client VM (build 1.3-P, interpreted mode)
novo73% java -Xdebug -Xnoagent -Xrunb4289109 b4289109
----> breakpoint_init: breakpoint is set for b4289109.testMethod()
----> catch_braekpoint: breakpoint_counter = 1
----> catch_braekpoint: breakpoint_counter = 2
----> catch_braekpoint: breakpoint_counter = 3
----> testMethod: testMethod_call_counter = 1
----> catch_braekpoint: breakpoint_counter = 4
----> catch_braekpoint: breakpoint_counter = 5
----> testMethod: testMethod_call_counter = 2
----> catch_braekpoint: breakpoint_counter = 6
----> catch_braekpoint: breakpoint_counter = 7
----> testMethod: testMethod_call_counter = 3
----> catch_braekpoint: breakpoint_counter = 8
----> catch_braekpoint: breakpoint_counter = 9
----> testMethod: testMethod_call_counter = 4
----> catch_braekpoint: breakpoint_counter = 10
----> catch_braekpoint: breakpoint_counter = 11
----> testMethod: testMethod_call_counter = 5
----> catch_braekpoint: breakpoint_counter = 12
----> catch_braekpoint: breakpoint_counter = 13
----> testMethod: testMethod_call_counter = 6
----> catch_braekpoint: breakpoint_counter = 14
----> catch_braekpoint: breakpoint_counter = 15
----> testMethod: testMethod_call_counter = 7
----> catch_braekpoint: breakpoint_counter = 16
----> catch_braekpoint: breakpoint_counter = 17
----> testMethod: testMethod_call_counter = 8
----> catch_braekpoint: breakpoint_counter = 18
----> catch_braekpoint: breakpoint_counter = 19
----> testMethod: testMethod_call_counter = 9
----> catch_braekpoint: breakpoint_counter = 20
----> catch_braekpoint: breakpoint_counter = 21
----> testMethod: testMethod_call_counter = 10
----> Test nsk/regression/4289109 FAILED
----> Expected result: breakpoint_counter = 10
----> Produced result: breakpoint_counter = 21

The produced result under HotSpot 2.0beta-A on Solaris is 1 JVMDI_EVENT_BREAKPOINT
event instead of 10 events:

novo73% java -version
java version "1.2.2"
Java(TM) HotSpot Server VM (2.0, mixed mode, build A)
novo73% java -Xdebug -Xnoagent -Xrunb4289109 b4289109
----> breakpoint_init: breakpoint is set for b4289109.testMethod()
----> catch_braekpoint: breakpoint_counter = 1
----> testMethod: testMethod_call_counter = 1
----> testMethod: testMethod_call_counter = 2
----> testMethod: testMethod_call_counter = 3
----> testMethod: testMethod_call_counter = 4
----> testMethod: testMethod_call_counter = 5
----> testMethod: testMethod_call_counter = 6
----> testMethod: testMethod_call_counter = 7
----> testMethod: testMethod_call_counter = 8
----> testMethod: testMethod_call_counter = 9
----> testMethod: testMethod_call_counter = 10
----> Test nsk/regression/4289109 FAILED
----> Expected result: breakpoint_counter = 10
----> Produced result: breakpoint_counter = 1

The Classic VM (Solaris) passes the test as well as
HotSpot 2.0rc1-E and 1.3fcs-P on win32.

NOTES.
   The test has been developed on the base of the 4289109 bugreport
   (4289109 (P3/S3) break points are not reported as expected).
   According to the current state of bugreport this bug had been fixed and
   integrated in kestrel release on Nov 10 1999 10:14AM.
   

======================================================================

Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: kestrel-solaris FIXED IN: kestrel-solaris INTEGRATED IN: kest-sol-beta
14-06-2004

EVALUATION Peter, checked and he had fixed something like this before. He thinks that the fix may not have been merged in yet. mohammad.gharahgouzloo@Eng 1999-12-01 jmasa - 12/16/99 This bug is the result of merging in the fast breakpoint implementation for solaris. The post_breakpoint_event() function is being called from both InterpreterRuntime::_breakpoint() and jvmdi::at_safepoint(). The call in jvmdi::at_safepoint() has to be guarded with !UseFastBreakpoints. Additionally the mechanism used to avoid duplicate posting of events (the fix Peter made) has to be refined so that it can be used in the case where post_breakpoint_event() is being called from InterpreterRuntime::_breakpoint() and post_single_step_event() is called from jvmdi::at_safepoint().
11-06-2004

SUGGESTED FIX ------- jvmdi_impl.hpp ------- 844a845,846 > bool _breakpoint_posted; > bool _single_stepping_posted; 861a864,871 > inline void set_breakpoint_posted() { _breakpoint_posted = true; } > inline void set_single_stepping_posted() { > _single_stepping_posted = true; > } > inline bool has_breakpoint_been_posted() { return _breakpoint_posted; } > inline bool has_single_stepping_been_posted() { > return _single_stepping_posted; > } 862a873,879 > // If the thread is in the given method at the given > // location just return. Otherwise and reset the current location > // and reset _breakpoint_posted and _single_stepping_posted. > // _breakpoint_posted and _single_stepping_posted are only cleared > // here. > void compare_and_set_current_location(methodOop method, address location); > arches% sccs diffs jvmdi.cpp ------- jvmdi.cpp ------- 1445a1446,1447 > _breakpoint_posted = false; > _single_stepping_posted = false; 1488a1491,1513 > void JvmdiThreadState::compare_and_set_current_location(methodOop new_method, > address new_location) { > > int new_bci = new_location - new_method->code_base(); > > // Maintain the current location on a per-thread basis, and > // use it to filter out duplicate events due to instruction > // rewrites. The method is identified and stored as a JNI id which > // is safe in this case because the class cannot be unloaded while a > // method is executing. > > JNIid *new_method_id = new_method->jni_id(); > if ((_current_bci == new_bci) && (_current_method_id == new_method_id)) { > return; > } else { > _current_bci = new_bci; > _current_method_id = new_method_id; > _breakpoint_posted = false; > _single_stepping_posted = false; > return; > } > } > 2732d2756 < // Todo: yes this code needs to be optimized, for now just get the functionality to work. 2734,2754c2758,2761 < int bci = location - method->code_base(); < < // Maintain the current location on a per-thread basis, and < // use it to filter out duplicate events due to instruction < // rewrites. The method is identified and stored as a JNI id which < // is safe in this case because the class cannot be unloaded while a < // method is executing. < int current_bci; < JNIid* current_method_id; < state->get_current_location(&current_method_id, &current_bci); < < JNIid *method_id = method->jni_id(); < if (!((current_bci == bci) && (current_method_id == method_id))) { < state->set_current_location(method_id, bci); < < if (jvmdi::is_bytecode_stepping()) { < jvmdi::post_single_step_event(thread, method, location); < } < if (JvmdiCurrentBreakpoints::is_breakpoint(location)) { < jvmdi::post_breakpoint_event(thread, method, location); < } --- > state->compare_and_set_current_location(method, location); > if (jvmdi::is_bytecode_stepping() && > !state->has_single_stepping_been_posted()) { > jvmdi::post_single_step_event(thread, method, location); 2755a2763,2766 > if (!UseFastBreakpoints && !state->has_breakpoint_been_posted() && > JvmdiCurrentBreakpoints::is_breakpoint(location)) { > jvmdi::post_breakpoint_event(thread, method, location); > } 2893a2905,2907 > > JvmdiThreadState *state = thread->jvmdi_thread_state(); > state->set_breakpoint_posted(); 2909a2924,2926 > > JvmdiThreadState *state = thread->jvmdi_thread_state(); > state->set_single_stepping_posted(); ------- interpreterRuntime.cpp ------- 483,486c483,490 < ThreadState old_state = thread->osthread()->get_state(); < thread->osthread()->set_state(BREAKPOINTED); < jvmdi::post_breakpoint_event(thread, method, bcp); < thread->osthread()->set_state(old_state); --- > JvmdiThreadState *state = thread->jvmdi_thread_state(); > state->compare_and_set_current_location(method, bcp); > if(!state->has_breakpoint_been_posted()) { > ThreadState old_state = thread->osthread()->get_state(); > thread->osthread()->set_state(BREAKPOINTED); > jvmdi::post_breakpoint_event(thread, method, bcp); > thread->osthread()->set_state(old_state); > }
11-06-2004