mirror of
https://github.com/reactos/reactos.git
synced 2024-09-06 02:37:06 +00:00
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
This commit is contained in:
parent
15539c1521
commit
63981fc041
|
@ -83,13 +83,19 @@ SetUnhandledExceptionFilter(
|
||||||
* The address can point to anywhere within the module.
|
* The address can point to anywhere within the module.
|
||||||
*/
|
*/
|
||||||
static const char*
|
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;
|
MEMORY_BASIC_INFORMATION mbi;
|
||||||
if (VirtualQuery(addr, &mbi, sizeof(mbi)) != sizeof(mbi) ||
|
if (VirtualQuery(addr, &mbi, sizeof(mbi)) != sizeof(mbi) ||
|
||||||
!GetModuleFileNameA((HMODULE)mbi.AllocationBase, psz, nChars))
|
!GetModuleFileNameA((HMODULE)mbi.AllocationBase, psz, nChars))
|
||||||
{
|
{
|
||||||
psz[0] = '\0';
|
psz[0] = '\0';
|
||||||
|
*module_start_addr = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
*module_start_addr = (void *)mbi.AllocationBase;
|
||||||
}
|
}
|
||||||
return psz;
|
return psz;
|
||||||
}
|
}
|
||||||
|
@ -152,26 +158,30 @@ UnhandledExceptionFilter(struct _EXCEPTION_POINTERS *ExceptionInfo)
|
||||||
{
|
{
|
||||||
#ifdef _X86_
|
#ifdef _X86_
|
||||||
PULONG Frame;
|
PULONG Frame;
|
||||||
|
PVOID StartAddr;
|
||||||
CHAR szMod[128] = "";
|
CHAR szMod[128] = "";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Print a stack trace. */
|
/* Print a stack trace. */
|
||||||
DPRINT1("Unhandled exception\n");
|
DbgPrint("Unhandled exception\n");
|
||||||
DPRINT1("Address:\n");
|
DbgPrint("Address:\n");
|
||||||
DPRINT1(" %8x %s\n",
|
DbgPrint(" %8x %s\n",
|
||||||
ExceptionInfo->ExceptionRecord->ExceptionAddress,
|
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 );
|
_dump_context ( ExceptionInfo->ContextRecord );
|
||||||
#ifdef _X86_
|
#ifdef _X86_
|
||||||
DPRINT1("Frames:\n");
|
DbgPrint("Frames:\n");
|
||||||
Frame = (PULONG)ExceptionInfo->ContextRecord->Ebp;
|
Frame = (PULONG)ExceptionInfo->ContextRecord->Ebp;
|
||||||
while (Frame[1] != 0 && Frame[1] != 0xdeadbeef)
|
while (Frame[1] != 0 && Frame[1] != 0xdeadbeef)
|
||||||
{
|
{
|
||||||
if (IsBadReadPtr((PVOID)Frame[1], 4)) {
|
if (IsBadReadPtr((PVOID)Frame[1], 4)) {
|
||||||
DPRINT1(" %8x %s\n", Frame[1], "<invalid address>");
|
DbgPrint(" %8x%9s %s\n", Frame[1], "<invalid address>"," ");
|
||||||
} else {
|
} else {
|
||||||
_module_name_from_addr((const void*)Frame[1], szMod, sizeof(szMod));
|
_module_name_from_addr((const void*)Frame[1], &StartAddr,
|
||||||
DPRINT1(" %8x %s\n", Frame[1], szMod);
|
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)) {
|
if (IsBadReadPtr((PVOID)Frame[0], sizeof(*Frame) * 2)) {
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue