diff src/share/vm/utilities/debug.cpp @ 4006:436b4a3231bf

7098194: integrate macosx-port changes Summary: Integrate bsd-port/hotspot and macosx-port/hotspot changes as of 2011.09.29. Reviewed-by: kvn, dholmes, never, phh Contributed-by: Christos Zoulas <christos@zoulas.com>, Greg Lewis <glewis@eyesbeyond.com>, Kurt Miller <kurt@intricatesoftware.com>, Alexander Strange <astrange@apple.com>, Mike Swingler <swingler@apple.com>, Roger Hoover <rhoover@apple.com>, Victor Hernandez <vhernandez@apple.com>, Pratik Solanki <psolanki@apple.com>
author dcubed
date Thu, 13 Oct 2011 09:35:42 -0700
parents f08d439fab8c
children aa3d708d67c4
line wrap: on
line diff
--- a/src/share/vm/utilities/debug.cpp	Mon Oct 10 21:01:36 2011 -0400
+++ b/src/share/vm/utilities/debug.cpp	Thu Oct 13 09:35:42 2011 -0700
@@ -209,7 +209,7 @@
 // Place-holder for non-existent suppression check:
 #define error_is_suppressed(file_name, line_no) (false)
 
-#endif //PRODUCT
+#endif // !PRODUCT
 
 void report_vm_error(const char* file, int line, const char* error_msg,
                      const char* detail_msg)
@@ -264,7 +264,7 @@
 void report_untested(const char* file, int line, const char* message) {
 #ifndef PRODUCT
   warning("Untested: %s in %s: %d\n", message, file, line);
-#endif // PRODUCT
+#endif // !PRODUCT
 }
 
 void report_out_of_shared_space(SharedSpaceType shared_space) {
@@ -309,9 +309,6 @@
   }
 }
 
-
-extern "C" void ps();
-
 static bool error_reported = false;
 
 // call this when the VM is dying--it might loosen some asserts
@@ -366,11 +363,10 @@
     default: ShouldNotReachHere();
   }
 }
-#endif // #ifndef PRODUCT
+#endif // !PRODUCT
 
 // ------ helper functions for debugging go here ------------
 
-#ifndef PRODUCT
 // All debug entries should be wrapped with a stack allocated
 // Command object. It makes sure a resource mark is set and
 // flushes the logfile to prevent file sharing problems.
@@ -391,11 +387,17 @@
     tty->print_cr("\"Executing %s\"", str);
   }
 
-  ~Command() { tty->flush(); Debugging = debug_save; level--; }
+  ~Command() {
+        tty->flush();
+        Debugging = debug_save;
+        level--;
+  }
 };
 
 int Command::level = 0;
 
+#ifndef PRODUCT
+
 extern "C" void blob(CodeBlob* cb) {
   Command c("blob");
   cb->print();
@@ -478,7 +480,7 @@
     oop obj = oop(p);
     obj->print();
   } else {
-    tty->print("%#p", p);
+    tty->print(PTR_FORMAT, p);
   }
 }
 
@@ -487,7 +489,10 @@
 extern "C" void pa(intptr_t p)   { ((AllocatedObj*) p)->print(); }
 extern "C" void findpc(intptr_t x);
 
+#endif // !PRODUCT
+
 extern "C" void ps() { // print stack
+  if (Thread::current() == NULL) return;
   Command c("ps");
 
 
@@ -500,6 +505,11 @@
   if (p->has_last_Java_frame()) {
     // If the last_Java_fp is set we are in C land and
     // can call the standard stack_trace function.
+#ifdef PRODUCT
+    p->print_stack();
+  } else {
+    tty->print_cr("Cannot find the last Java frame, printing stack disabled.");
+#else // !PRODUCT
     p->trace_stack();
   } else {
     frame f = os::current_frame();
@@ -508,6 +518,7 @@
     tty->print("(guessing starting frame id=%#p based on current fp)\n", f.id());
     p->trace_stack_from(vframe::new_vframe(&f, &reg_map, p));
   pd_ps(f);
+#endif // PRODUCT
   }
 
 }
@@ -524,6 +535,8 @@
   }
 }
 
+#ifndef PRODUCT
+
 extern "C" void psf() { // print stack frames
   {
     Command c("psf");
@@ -555,12 +568,15 @@
   SafepointSynchronize::print_state();
 }
 
+#endif // !PRODUCT
 
 extern "C" void pss() { // print all stacks
+  if (Thread::current() == NULL) return;
   Command c("pss");
-  Threads::print(true, true);
+  Threads::print(true, PRODUCT_ONLY(false) NOT_PRODUCT(true));
 }
 
+#ifndef PRODUCT
 
 extern "C" void debug() {               // to set things up for compiler debugging
   Command c("debug");
@@ -911,4 +927,4 @@
 }
 #endif
 
-#endif // PRODUCT
+#endif // !PRODUCT