609 tty->print_cr("// dofh_hdrsize = %d", hdr->dofh_hdrsize);
610 tty->print_cr("// dofh_secsize = %d", hdr->dofh_secsize);
611 tty->print_cr("// dofh_secnum = %d", hdr->dofh_secnum);
612 tty->print_cr("// dofh_secoff = %lld", hdr->dofh_secoff);
613 tty->print_cr("// dofh_loadsz = %lld", hdr->dofh_loadsz);
614 tty->print_cr("// dofh_filesz = %lld", hdr->dofh_filesz);
615 tty->print_cr("// }");
616 }
617
618 static void printDOF(void* dof) {
619 dof_hdr_t* hdr = (dof_hdr_t*)dof;
620 printDOFHeader(hdr);
621 for (int i = 0; i < hdr->dofh_secnum; ++i) {
622 dof_sec_t* sec =
623 (dof_sec_t*)((char*)dof + sizeof(dof_hdr_t) + i * sizeof(dof_sec_t));
624 tty->print_cr("// [Section #%d]", i);
625 printDOFSection(dof, sec);
626 }
627 }
628
629 /**
630 * This prints out hex data in a 'windbg' or 'xxd' form, where each line is:
631 * <hex-address>: 8 * <hex-halfword> <ascii translation>
632 * example:
633 * 0000000: 7f44 4f46 0102 0102 0000 0000 0000 0000 .DOF............
634 * 0000010: 0000 0000 0000 0040 0000 0020 0000 0005 .......@... ....
635 * 0000020: 0000 0000 0000 0040 0000 0000 0000 015d .......@.......]
636 * ...
637 */
638 static void printDOFRawData(void* dof) {
639 size_t size = ((dof_hdr_t*)dof)->dofh_loadsz;
640 size_t limit = (size + 16) / 16 * 16;
641 for (size_t i = 0; i < limit; ++i) {
642 if (i % 16 == 0) {
643 tty->print("%07x:", i);
644 }
645 if (i % 2 == 0) {
646 tty->print(" ");
647 }
648 if (i < size) {
649 tty->print("%02x", ((unsigned char*)dof)[i]);
650 } else {
651 tty->print(" ");
652 }
653 if ((i + 1) % 16 == 0) {
654 tty->print(" ");
655 for (size_t j = 0; j < 16; ++j) {
656 size_t idx = i + j - 15;
657 char c = ((char*)dof)[idx];
658 if (idx < size) {
659 tty->print("%c", c >= 32 && c <= 126 ? c : '.');
660 }
661 }
662 tty->print_cr("");
663 }
664 }
665 tty->print_cr("");
666 }
667
668 static void printDOFHelper(dof_helper_t* helper) {
669 tty->print_cr("// dof_helper_t {");
670 tty->print_cr("// dofhp_mod = \"%s\"", helper->dofhp_mod);
671 tty->print_cr("// dofhp_addr = 0x%016llx", helper->dofhp_addr);
672 tty->print_cr("// dofhp_dof = 0x%016llx", helper->dofhp_dof);
673 printDOF((void*)helper->dofhp_dof);
674 tty->print_cr("// }");
675 printDOFRawData((void*)helper->dofhp_dof);
676 }
677
678 #else // ndef HAVE_DTRACE_H
679
680 // Get here if we're not building on at least Solaris 10
681 int DTraceJSDT::pd_activate(
682 void* baseAddress, jstring module,
683 jint provider_count, JVM_DTraceProvider* providers) {
684 return -1;
685 }
686
687 void DTraceJSDT::pd_dispose(int handle) {
688 }
689
690 jboolean DTraceJSDT::pd_is_supported() {
691 return false;
692 }
693 #endif
|
609 tty->print_cr("// dofh_hdrsize = %d", hdr->dofh_hdrsize);
610 tty->print_cr("// dofh_secsize = %d", hdr->dofh_secsize);
611 tty->print_cr("// dofh_secnum = %d", hdr->dofh_secnum);
612 tty->print_cr("// dofh_secoff = %lld", hdr->dofh_secoff);
613 tty->print_cr("// dofh_loadsz = %lld", hdr->dofh_loadsz);
614 tty->print_cr("// dofh_filesz = %lld", hdr->dofh_filesz);
615 tty->print_cr("// }");
616 }
617
618 static void printDOF(void* dof) {
619 dof_hdr_t* hdr = (dof_hdr_t*)dof;
620 printDOFHeader(hdr);
621 for (int i = 0; i < hdr->dofh_secnum; ++i) {
622 dof_sec_t* sec =
623 (dof_sec_t*)((char*)dof + sizeof(dof_hdr_t) + i * sizeof(dof_sec_t));
624 tty->print_cr("// [Section #%d]", i);
625 printDOFSection(dof, sec);
626 }
627 }
628
629 static void printDOFHelper(dof_helper_t* helper) {
630 tty->print_cr("// dof_helper_t {");
631 tty->print_cr("// dofhp_mod = \"%s\"", helper->dofhp_mod);
632 tty->print_cr("// dofhp_addr = 0x%016llx", helper->dofhp_addr);
633 tty->print_cr("// dofhp_dof = 0x%016llx", helper->dofhp_dof);
634 printDOF((void*)helper->dofhp_dof);
635 tty->print_cr("// }");
636 size_t len = ((dof_hdr_t*)helper)->dofh_loadsz;
637 tty->print_data((void*)helper->dofhp_dof, len, true);
638 }
639
640 #else // ndef HAVE_DTRACE_H
641
642 // Get here if we're not building on at least Solaris 10
643 int DTraceJSDT::pd_activate(
644 void* baseAddress, jstring module,
645 jint provider_count, JVM_DTraceProvider* providers) {
646 return -1;
647 }
648
649 void DTraceJSDT::pd_dispose(int handle) {
650 }
651
652 jboolean DTraceJSDT::pd_is_supported() {
653 return false;
654 }
655 #endif
|