mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-11-09 01:38:20 +00:00
Diagnostics: Fix error file (#1231)
This commit is contained in:
parent
23d71340c9
commit
22207ea9c9
@ -134,6 +134,10 @@ void CatchUnhandled(int sig) {
|
||||
// Loop through the returned addresses, and get the symbols to be demangled
|
||||
char** strings = backtrace_symbols(array, size);
|
||||
|
||||
FILE* file = fopen(fileName.c_str(), "w+");
|
||||
if (file != NULL) {
|
||||
fprintf(file, "Error: signal %d:\n", sig);
|
||||
}
|
||||
// Print the stack trace
|
||||
for (size_t i = 0; i < size; i++) {
|
||||
// Take a string like './WorldServer(_ZN19SlashCommandHandler17HandleChatCommandERKSbIDsSt11char_traitsIDsESaIDsEEP6EntityRK13SystemAddress+0x6187) [0x55869c44ecf7]'
|
||||
@ -155,19 +159,14 @@ void CatchUnhandled(int sig) {
|
||||
}
|
||||
|
||||
LOG("[%02zu] %s", i, functionName.c_str());
|
||||
if (file != NULL) {
|
||||
fprintf(file, "[%02zu] %s\n", i, functionName.c_str());
|
||||
}
|
||||
}
|
||||
# else // defined(__GNUG__)
|
||||
backtrace_symbols_fd(array, size, STDOUT_FILENO);
|
||||
# endif // defined(__GNUG__)
|
||||
|
||||
FILE* file = fopen(fileName.c_str(), "w+");
|
||||
if (file != NULL) {
|
||||
// print out all the frames to stderr
|
||||
fprintf(file, "Error: signal %d:\n", sig);
|
||||
backtrace_symbols_fd(array, size, fileno(file));
|
||||
fclose(file);
|
||||
}
|
||||
|
||||
#else // __include_backtrace__
|
||||
|
||||
struct backtrace_state* state = backtrace_create_state(
|
||||
|
Loading…
Reference in New Issue
Block a user