src/share/vm/prims/jvmtiEnv.cpp

Print this page
rev 5449 : 8025834: NPE in Parallel Scavenge with -XX:+CheckUnhandledOops


1968   return op.result();
1969 } /* end SetLocalDouble */
1970 
1971 
1972   //
1973   // Breakpoint functions
1974   //
1975 
1976 // method_oop - pre-checked for validity, but may be NULL meaning obsolete method
1977 jvmtiError
1978 JvmtiEnv::SetBreakpoint(Method* method_oop, jlocation location) {
1979   NULL_CHECK(method_oop, JVMTI_ERROR_INVALID_METHODID);
1980   if (location < 0) {   // simple invalid location check first
1981     return JVMTI_ERROR_INVALID_LOCATION;
1982   }
1983   // verify that the breakpoint is not past the end of the method
1984   if (location >= (jlocation) method_oop->code_size()) {
1985     return JVMTI_ERROR_INVALID_LOCATION;
1986   }
1987 
1988   ResourceMark rm;
1989   JvmtiBreakpoint bp(method_oop, location);
1990   JvmtiBreakpoints& jvmti_breakpoints = JvmtiCurrentBreakpoints::get_jvmti_breakpoints();
1991   if (jvmti_breakpoints.set(bp) == JVMTI_ERROR_DUPLICATE)
1992     return JVMTI_ERROR_DUPLICATE;
1993 
1994   if (TraceJVMTICalls) {
1995     jvmti_breakpoints.print();
1996   }
1997 
1998   return JVMTI_ERROR_NONE;
1999 } /* end SetBreakpoint */
2000 
2001 
2002 // method_oop - pre-checked for validity, but may be NULL meaning obsolete method
2003 jvmtiError
2004 JvmtiEnv::ClearBreakpoint(Method* method_oop, jlocation location) {
2005   NULL_CHECK(method_oop, JVMTI_ERROR_INVALID_METHODID);
2006 
2007   if (location < 0) {   // simple invalid location check first
2008     return JVMTI_ERROR_INVALID_LOCATION;
2009   }
2010 
2011   // verify that the breakpoint is not past the end of the method
2012   if (location >= (jlocation) method_oop->code_size()) {
2013     return JVMTI_ERROR_INVALID_LOCATION;
2014   }
2015 

2016   JvmtiBreakpoint bp(method_oop, location);
2017 
2018   JvmtiBreakpoints& jvmti_breakpoints = JvmtiCurrentBreakpoints::get_jvmti_breakpoints();
2019   if (jvmti_breakpoints.clear(bp) == JVMTI_ERROR_NOT_FOUND)
2020     return JVMTI_ERROR_NOT_FOUND;
2021 
2022   if (TraceJVMTICalls) {
2023     jvmti_breakpoints.print();
2024   }
2025 
2026   return JVMTI_ERROR_NONE;
2027 } /* end ClearBreakpoint */
2028 
2029 
2030   //
2031   // Watched Field functions
2032   //
2033 
2034 jvmtiError
2035 JvmtiEnv::SetFieldAccessWatch(fieldDescriptor* fdesc_ptr) {
2036   // make sure we haven't set this watch before
2037   if (fdesc_ptr->is_field_access_watched()) return JVMTI_ERROR_DUPLICATE;




1968   return op.result();
1969 } /* end SetLocalDouble */
1970 
1971 
1972   //
1973   // Breakpoint functions
1974   //
1975 
1976 // method_oop - pre-checked for validity, but may be NULL meaning obsolete method
1977 jvmtiError
1978 JvmtiEnv::SetBreakpoint(Method* method_oop, jlocation location) {
1979   NULL_CHECK(method_oop, JVMTI_ERROR_INVALID_METHODID);
1980   if (location < 0) {   // simple invalid location check first
1981     return JVMTI_ERROR_INVALID_LOCATION;
1982   }
1983   // verify that the breakpoint is not past the end of the method
1984   if (location >= (jlocation) method_oop->code_size()) {
1985     return JVMTI_ERROR_INVALID_LOCATION;
1986   }
1987 
1988   HandleMark hm;
1989   JvmtiBreakpoint bp(method_oop, location);
1990   JvmtiBreakpoints& jvmti_breakpoints = JvmtiCurrentBreakpoints::get_jvmti_breakpoints();
1991   if (jvmti_breakpoints.set(bp) == JVMTI_ERROR_DUPLICATE)
1992     return JVMTI_ERROR_DUPLICATE;
1993 
1994   if (TraceJVMTICalls) {
1995     jvmti_breakpoints.print();
1996   }
1997 
1998   return JVMTI_ERROR_NONE;
1999 } /* end SetBreakpoint */
2000 
2001 
2002 // method_oop - pre-checked for validity, but may be NULL meaning obsolete method
2003 jvmtiError
2004 JvmtiEnv::ClearBreakpoint(Method* method_oop, jlocation location) {
2005   NULL_CHECK(method_oop, JVMTI_ERROR_INVALID_METHODID);

2006   if (location < 0) {   // simple invalid location check first
2007     return JVMTI_ERROR_INVALID_LOCATION;
2008   }

2009   // verify that the breakpoint is not past the end of the method
2010   if (location >= (jlocation) method_oop->code_size()) {
2011     return JVMTI_ERROR_INVALID_LOCATION;
2012   }
2013 
2014   HandleMark hm;
2015   JvmtiBreakpoint bp(method_oop, location);

2016   JvmtiBreakpoints& jvmti_breakpoints = JvmtiCurrentBreakpoints::get_jvmti_breakpoints();
2017   if (jvmti_breakpoints.clear(bp) == JVMTI_ERROR_NOT_FOUND)
2018     return JVMTI_ERROR_NOT_FOUND;
2019 
2020   if (TraceJVMTICalls) {
2021     jvmti_breakpoints.print();
2022   }
2023 
2024   return JVMTI_ERROR_NONE;
2025 } /* end ClearBreakpoint */
2026 
2027 
2028   //
2029   // Watched Field functions
2030   //
2031 
2032 jvmtiError
2033 JvmtiEnv::SetFieldAccessWatch(fieldDescriptor* fdesc_ptr) {
2034   // make sure we haven't set this watch before
2035   if (fdesc_ptr->is_field_access_watched()) return JVMTI_ERROR_DUPLICATE;