- Timestamp:
- Nov 10, 2017 5:27:37 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r0drv/darwin/dbgkrnlinfo-r0drv-darwin.cpp
r69647 r69648 573 573 * @returns IPRT status code. 574 574 * @param pThis The internal scratch data. 575 * @param pszKernelFile The name of the kernel file. 575 576 */ 576 static int rtR0DbgKrnlDarwinLoadSymTab(RTDBGKRNLINFOINT *pThis )577 static int rtR0DbgKrnlDarwinLoadSymTab(RTDBGKRNLINFOINT *pThis, const char *pszKernelFile) 577 578 { 578 579 /* … … 612 613 { 613 614 if ((uint32_t)pSym->n_un.n_strx >= pThis->cbStrTab) 615 { 616 printf("RTR0DbgKrnlInfoOpen: %s: Symbol #%u has a bad string table index: %#x vs cbStrTab=%#x\n", 617 pszKernelFile, iSym, pSym->n_un.n_strx, pThis->cbStrTab); 614 618 RETURN_VERR_BAD_EXE_FORMAT; 619 } 615 620 const char *pszSym = &pThis->pachStrTab[(uint32_t)pSym->n_un.n_strx]; 616 621 #ifdef IN_RING3 … … 627 632 case MACHO_N_SECT: 628 633 if (pSym->n_sect == MACHO_NO_SECT) 634 { 635 printf("RTR0DbgKrnlInfoOpen: %s: Symbol #%u '%s' problem: n_sect = MACHO_NO_SECT\n", 636 pszKernelFile, iSym, pszSym); 629 637 RETURN_VERR_BAD_EXE_FORMAT; 638 } 630 639 if (pSym->n_sect > pThis->cSections) 640 { 641 printf("RTR0DbgKrnlInfoOpen: %s: Symbol #%u '%s' problem: n_sect (%u) is higher than cSections (%u)\n", 642 pszKernelFile, iSym, pszSym, pSym->n_sect, pThis->cSections); 631 643 RETURN_VERR_BAD_EXE_FORMAT; 644 } 632 645 if (pSym->n_desc & ~(REFERENCED_DYNAMICALLY | N_WEAK_DEF)) 646 { 647 printf("RTR0DbgKrnlInfoOpen: %s: Symbol #%u '%s' problem: Unexpected value n_desc=%#x\n", 648 pszKernelFile, iSym, pszSym, pSym->n_desc); 633 649 RETURN_VERR_BAD_EXE_FORMAT; 650 } 634 651 if ( pSym->n_value < pThis->apSections[pSym->n_sect - 1]->addr 635 652 && strcmp(pszSym, "__mh_execute_header")) /* in 10.8 it's no longer absolute (PIE?). */ 653 { 654 printf("RTR0DbgKrnlInfoOpen: %s: Symbol #%u '%s' problem: n_value (%#llx) < section addr (%#llx)\n", 655 pszKernelFile, iSym, pszSym, pSym->n_value, pThis->apSections[pSym->n_sect - 1]->addr); 636 656 RETURN_VERR_BAD_EXE_FORMAT; 657 } 637 658 if ( pSym->n_value - pThis->apSections[pSym->n_sect - 1]->addr 638 659 > pThis->apSections[pSym->n_sect - 1]->size 639 660 && strcmp(pszSym, "__mh_execute_header")) /* see above. */ 661 { 662 printf("RTR0DbgKrnlInfoOpen: %s: Symbol #%u '%s' problem: n_value (%#llx) >= end of section (%#llx + %#llx)\n", 663 pszKernelFile, iSym, pszSym, pSym->n_value, pThis->apSections[pSym->n_sect - 1]->addr, 664 pThis->apSections[pSym->n_sect - 1]->size); 640 665 RETURN_VERR_BAD_EXE_FORMAT; 666 } 641 667 break; 642 668 … … 645 671 && ( strcmp(pszSym, "__mh_execute_header") /* n_sect=1 in 10.7/amd64 */ 646 672 || pSym->n_sect > pThis->cSections) ) 673 { 674 printf("RTR0DbgKrnlInfoOpen: %s: Abs symbol #%u '%s' problem: n_sect (%u) is not MACHO_NO_SECT\n", 675 pszKernelFile, iSym, pszSym); 647 676 RETURN_VERR_BAD_EXE_FORMAT; 648 if (pSym->n_desc & ~(REFERENCED_DYNAMICALLY)) 677 } 678 if (pSym->n_desc & ~(REFERENCED_DYNAMICALLY | N_WEAK_DEF)) 679 { 680 printf("RTR0DbgKrnlInfoOpen: %s: Abs symbol #%u '%s' problem: Unexpected value n_desc=%#x\n", 681 pszKernelFile, iSym, pszSym, pSym->n_desc); 649 682 RETURN_VERR_BAD_EXE_FORMAT; 683 } 650 684 break; 651 685 652 686 case MACHO_N_UNDF: 653 687 /* No undefined or common symbols in the kernel. */ 688 printf("RTR0DbgKrnlInfoOpen: %s: Unexpected undefined symbol #%u '%s'\n", pszKernelFile, iSym, pszSym); 654 689 RETURN_VERR_BAD_EXE_FORMAT; 655 690 656 691 case MACHO_N_INDR: 657 692 /* No indirect symbols in the kernel. */ 693 printf("RTR0DbgKrnlInfoOpen: %s: Unexpected indirect symbol #%u '%s'\n", pszKernelFile, iSym, pszSym); 658 694 RETURN_VERR_BAD_EXE_FORMAT; 659 695 660 696 case MACHO_N_PBUD: 661 697 /* No prebound symbols in the kernel. */ 698 printf("RTR0DbgKrnlInfoOpen: %s: Unexpected prebound symbol #%u '%s'\n", pszKernelFile, iSym, pszSym); 662 699 RETURN_VERR_BAD_EXE_FORMAT; 663 700 664 701 default: 702 printf("RTR0DbgKrnlInfoOpen: %s: Unexpected symbol n_type %#x for symbol #%u '%s'\n", 703 pszKernelFile, pSym->n_type, iSym, pszSym); 665 704 RETURN_VERR_BAD_EXE_FORMAT; 666 705 } … … 1056 1095 rc = rtR0DbgKrnlDarwinLoadCommands(pThis); 1057 1096 if (RT_SUCCESS(rc)) 1058 rc = rtR0DbgKrnlDarwinLoadSymTab(pThis );1097 rc = rtR0DbgKrnlDarwinLoadSymTab(pThis, pszKernelFile); 1059 1098 if (RT_SUCCESS(rc)) 1060 1099 {
Note:
See TracChangeset
for help on using the changeset viewer.