< prev index next >

src/hotspot/share/prims/stackwalk.cpp

Print this page




  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "classfile/javaClasses.hpp"
  27 #include "classfile/javaClasses.inline.hpp"
  28 #include "classfile/vmSymbols.hpp"
  29 #include "logging/log.hpp"
  30 #include "logging/logStream.hpp"
  31 #include "memory/oopFactory.hpp"
  32 #include "memory/universe.hpp"
  33 #include "oops/oop.inline.hpp"
  34 #include "oops/objArrayOop.inline.hpp"
  35 #include "prims/stackwalk.hpp"
  36 #include "runtime/globals.hpp"
  37 #include "runtime/handles.inline.hpp"
  38 #include "runtime/javaCalls.hpp"
  39 #include "runtime/thread.inline.hpp"
  40 #include "runtime/vframe.inline.hpp"
  41 #include "utilities/globalDefinitions.hpp"
  42 
  43 // setup and cleanup actions
  44 void BaseFrameStream::setup_magic_on_entry(objArrayHandle frames_array) {
  45   frames_array->obj_at_put(magic_pos, _thread->threadObj());
  46   _anchor = address_value();
  47   assert(check_magic(frames_array), "invalid magic");
  48 }
  49 
  50 bool BaseFrameStream::check_magic(objArrayHandle frames_array) {
  51   oop   m1 = frames_array->obj_at(magic_pos);
  52   jlong m2 = _anchor;


 135           ls.cr();
 136         }
 137         continue;
 138       }
 139     }
 140 
 141     int index = end_index++;
 142     LogTarget(Debug, stackwalk) lt;
 143     if (lt.is_enabled()) {
 144       ResourceMark rm(THREAD);
 145       LogStream ls(lt);
 146       ls.print("  %d: frame method: ", index);
 147       method->print_short_name(&ls);
 148       ls.print_cr(" bci=%d", stream.bci());
 149     }
 150 
 151     if (!need_method_info(mode) && get_caller_class(mode) &&
 152           index == start_index && method->caller_sensitive()) {
 153       ResourceMark rm(THREAD);
 154       THROW_MSG_0(vmSymbols::java_lang_UnsupportedOperationException(),
 155         err_msg("StackWalker::getCallerClass called from @CallerSensitive '%s' method",
 156                 method->external_name()));
 157     }
 158     // fill in StackFrameInfo and initialize MemberName
 159     stream.fill_frame(index, frames_array, method, CHECK_0);
 160     if (++frames_decoded >= max_nframes)  break;
 161   }
 162   return frames_decoded;
 163 }
 164 
 165 // Fill in the LiveStackFrameInfo at the given index in frames_array
 166 void LiveFrameStream::fill_frame(int index, objArrayHandle  frames_array,
 167                                  const methodHandle& method, TRAPS) {
 168   HandleMark hm(THREAD);
 169   Handle stackFrame(THREAD, frames_array->obj_at(index));
 170   fill_live_stackframe(stackFrame, method, CHECK);
 171 }
 172 
 173 // Fill in the StackFrameInfo at the given index in frames_array
 174 void JavaFrameStream::fill_frame(int index, objArrayHandle  frames_array,
 175                                  const methodHandle& method, TRAPS) {
 176   if (_need_method_info) {




  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "classfile/javaClasses.hpp"
  27 #include "classfile/javaClasses.inline.hpp"
  28 #include "classfile/vmSymbols.hpp"
  29 #include "logging/log.hpp"
  30 #include "logging/logStream.hpp"
  31 #include "memory/oopFactory.hpp"

  32 #include "oops/oop.inline.hpp"
  33 #include "oops/objArrayOop.inline.hpp"
  34 #include "prims/stackwalk.hpp"
  35 #include "runtime/globals.hpp"
  36 #include "runtime/handles.inline.hpp"
  37 #include "runtime/javaCalls.hpp"
  38 #include "runtime/thread.inline.hpp"
  39 #include "runtime/vframe.inline.hpp"
  40 #include "utilities/globalDefinitions.hpp"
  41 
  42 // setup and cleanup actions
  43 void BaseFrameStream::setup_magic_on_entry(objArrayHandle frames_array) {
  44   frames_array->obj_at_put(magic_pos, _thread->threadObj());
  45   _anchor = address_value();
  46   assert(check_magic(frames_array), "invalid magic");
  47 }
  48 
  49 bool BaseFrameStream::check_magic(objArrayHandle frames_array) {
  50   oop   m1 = frames_array->obj_at(magic_pos);
  51   jlong m2 = _anchor;


 134           ls.cr();
 135         }
 136         continue;
 137       }
 138     }
 139 
 140     int index = end_index++;
 141     LogTarget(Debug, stackwalk) lt;
 142     if (lt.is_enabled()) {
 143       ResourceMark rm(THREAD);
 144       LogStream ls(lt);
 145       ls.print("  %d: frame method: ", index);
 146       method->print_short_name(&ls);
 147       ls.print_cr(" bci=%d", stream.bci());
 148     }
 149 
 150     if (!need_method_info(mode) && get_caller_class(mode) &&
 151           index == start_index && method->caller_sensitive()) {
 152       ResourceMark rm(THREAD);
 153       THROW_MSG_0(vmSymbols::java_lang_UnsupportedOperationException(),
 154         err_msg("StackWalker::getCallerClass called from @CallerSensitive %s method",
 155                 method->name_and_sig_as_C_string()));
 156     }
 157     // fill in StackFrameInfo and initialize MemberName
 158     stream.fill_frame(index, frames_array, method, CHECK_0);
 159     if (++frames_decoded >= max_nframes)  break;
 160   }
 161   return frames_decoded;
 162 }
 163 
 164 // Fill in the LiveStackFrameInfo at the given index in frames_array
 165 void LiveFrameStream::fill_frame(int index, objArrayHandle  frames_array,
 166                                  const methodHandle& method, TRAPS) {
 167   HandleMark hm(THREAD);
 168   Handle stackFrame(THREAD, frames_array->obj_at(index));
 169   fill_live_stackframe(stackFrame, method, CHECK);
 170 }
 171 
 172 // Fill in the StackFrameInfo at the given index in frames_array
 173 void JavaFrameStream::fill_frame(int index, objArrayHandle  frames_array,
 174                                  const methodHandle& method, TRAPS) {
 175   if (_need_method_info) {


< prev index next >