mirror of https://github.com/AxioDL/logvisor.git
Less jarring fatal abort for Windows
This commit is contained in:
parent
a190c5cfb6
commit
c839ce774c
|
@ -71,7 +71,7 @@ void RegisterThreadName(const char* name)
|
||||||
#include <DbgHelp.h>
|
#include <DbgHelp.h>
|
||||||
#pragma comment(lib, "Dbghelp.lib")
|
#pragma comment(lib, "Dbghelp.lib")
|
||||||
|
|
||||||
static void logvisorAbort()
|
void logvisorAbort()
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
void* stack[100];
|
void* stack[100];
|
||||||
|
@ -90,7 +90,7 @@ static void logvisorAbort()
|
||||||
{
|
{
|
||||||
SymFromAddr(process, (DWORD64)(stack[i]), 0, symbol);
|
SymFromAddr(process, (DWORD64)(stack[i]), 0, symbol);
|
||||||
|
|
||||||
printf("%i: %s - 0x%0llX", frames - i - 1, symbol->Name, symbol->Address);
|
fprintf(stderr, "%i: %s - 0x%0llX", frames - i - 1, symbol->Name, symbol->Address);
|
||||||
|
|
||||||
DWORD dwDisplacement;
|
DWORD dwDisplacement;
|
||||||
IMAGEHLP_LINE64 line;
|
IMAGEHLP_LINE64 line;
|
||||||
|
@ -100,19 +100,21 @@ static void logvisorAbort()
|
||||||
if (SymGetLineFromAddr64(process, (DWORD64)(stack[i]), &dwDisplacement, &line))
|
if (SymGetLineFromAddr64(process, (DWORD64)(stack[i]), &dwDisplacement, &line))
|
||||||
{
|
{
|
||||||
// SymGetLineFromAddr64 returned success
|
// SymGetLineFromAddr64 returned success
|
||||||
printf(" LINE %d\n", line.LineNumber);
|
fprintf(stderr, " LINE %d\n", line.LineNumber);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
printf("\n");
|
fprintf(stderr, "\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fflush(stderr);
|
||||||
free(symbol);
|
free(symbol);
|
||||||
|
|
||||||
// If you caught one of the above signals, it is likely you just
|
// If you caught one of the above signals, it is likely you just
|
||||||
// want to quit your program right now.
|
// want to quit your program right now.
|
||||||
abort();
|
system("PAUSE");
|
||||||
|
exit(1);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue