mirror of
https://github.com/amadvance/snapraid.git
synced 2026-10-25 18:40:19 -04:00
Print abort stacktrace to stderr and exit with code 134 on Windows
This commit is contained in:
parent
5b402fc462
commit
70947d4054
1 changed files with 13 additions and 12 deletions
25
os/mingw.c
25
os/mingw.c
|
|
@ -4537,26 +4537,27 @@ void os_abort(void)
|
|||
size_t size;
|
||||
unsigned i;
|
||||
|
||||
printf("Stacktrace of " PACKAGE " v" VERSION);
|
||||
printf(", mingw");
|
||||
fprintf(stderr, "Stacktrace of " PACKAGE " v" VERSION);
|
||||
fprintf(stderr, ", mingw");
|
||||
#ifdef __GNUC__
|
||||
printf(", gcc " __VERSION__);
|
||||
fprintf(stderr, ", gcc " __VERSION__);
|
||||
#endif
|
||||
printf(", %d-bit", (int)sizeof(void*) * 8);
|
||||
printf(", PATH_MAX=%d", PATH_MAX);
|
||||
printf("\n");
|
||||
fprintf(stderr, ", %d-bit", (int)sizeof(void*) * 8);
|
||||
fprintf(stderr, ", PATH_MAX=%d", PATH_MAX);
|
||||
fprintf(stderr, "\n");
|
||||
|
||||
/* get stackstrace, but without symbols */
|
||||
size = CaptureStackBackTrace(0, 32, stack, NULL);
|
||||
size = CaptureStackBackTrace(0, 32, stack, 0);
|
||||
|
||||
for (i = 0; i < size; ++i)
|
||||
printf("[bt] %02u: %p\n", i, stack[i]);
|
||||
fprintf(stderr, "[bt] %02u: %p\n", i, stack[i]);
|
||||
|
||||
printf("Please report this error to the SnapRAID Issues:\n");
|
||||
printf("https://github.com/amadvance/snapraid/issues\n");
|
||||
fprintf(stderr, "Please report this error to the SnapRAID Issues:\n");
|
||||
fprintf(stderr, "https://github.com/amadvance/snapraid/issues\n");
|
||||
fflush(stderr);
|
||||
|
||||
/* use exit() and not abort to avoid the Windows abort dialog */
|
||||
os_exit();
|
||||
/* use exit(134) (128 + SIGABRT) and not abort to avoid the Windows abort dialog while distinguishing abort from normal failure */
|
||||
exit(134);
|
||||
}
|
||||
|
||||
void os_exit(void)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue