hotspot/src/os/posix/vm/os_posix.cpp
changeset 13195 be27e1b6a4b9
parent 12735 3e2e491f4f69
child 13198 271c557a7623
--- a/hotspot/src/os/posix/vm/os_posix.cpp	Wed Jun 27 15:23:36 2012 +0200
+++ b/hotspot/src/os/posix/vm/os_posix.cpp	Thu Jun 28 17:03:16 2012 -0400
@@ -23,6 +23,7 @@
 */
 
 #include "prims/jvm.h"
+#include "runtime/frame.inline.hpp"
 #include "runtime/os.hpp"
 #include "utilities/vmError.hpp"
 
@@ -61,6 +62,23 @@
   VMError::report_coredump_status(buffer, success);
 }
 
+address os::get_caller_pc(int n) {
+#ifdef _NMT_NOINLINE_
+  n ++;
+#endif
+  frame fr = os::current_frame();
+  while (n > 0 && fr.pc() &&
+    !os::is_first_C_frame(&fr) && fr.sender_pc()) {
+    fr = os::get_sender_for_C_frame(&fr);
+    n --;
+  }
+  if (n == 0) {
+    return fr.pc();
+  } else {
+    return NULL;
+  }
+}
+
 int os::get_last_error() {
   return errno;
 }