mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-06 20:32:19 +00:00
Reindent.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117538 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
7e2fe9150f
commit
6d8ac5ac6d
@ -214,81 +214,81 @@ static LONG WINAPI LLVMUnhandledExceptionFilter(LPEXCEPTION_POINTERS ep) {
|
|||||||
// TODO: provide a x64 friendly version of the following
|
// TODO: provide a x64 friendly version of the following
|
||||||
#else
|
#else
|
||||||
|
|
||||||
// Initialize the STACKFRAME structure.
|
// Initialize the STACKFRAME structure.
|
||||||
STACKFRAME StackFrame;
|
STACKFRAME StackFrame;
|
||||||
memset(&StackFrame, 0, sizeof(StackFrame));
|
memset(&StackFrame, 0, sizeof(StackFrame));
|
||||||
|
|
||||||
StackFrame.AddrPC.Offset = ep->ContextRecord->Eip;
|
StackFrame.AddrPC.Offset = ep->ContextRecord->Eip;
|
||||||
StackFrame.AddrPC.Mode = AddrModeFlat;
|
StackFrame.AddrPC.Mode = AddrModeFlat;
|
||||||
StackFrame.AddrStack.Offset = ep->ContextRecord->Esp;
|
StackFrame.AddrStack.Offset = ep->ContextRecord->Esp;
|
||||||
StackFrame.AddrStack.Mode = AddrModeFlat;
|
StackFrame.AddrStack.Mode = AddrModeFlat;
|
||||||
StackFrame.AddrFrame.Offset = ep->ContextRecord->Ebp;
|
StackFrame.AddrFrame.Offset = ep->ContextRecord->Ebp;
|
||||||
StackFrame.AddrFrame.Mode = AddrModeFlat;
|
StackFrame.AddrFrame.Mode = AddrModeFlat;
|
||||||
|
|
||||||
HANDLE hProcess = GetCurrentProcess();
|
HANDLE hProcess = GetCurrentProcess();
|
||||||
HANDLE hThread = GetCurrentThread();
|
HANDLE hThread = GetCurrentThread();
|
||||||
|
|
||||||
// Initialize the symbol handler.
|
// Initialize the symbol handler.
|
||||||
SymSetOptions(SYMOPT_DEFERRED_LOADS|SYMOPT_LOAD_LINES);
|
SymSetOptions(SYMOPT_DEFERRED_LOADS|SYMOPT_LOAD_LINES);
|
||||||
SymInitialize(hProcess, NULL, TRUE);
|
SymInitialize(hProcess, NULL, TRUE);
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
if (!StackWalk(IMAGE_FILE_MACHINE_I386, hProcess, hThread, &StackFrame,
|
if (!StackWalk(IMAGE_FILE_MACHINE_I386, hProcess, hThread, &StackFrame,
|
||||||
ep->ContextRecord, NULL, SymFunctionTableAccess,
|
ep->ContextRecord, NULL, SymFunctionTableAccess,
|
||||||
SymGetModuleBase, NULL)) {
|
SymGetModuleBase, NULL)) {
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
if (StackFrame.AddrFrame.Offset == 0)
|
|
||||||
break;
|
|
||||||
|
|
||||||
// Print the PC in hexadecimal.
|
|
||||||
DWORD PC = StackFrame.AddrPC.Offset;
|
|
||||||
fprintf(stderr, "%08lX", PC);
|
|
||||||
|
|
||||||
// Print the parameters. Assume there are four.
|
|
||||||
fprintf(stderr, " (0x%08lX 0x%08lX 0x%08lX 0x%08lX)",
|
|
||||||
StackFrame.Params[0],
|
|
||||||
StackFrame.Params[1], StackFrame.Params[2], StackFrame.Params[3]);
|
|
||||||
|
|
||||||
// Verify the PC belongs to a module in this process.
|
|
||||||
if (!SymGetModuleBase(hProcess, PC)) {
|
|
||||||
fputs(" <unknown module>\n", stderr);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Print the symbol name.
|
|
||||||
char buffer[512];
|
|
||||||
IMAGEHLP_SYMBOL *symbol = reinterpret_cast<IMAGEHLP_SYMBOL *>(buffer);
|
|
||||||
memset(symbol, 0, sizeof(IMAGEHLP_SYMBOL));
|
|
||||||
symbol->SizeOfStruct = sizeof(IMAGEHLP_SYMBOL);
|
|
||||||
symbol->MaxNameLength = 512 - sizeof(IMAGEHLP_SYMBOL);
|
|
||||||
|
|
||||||
DWORD dwDisp;
|
|
||||||
if (!SymGetSymFromAddr(hProcess, PC, &dwDisp, symbol)) {
|
|
||||||
fputc('\n', stderr);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
buffer[511] = 0;
|
|
||||||
if (dwDisp > 0)
|
|
||||||
fprintf(stderr, ", %s()+%04lu bytes(s)", symbol->Name, dwDisp);
|
|
||||||
else
|
|
||||||
fprintf(stderr, ", %s", symbol->Name);
|
|
||||||
|
|
||||||
// Print the source file and line number information.
|
|
||||||
IMAGEHLP_LINE line;
|
|
||||||
memset(&line, 0, sizeof(line));
|
|
||||||
line.SizeOfStruct = sizeof(line);
|
|
||||||
if (SymGetLineFromAddr(hProcess, PC, &dwDisp, &line)) {
|
|
||||||
fprintf(stderr, ", %s, line %lu", line.FileName, line.LineNumber);
|
|
||||||
if (dwDisp > 0)
|
|
||||||
fprintf(stderr, "+%04lu byte(s)", dwDisp);
|
|
||||||
}
|
|
||||||
|
|
||||||
fputc('\n', stderr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (StackFrame.AddrFrame.Offset == 0)
|
||||||
|
break;
|
||||||
|
|
||||||
|
// Print the PC in hexadecimal.
|
||||||
|
DWORD PC = StackFrame.AddrPC.Offset;
|
||||||
|
fprintf(stderr, "%08lX", PC);
|
||||||
|
|
||||||
|
// Print the parameters. Assume there are four.
|
||||||
|
fprintf(stderr, " (0x%08lX 0x%08lX 0x%08lX 0x%08lX)",
|
||||||
|
StackFrame.Params[0],
|
||||||
|
StackFrame.Params[1], StackFrame.Params[2], StackFrame.Params[3]);
|
||||||
|
|
||||||
|
// Verify the PC belongs to a module in this process.
|
||||||
|
if (!SymGetModuleBase(hProcess, PC)) {
|
||||||
|
fputs(" <unknown module>\n", stderr);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Print the symbol name.
|
||||||
|
char buffer[512];
|
||||||
|
IMAGEHLP_SYMBOL *symbol = reinterpret_cast<IMAGEHLP_SYMBOL *>(buffer);
|
||||||
|
memset(symbol, 0, sizeof(IMAGEHLP_SYMBOL));
|
||||||
|
symbol->SizeOfStruct = sizeof(IMAGEHLP_SYMBOL);
|
||||||
|
symbol->MaxNameLength = 512 - sizeof(IMAGEHLP_SYMBOL);
|
||||||
|
|
||||||
|
DWORD dwDisp;
|
||||||
|
if (!SymGetSymFromAddr(hProcess, PC, &dwDisp, symbol)) {
|
||||||
|
fputc('\n', stderr);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
buffer[511] = 0;
|
||||||
|
if (dwDisp > 0)
|
||||||
|
fprintf(stderr, ", %s()+%04lu bytes(s)", symbol->Name, dwDisp);
|
||||||
|
else
|
||||||
|
fprintf(stderr, ", %s", symbol->Name);
|
||||||
|
|
||||||
|
// Print the source file and line number information.
|
||||||
|
IMAGEHLP_LINE line;
|
||||||
|
memset(&line, 0, sizeof(line));
|
||||||
|
line.SizeOfStruct = sizeof(line);
|
||||||
|
if (SymGetLineFromAddr(hProcess, PC, &dwDisp, &line)) {
|
||||||
|
fprintf(stderr, ", %s, line %lu", line.FileName, line.LineNumber);
|
||||||
|
if (dwDisp > 0)
|
||||||
|
fprintf(stderr, "+%04lu byte(s)", dwDisp);
|
||||||
|
}
|
||||||
|
|
||||||
|
fputc('\n', stderr);
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (ExitOnUnhandledExceptions)
|
if (ExitOnUnhandledExceptions)
|
||||||
|
Loading…
Reference in New Issue
Block a user