Top


定義場所(file name)

hotspot/src/os/linux/vm/os_linux.cpp

説明(description)

// Suspends the target using the signal mechanism and then grabs the PC before
// resuming the target. Used by the flat-profiler only

名前(function name)

ExtendedPC os::get_thread_pc(Thread* thread) {

本体部(body)

  {- -------------------------------------------
  (1) (assert)
      ---------------------------------------- -}

      // Make sure that it is called by the watcher for the VMThread
      assert(Thread::current()->is_Watcher_thread(), "Must be watcher");
      assert(thread->is_VM_thread(), "Can only be called for VMThread");

  {- -------------------------------------------
  (1) (変数宣言など)
      ---------------------------------------- -}

      ExtendedPC epc;

      OSThread* osthread = thread->osthread();

  {- -------------------------------------------
  (1) do_suspend() を呼んで処理対象のスレッドを停止させた後, 
      os::Linux::ucontext_get_pc() で pc を取得する.
      その後, do_resume() でスレッドの処理を再開させる.
      ---------------------------------------- -}

      if (do_suspend(osthread)) {
        if (osthread->ucontext() != NULL) {
          epc = os::Linux::ucontext_get_pc(osthread->ucontext());
        } else {
          // NULL context is unexpected, double-check this is the VMThread
          guarantee(thread->is_VM_thread(), "can only be called for VMThread");
        }
        do_resume(osthread);
      }
      // failure means pthread_kill failed for some reason - arguably this is
      // a fatal problem, but such problems are ignored elsewhere

  {- -------------------------------------------
  (1) リターン
      ---------------------------------------- -}

      return epc;
    }

This document is available under the GNU GENERAL PUBLIC LICENSE Version 2.