From 63981fc041059e60ae12ba31be5be57643046d1c Mon Sep 17 00:00:00 2001 From: Art Yerkes Date: Mon, 7 Mar 2005 16:37:49 +0000 Subject: [PATCH] Changed exception format in kernel32 slightly to make the offset of the addresses apparent. Made a change suggested by ion, to remove the line numbers of the lines printing the stack trace. svn path=/trunk/; revision=13867 --- reactos/lib/kernel32/except/except.c | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/reactos/lib/kernel32/except/except.c b/reactos/lib/kernel32/except/except.c index a02b159ab40..e7364cc53dc 100644 --- a/reactos/lib/kernel32/except/except.c +++ b/reactos/lib/kernel32/except/except.c @@ -83,13 +83,19 @@ SetUnhandledExceptionFilter( * The address can point to anywhere within the module. */ static const char* -_module_name_from_addr(const void* addr, char* psz, size_t nChars) +_module_name_from_addr(const void* addr, void **module_start_addr, + char* psz, size_t nChars) { MEMORY_BASIC_INFORMATION mbi; if (VirtualQuery(addr, &mbi, sizeof(mbi)) != sizeof(mbi) || !GetModuleFileNameA((HMODULE)mbi.AllocationBase, psz, nChars)) { psz[0] = '\0'; + *module_start_addr = 0; + } + else + { + *module_start_addr = (void *)mbi.AllocationBase; } return psz; } @@ -152,26 +158,30 @@ UnhandledExceptionFilter(struct _EXCEPTION_POINTERS *ExceptionInfo) { #ifdef _X86_ PULONG Frame; + PVOID StartAddr; CHAR szMod[128] = ""; #endif /* Print a stack trace. */ - DPRINT1("Unhandled exception\n"); - DPRINT1("Address:\n"); - DPRINT1(" %8x %s\n", + DbgPrint("Unhandled exception\n"); + DbgPrint("Address:\n"); + DbgPrint(" %8x %s\n", ExceptionInfo->ExceptionRecord->ExceptionAddress, - _module_name_from_addr(ExceptionInfo->ExceptionRecord->ExceptionAddress, szMod, sizeof(szMod))); + _module_name_from_addr(ExceptionInfo->ExceptionRecord->ExceptionAddress, &StartAddr, szMod, sizeof(szMod))); _dump_context ( ExceptionInfo->ContextRecord ); #ifdef _X86_ - DPRINT1("Frames:\n"); + DbgPrint("Frames:\n"); Frame = (PULONG)ExceptionInfo->ContextRecord->Ebp; while (Frame[1] != 0 && Frame[1] != 0xdeadbeef) { if (IsBadReadPtr((PVOID)Frame[1], 4)) { - DPRINT1(" %8x %s\n", Frame[1], ""); + DbgPrint(" %8x%9s %s\n", Frame[1], ""," "); } else { - _module_name_from_addr((const void*)Frame[1], szMod, sizeof(szMod)); - DPRINT1(" %8x %s\n", Frame[1], szMod); + _module_name_from_addr((const void*)Frame[1], &StartAddr, + szMod, sizeof(szMod)); + DbgPrint(" %8x+%-8x %s\n", + (PVOID)StartAddr, + (ULONG_PTR)Frame[1] - (ULONG_PTR)StartAddr, szMod); } if (IsBadReadPtr((PVOID)Frame[0], sizeof(*Frame) * 2)) { break;