Mercurial > hg > graal-jvmci-8
comparison 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 |
comparison
equal
deleted
inserted
replaced
4005:2ef3386478e6 | 4006:436b4a3231bf |
---|---|
207 #else | 207 #else |
208 | 208 |
209 // Place-holder for non-existent suppression check: | 209 // Place-holder for non-existent suppression check: |
210 #define error_is_suppressed(file_name, line_no) (false) | 210 #define error_is_suppressed(file_name, line_no) (false) |
211 | 211 |
212 #endif //PRODUCT | 212 #endif // !PRODUCT |
213 | 213 |
214 void report_vm_error(const char* file, int line, const char* error_msg, | 214 void report_vm_error(const char* file, int line, const char* error_msg, |
215 const char* detail_msg) | 215 const char* detail_msg) |
216 { | 216 { |
217 if (Debugging || error_is_suppressed(file, line)) return; | 217 if (Debugging || error_is_suppressed(file, line)) return; |
262 } | 262 } |
263 | 263 |
264 void report_untested(const char* file, int line, const char* message) { | 264 void report_untested(const char* file, int line, const char* message) { |
265 #ifndef PRODUCT | 265 #ifndef PRODUCT |
266 warning("Untested: %s in %s: %d\n", message, file, line); | 266 warning("Untested: %s in %s: %d\n", message, file, line); |
267 #endif // PRODUCT | 267 #endif // !PRODUCT |
268 } | 268 } |
269 | 269 |
270 void report_out_of_shared_space(SharedSpaceType shared_space) { | 270 void report_out_of_shared_space(SharedSpaceType shared_space) { |
271 static const char* name[] = { | 271 static const char* name[] = { |
272 "permanent generation", | 272 "permanent generation", |
306 VMError err(message); | 306 VMError err(message); |
307 err.report_java_out_of_memory(); | 307 err.report_java_out_of_memory(); |
308 } | 308 } |
309 } | 309 } |
310 } | 310 } |
311 | |
312 | |
313 extern "C" void ps(); | |
314 | 311 |
315 static bool error_reported = false; | 312 static bool error_reported = false; |
316 | 313 |
317 // call this when the VM is dying--it might loosen some asserts | 314 // call this when the VM is dying--it might loosen some asserts |
318 void set_error_reported() { | 315 void set_error_reported() { |
364 case 12: os::signal_raise(SIGSEGV); | 361 case 12: os::signal_raise(SIGSEGV); |
365 | 362 |
366 default: ShouldNotReachHere(); | 363 default: ShouldNotReachHere(); |
367 } | 364 } |
368 } | 365 } |
369 #endif // #ifndef PRODUCT | 366 #endif // !PRODUCT |
370 | 367 |
371 // ------ helper functions for debugging go here ------------ | 368 // ------ helper functions for debugging go here ------------ |
372 | 369 |
373 #ifndef PRODUCT | |
374 // All debug entries should be wrapped with a stack allocated | 370 // All debug entries should be wrapped with a stack allocated |
375 // Command object. It makes sure a resource mark is set and | 371 // Command object. It makes sure a resource mark is set and |
376 // flushes the logfile to prevent file sharing problems. | 372 // flushes the logfile to prevent file sharing problems. |
377 | 373 |
378 class Command : public StackObj { | 374 class Command : public StackObj { |
389 if (level++ > 0) return; | 385 if (level++ > 0) return; |
390 tty->cr(); | 386 tty->cr(); |
391 tty->print_cr("\"Executing %s\"", str); | 387 tty->print_cr("\"Executing %s\"", str); |
392 } | 388 } |
393 | 389 |
394 ~Command() { tty->flush(); Debugging = debug_save; level--; } | 390 ~Command() { |
391 tty->flush(); | |
392 Debugging = debug_save; | |
393 level--; | |
394 } | |
395 }; | 395 }; |
396 | 396 |
397 int Command::level = 0; | 397 int Command::level = 0; |
398 | |
399 #ifndef PRODUCT | |
398 | 400 |
399 extern "C" void blob(CodeBlob* cb) { | 401 extern "C" void blob(CodeBlob* cb) { |
400 Command c("blob"); | 402 Command c("blob"); |
401 cb->print(); | 403 cb->print(); |
402 } | 404 } |
476 FlagSetting f2(DisplayVMOutput, true); | 478 FlagSetting f2(DisplayVMOutput, true); |
477 if (Universe::heap()->is_in(p)) { | 479 if (Universe::heap()->is_in(p)) { |
478 oop obj = oop(p); | 480 oop obj = oop(p); |
479 obj->print(); | 481 obj->print(); |
480 } else { | 482 } else { |
481 tty->print("%#p", p); | 483 tty->print(PTR_FORMAT, p); |
482 } | 484 } |
483 } | 485 } |
484 | 486 |
485 | 487 |
486 // pv: print vm-printable object | 488 // pv: print vm-printable object |
487 extern "C" void pa(intptr_t p) { ((AllocatedObj*) p)->print(); } | 489 extern "C" void pa(intptr_t p) { ((AllocatedObj*) p)->print(); } |
488 extern "C" void findpc(intptr_t x); | 490 extern "C" void findpc(intptr_t x); |
489 | 491 |
492 #endif // !PRODUCT | |
493 | |
490 extern "C" void ps() { // print stack | 494 extern "C" void ps() { // print stack |
495 if (Thread::current() == NULL) return; | |
491 Command c("ps"); | 496 Command c("ps"); |
492 | 497 |
493 | 498 |
494 // Prints the stack of the current Java thread | 499 // Prints the stack of the current Java thread |
495 JavaThread* p = JavaThread::active(); | 500 JavaThread* p = JavaThread::active(); |
498 tty->cr(); | 503 tty->cr(); |
499 | 504 |
500 if (p->has_last_Java_frame()) { | 505 if (p->has_last_Java_frame()) { |
501 // If the last_Java_fp is set we are in C land and | 506 // If the last_Java_fp is set we are in C land and |
502 // can call the standard stack_trace function. | 507 // can call the standard stack_trace function. |
508 #ifdef PRODUCT | |
509 p->print_stack(); | |
510 } else { | |
511 tty->print_cr("Cannot find the last Java frame, printing stack disabled."); | |
512 #else // !PRODUCT | |
503 p->trace_stack(); | 513 p->trace_stack(); |
504 } else { | 514 } else { |
505 frame f = os::current_frame(); | 515 frame f = os::current_frame(); |
506 RegisterMap reg_map(p); | 516 RegisterMap reg_map(p); |
507 f = f.sender(®_map); | 517 f = f.sender(®_map); |
508 tty->print("(guessing starting frame id=%#p based on current fp)\n", f.id()); | 518 tty->print("(guessing starting frame id=%#p based on current fp)\n", f.id()); |
509 p->trace_stack_from(vframe::new_vframe(&f, ®_map, p)); | 519 p->trace_stack_from(vframe::new_vframe(&f, ®_map, p)); |
510 pd_ps(f); | 520 pd_ps(f); |
521 #endif // PRODUCT | |
511 } | 522 } |
512 | 523 |
513 } | 524 } |
514 | 525 |
515 extern "C" void pfl() { | 526 extern "C" void pfl() { |
521 tty->cr(); | 532 tty->cr(); |
522 if (p->has_last_Java_frame()) { | 533 if (p->has_last_Java_frame()) { |
523 p->print_frame_layout(); | 534 p->print_frame_layout(); |
524 } | 535 } |
525 } | 536 } |
537 | |
538 #ifndef PRODUCT | |
526 | 539 |
527 extern "C" void psf() { // print stack frames | 540 extern "C" void psf() { // print stack frames |
528 { | 541 { |
529 Command c("psf"); | 542 Command c("psf"); |
530 JavaThread* p = JavaThread::active(); | 543 JavaThread* p = JavaThread::active(); |
553 extern "C" void safepoints() { | 566 extern "C" void safepoints() { |
554 Command c("safepoints"); | 567 Command c("safepoints"); |
555 SafepointSynchronize::print_state(); | 568 SafepointSynchronize::print_state(); |
556 } | 569 } |
557 | 570 |
571 #endif // !PRODUCT | |
558 | 572 |
559 extern "C" void pss() { // print all stacks | 573 extern "C" void pss() { // print all stacks |
574 if (Thread::current() == NULL) return; | |
560 Command c("pss"); | 575 Command c("pss"); |
561 Threads::print(true, true); | 576 Threads::print(true, PRODUCT_ONLY(false) NOT_PRODUCT(true)); |
562 } | 577 } |
563 | 578 |
579 #ifndef PRODUCT | |
564 | 580 |
565 extern "C" void debug() { // to set things up for compiler debugging | 581 extern "C" void debug() { // to set things up for compiler debugging |
566 Command c("debug"); | 582 Command c("debug"); |
567 WizardMode = true; | 583 WizardMode = true; |
568 PrintVMMessages = PrintCompilation = true; | 584 PrintVMMessages = PrintCompilation = true; |
909 } | 925 } |
910 } | 926 } |
911 } | 927 } |
912 #endif | 928 #endif |
913 | 929 |
914 #endif // PRODUCT | 930 #endif // !PRODUCT |