Changeset 96448 in vbox for trunk/src/VBox/Runtime/r3/win
- Timestamp:
- Aug 23, 2022 10:35:23 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r3/win/init-win.cpp
r96407 r96448 576 576 * Try get the logger and log exception details. 577 577 * 578 * Note! We'll be using RTLogLogger for now, though we should probably add578 * Note! We'll be using RTLogLoggerWeak for now, though we should probably add 579 579 * a less deadlock prone API here and gives up pretty fast if it 580 580 * cannot get the lock... 581 581 */ 582 PRTLOGGER pLogger = RTLogRelGetDefaultInstance ();582 PRTLOGGER pLogger = RTLogRelGetDefaultInstanceWeak(); 583 583 if (!pLogger) 584 pLogger = RTLogGetDefaultInstance ();584 pLogger = RTLogGetDefaultInstanceWeak(); 585 585 if (pLogger) 586 586 { 587 RTLogLogger (pLogger, NULL, "\n!!! rtR3WinUnhandledXcptFilter caught an exception on thread %p in %u !!!\n",588 RTThreadNativeSelf(), RTProcSelf());587 RTLogLoggerWeak(pLogger, NULL, "\n!!! rtR3WinUnhandledXcptFilter caught an exception on thread %p in %u !!!\n", 588 RTThreadNativeSelf(), RTProcSelf()); 589 589 590 590 /* … … 595 595 if (pXcptRec) 596 596 { 597 RTLogLogger (pLogger, NULL, "\nExceptionCode=%#010x ExceptionFlags=%#010x ExceptionAddress=%p\n",598 pXcptRec->ExceptionCode, pXcptRec->ExceptionFlags, pXcptRec->ExceptionAddress);597 RTLogLoggerWeak(pLogger, NULL, "\nExceptionCode=%#010x ExceptionFlags=%#010x ExceptionAddress=%p\n", 598 pXcptRec->ExceptionCode, pXcptRec->ExceptionFlags, pXcptRec->ExceptionAddress); 599 599 for (uint32_t i = 0; i < RT_MIN(pXcptRec->NumberParameters, EXCEPTION_MAXIMUM_PARAMETERS); i++) 600 RTLogLogger (pLogger, NULL, "ExceptionInformation[%d]=%p\n", i, pXcptRec->ExceptionInformation[i]);600 RTLogLoggerWeak(pLogger, NULL, "ExceptionInformation[%d]=%p\n", i, pXcptRec->ExceptionInformation[i]); 601 601 uXcptPC = (uintptr_t)pXcptRec->ExceptionAddress; 602 602 … … 605 605 if (RT_VALID_PTR(pNestedRec)) 606 606 { 607 RTLogLogger (pLogger, NULL, "Nested: ExceptionCode=%#010x ExceptionFlags=%#010x ExceptionAddress=%p (nested %p)\n",608 pNestedRec->ExceptionCode, pNestedRec->ExceptionFlags, pNestedRec->ExceptionAddress,609 pNestedRec->ExceptionRecord);607 RTLogLoggerWeak(pLogger, NULL, "Nested: ExceptionCode=%#010x ExceptionFlags=%#010x ExceptionAddress=%p (nested %p)\n", 608 pNestedRec->ExceptionCode, pNestedRec->ExceptionFlags, pNestedRec->ExceptionAddress, 609 pNestedRec->ExceptionRecord); 610 610 for (uint32_t i = 0; i < RT_MIN(pNestedRec->NumberParameters, EXCEPTION_MAXIMUM_PARAMETERS); i++) 611 RTLogLogger (pLogger, NULL, "Nested: ExceptionInformation[%d]=%p\n", i, pNestedRec->ExceptionInformation[i]);611 RTLogLoggerWeak(pLogger, NULL, "Nested: ExceptionInformation[%d]=%p\n", i, pNestedRec->ExceptionInformation[i]); 612 612 uXcptPC = (uintptr_t)pNestedRec->ExceptionAddress; 613 613 } … … 623 623 { 624 624 #ifdef RT_ARCH_AMD64 625 RTLogLogger (pLogger, NULL, "\ncs:rip=%04x:%016RX64\n", pXcptCtx->SegCs, pXcptCtx->Rip);626 RTLogLogger (pLogger, NULL, "ss:rsp=%04x:%016RX64 rbp=%016RX64\n", pXcptCtx->SegSs, pXcptCtx->Rsp, pXcptCtx->Rbp);627 RTLogLogger (pLogger, NULL, "rax=%016RX64 rcx=%016RX64 rdx=%016RX64 rbx=%016RX64\n",628 pXcptCtx->Rax, pXcptCtx->Rcx, pXcptCtx->Rdx, pXcptCtx->Rbx);629 RTLogLogger (pLogger, NULL, "rsi=%016RX64 rdi=%016RX64 rsp=%016RX64 rbp=%016RX64\n",630 pXcptCtx->Rsi, pXcptCtx->Rdi, pXcptCtx->Rsp, pXcptCtx->Rbp);631 RTLogLogger (pLogger, NULL, "r8 =%016RX64 r9 =%016RX64 r10=%016RX64 r11=%016RX64\n",632 pXcptCtx->R8, pXcptCtx->R9, pXcptCtx->R10, pXcptCtx->R11);633 RTLogLogger (pLogger, NULL, "r12=%016RX64 r13=%016RX64 r14=%016RX64 r15=%016RX64\n",634 pXcptCtx->R12, pXcptCtx->R13, pXcptCtx->R14, pXcptCtx->R15);635 RTLogLogger (pLogger, NULL, "ds=%04x es=%04x fs=%04x gs=%04x eflags=%08x\n",636 pXcptCtx->SegDs, pXcptCtx->SegEs, pXcptCtx->SegFs, pXcptCtx->SegGs, pXcptCtx->EFlags);637 RTLogLogger (pLogger, NULL, "p1home=%016RX64 p2home=%016RX64 pe3home=%016RX64\n",638 pXcptCtx->P1Home, pXcptCtx->P2Home, pXcptCtx->P3Home);639 RTLogLogger (pLogger, NULL, "p4home=%016RX64 p5home=%016RX64 pe6home=%016RX64\n",640 pXcptCtx->P4Home, pXcptCtx->P5Home, pXcptCtx->P6Home);641 RTLogLogger (pLogger, NULL, " LastBranchToRip=%016RX64 LastBranchFromRip=%016RX64\n",642 pXcptCtx->LastBranchToRip, pXcptCtx->LastBranchFromRip);643 RTLogLogger (pLogger, NULL, "LastExceptionToRip=%016RX64 LastExceptionFromRip=%016RX64\n",644 pXcptCtx->LastExceptionToRip, pXcptCtx->LastExceptionFromRip);625 RTLogLoggerWeak(pLogger, NULL, "\ncs:rip=%04x:%016RX64\n", pXcptCtx->SegCs, pXcptCtx->Rip); 626 RTLogLoggerWeak(pLogger, NULL, "ss:rsp=%04x:%016RX64 rbp=%016RX64\n", pXcptCtx->SegSs, pXcptCtx->Rsp, pXcptCtx->Rbp); 627 RTLogLoggerWeak(pLogger, NULL, "rax=%016RX64 rcx=%016RX64 rdx=%016RX64 rbx=%016RX64\n", 628 pXcptCtx->Rax, pXcptCtx->Rcx, pXcptCtx->Rdx, pXcptCtx->Rbx); 629 RTLogLoggerWeak(pLogger, NULL, "rsi=%016RX64 rdi=%016RX64 rsp=%016RX64 rbp=%016RX64\n", 630 pXcptCtx->Rsi, pXcptCtx->Rdi, pXcptCtx->Rsp, pXcptCtx->Rbp); 631 RTLogLoggerWeak(pLogger, NULL, "r8 =%016RX64 r9 =%016RX64 r10=%016RX64 r11=%016RX64\n", 632 pXcptCtx->R8, pXcptCtx->R9, pXcptCtx->R10, pXcptCtx->R11); 633 RTLogLoggerWeak(pLogger, NULL, "r12=%016RX64 r13=%016RX64 r14=%016RX64 r15=%016RX64\n", 634 pXcptCtx->R12, pXcptCtx->R13, pXcptCtx->R14, pXcptCtx->R15); 635 RTLogLoggerWeak(pLogger, NULL, "ds=%04x es=%04x fs=%04x gs=%04x eflags=%08x\n", 636 pXcptCtx->SegDs, pXcptCtx->SegEs, pXcptCtx->SegFs, pXcptCtx->SegGs, pXcptCtx->EFlags); 637 RTLogLoggerWeak(pLogger, NULL, "p1home=%016RX64 p2home=%016RX64 pe3home=%016RX64\n", 638 pXcptCtx->P1Home, pXcptCtx->P2Home, pXcptCtx->P3Home); 639 RTLogLoggerWeak(pLogger, NULL, "p4home=%016RX64 p5home=%016RX64 pe6home=%016RX64\n", 640 pXcptCtx->P4Home, pXcptCtx->P5Home, pXcptCtx->P6Home); 641 RTLogLoggerWeak(pLogger, NULL, " LastBranchToRip=%016RX64 LastBranchFromRip=%016RX64\n", 642 pXcptCtx->LastBranchToRip, pXcptCtx->LastBranchFromRip); 643 RTLogLoggerWeak(pLogger, NULL, "LastExceptionToRip=%016RX64 LastExceptionFromRip=%016RX64\n", 644 pXcptCtx->LastExceptionToRip, pXcptCtx->LastExceptionFromRip); 645 645 uXcptSP = pXcptCtx->Rsp; 646 646 uXcptPC = pXcptCtx->Rip; 647 647 648 648 #elif defined(RT_ARCH_X86) 649 RTLogLogger (pLogger, NULL, "\ncs:eip=%04x:%08RX32\n", pXcptCtx->SegCs, pXcptCtx->Eip);650 RTLogLogger (pLogger, NULL, "ss:esp=%04x:%08RX32 ebp=%08RX32\n", pXcptCtx->SegSs, pXcptCtx->Esp, pXcptCtx->Ebp);651 RTLogLogger (pLogger, NULL, "eax=%08RX32 ecx=%08RX32 edx=%08RX32 ebx=%08RX32\n",652 pXcptCtx->Eax, pXcptCtx->Ecx, pXcptCtx->Edx, pXcptCtx->Ebx);653 RTLogLogger (pLogger, NULL, "esi=%08RX32 edi=%08RX32 esp=%08RX32 ebp=%08RX32\n",654 pXcptCtx->Esi, pXcptCtx->Edi, pXcptCtx->Esp, pXcptCtx->Ebp);655 RTLogLogger (pLogger, NULL, "ds=%04x es=%04x fs=%04x gs=%04x eflags=%08x\n",656 pXcptCtx->SegDs, pXcptCtx->SegEs, pXcptCtx->SegFs, pXcptCtx->SegGs, pXcptCtx->EFlags);649 RTLogLoggerWeak(pLogger, NULL, "\ncs:eip=%04x:%08RX32\n", pXcptCtx->SegCs, pXcptCtx->Eip); 650 RTLogLoggerWeak(pLogger, NULL, "ss:esp=%04x:%08RX32 ebp=%08RX32\n", pXcptCtx->SegSs, pXcptCtx->Esp, pXcptCtx->Ebp); 651 RTLogLoggerWeak(pLogger, NULL, "eax=%08RX32 ecx=%08RX32 edx=%08RX32 ebx=%08RX32\n", 652 pXcptCtx->Eax, pXcptCtx->Ecx, pXcptCtx->Edx, pXcptCtx->Ebx); 653 RTLogLoggerWeak(pLogger, NULL, "esi=%08RX32 edi=%08RX32 esp=%08RX32 ebp=%08RX32\n", 654 pXcptCtx->Esi, pXcptCtx->Edi, pXcptCtx->Esp, pXcptCtx->Ebp); 655 RTLogLoggerWeak(pLogger, NULL, "ds=%04x es=%04x fs=%04x gs=%04x eflags=%08x\n", 656 pXcptCtx->SegDs, pXcptCtx->SegEs, pXcptCtx->SegFs, pXcptCtx->SegGs, pXcptCtx->EFlags); 657 657 uXcptSP = pXcptCtx->Esp; 658 658 uXcptPC = pXcptCtx->Eip; … … 682 682 } 683 683 684 RTLogLogger (pLogger, NULL, "\nStack %p, dumping %#x bytes (low=%p, high=%p)\n", uStack, cbToDump, uLow, uHigh);685 RTLogLogger (pLogger, NULL, "%.*RhxD\n", cbToDump, uStack);684 RTLogLoggerWeak(pLogger, NULL, "\nStack %p, dumping %#x bytes (low=%p, high=%p)\n", uStack, cbToDump, uLow, uHigh); 685 RTLogLoggerWeak(pLogger, NULL, "%.*RhxD\n", cbToDump, uStack); 686 686 687 687 /* … … 691 691 * is why it's at the end. 692 692 */ 693 RTLogLogger (pLogger, NULL, "Thread ID: %p\n", RTThreadNativeSelf());694 RTLogLogger (pLogger, NULL, "Thread name: %s\n", RTThreadSelfName());695 RTLogLogger (pLogger, NULL, "Thread IPRT: %p\n", RTThreadSelf());693 RTLogLoggerWeak(pLogger, NULL, "Thread ID: %p\n", RTThreadNativeSelf()); 694 RTLogLoggerWeak(pLogger, NULL, "Thread name: %s\n", RTThreadSelfName()); 695 RTLogLoggerWeak(pLogger, NULL, "Thread IPRT: %p\n", RTThreadSelf()); 696 696 697 697 /* … … 708 708 LIST_ENTRY *pListEntry = pList->Flink; 709 709 uint32_t cLoops = 0; 710 RTLogLogger (pLogger, NULL,711 "\nLoaded Modules:\n"712 "%-*s[*] Timestamp Path\n", sizeof(void *) * 4 + 2 - 1, "Address range"713 );710 RTLogLoggerWeak(pLogger, NULL, 711 "\nLoaded Modules:\n" 712 "%-*s[*] Timestamp Path\n", sizeof(void *) * 4 + 2 - 1, "Address range" 713 ); 714 714 while (pListEntry != pList && RT_VALID_PTR(pListEntry) && cLoops < 1024) 715 715 { … … 728 728 && (pLdrEntry->FullDllName.Length & 1) == 0 729 729 && pLdrEntry->FullDllName.Length <= pLdrEntry->FullDllName.MaximumLength) 730 RTLogLogger (pLogger, NULL, "%p..%p%c %08RX32 %.*ls\n",731 pLdrEntry->DllBase, (uintptr_t)pLdrEntry->DllBase + cbLength - 1, chInd,732 pLdrEntry->TimeDateStamp, pLdrEntry->FullDllName.Length / sizeof(RTUTF16),733 pLdrEntry->FullDllName.Buffer);730 RTLogLoggerWeak(pLogger, NULL, "%p..%p%c %08RX32 %.*ls\n", 731 pLdrEntry->DllBase, (uintptr_t)pLdrEntry->DllBase + cbLength - 1, chInd, 732 pLdrEntry->TimeDateStamp, pLdrEntry->FullDllName.Length / sizeof(RTUTF16), 733 pLdrEntry->FullDllName.Buffer); 734 734 else 735 RTLogLogger (pLogger, NULL, "%p..%p%c %08RX32 <bad or missing: %p LB %#x max %#x\n",736 pLdrEntry->DllBase, (uintptr_t)pLdrEntry->DllBase + cbLength - 1, chInd,737 pLdrEntry->TimeDateStamp, pLdrEntry->FullDllName.Buffer, pLdrEntry->FullDllName.Length,738 pLdrEntry->FullDllName.MaximumLength);735 RTLogLoggerWeak(pLogger, NULL, "%p..%p%c %08RX32 <bad or missing: %p LB %#x max %#x\n", 736 pLdrEntry->DllBase, (uintptr_t)pLdrEntry->DllBase + cbLength - 1, chInd, 737 pLdrEntry->TimeDateStamp, pLdrEntry->FullDllName.Buffer, pLdrEntry->FullDllName.Length, 738 pLdrEntry->FullDllName.MaximumLength); 739 739 740 740 /* advance */ … … 749 749 && uXcptSP - uStack < cbToDump) 750 750 { 751 RTLogLogger (pLogger, NULL, "\nPotential code addresses on the stack:\n");751 RTLogLoggerWeak(pLogger, NULL, "\nPotential code addresses on the stack:\n"); 752 752 if (pFound) 753 753 { … … 757 757 && (pFound->FullDllName.Length & 1) == 0 758 758 && pFound->FullDllName.Length <= pFound->FullDllName.MaximumLength) 759 RTLogLogger (pLogger, NULL, "%-*s: %p - %#010RX32 bytes into %.*ls\n",760 sizeof(void *) * 2, "Xcpt PC", uXcptPC, (uint32_t)(uXcptPC - (uintptr_t)pFound->DllBase),761 pFound->FullDllName.Length / sizeof(RTUTF16), pFound->FullDllName.Buffer);759 RTLogLoggerWeak(pLogger, NULL, "%-*s: %p - %#010RX32 bytes into %.*ls\n", 760 sizeof(void *) * 2, "Xcpt PC", uXcptPC, (uint32_t)(uXcptPC - (uintptr_t)pFound->DllBase), 761 pFound->FullDllName.Length / sizeof(RTUTF16), pFound->FullDllName.Buffer); 762 762 else 763 RTLogLogger (pLogger, NULL, "%-*s: %p - %08RX32 into module at %p\n",764 sizeof(void *) * 2, "Xcpt PC", uXcptPC, (uint32_t)(uXcptPC - (uintptr_t)pFound->DllBase),765 pFound->DllBase);763 RTLogLoggerWeak(pLogger, NULL, "%-*s: %p - %08RX32 into module at %p\n", 764 sizeof(void *) * 2, "Xcpt PC", uXcptPC, (uint32_t)(uXcptPC - (uintptr_t)pFound->DllBase), 765 pFound->DllBase); 766 766 } 767 767 … … 799 799 && (pFound->FullDllName.Length & 1) == 0 800 800 && pFound->FullDllName.Length <= pFound->FullDllName.MaximumLength) 801 RTLogLogger (pLogger, NULL, "%p: %p - %#010RX32 bytes into %.*ls\n",802 puStack, uPtr, (uint32_t)(uPtr - (uintptr_t)pFound->DllBase),803 pFound->FullDllName.Length / sizeof(RTUTF16), pFound->FullDllName.Buffer);801 RTLogLoggerWeak(pLogger, NULL, "%p: %p - %#010RX32 bytes into %.*ls\n", 802 puStack, uPtr, (uint32_t)(uPtr - (uintptr_t)pFound->DllBase), 803 pFound->FullDllName.Length / sizeof(RTUTF16), pFound->FullDllName.Buffer); 804 804 else 805 RTLogLogger (pLogger, NULL, "%p: %p - %08RX32 into module at %p\n",806 puStack, uPtr, (uint32_t)(uPtr - (uintptr_t)pFound->DllBase), pFound->DllBase);805 RTLogLoggerWeak(pLogger, NULL, "%p: %p - %08RX32 into module at %p\n", 806 puStack, uPtr, (uint32_t)(uPtr - (uintptr_t)pFound->DllBase), pFound->DllBase); 807 807 } 808 808 } … … 824 824 && !(pProcParams->CommandLine.Length & 1) 825 825 && !(pProcParams->CommandLine.MaximumLength & 1)) 826 RTLogLogger (pLogger, NULL, "PEB/CommandLine: %.*ls\n",827 pProcParams->CommandLine.Length / sizeof(RTUTF16), pProcParams->CommandLine.Buffer);826 RTLogLoggerWeak(pLogger, NULL, "PEB/CommandLine: %.*ls\n", 827 pProcParams->CommandLine.Length / sizeof(RTUTF16), pProcParams->CommandLine.Buffer); 828 828 } 829 829 }
Note:
See TracChangeset
for help on using the changeset viewer.