Skip to content

Commit 771bf47

Browse files
committed
Added callstack on crash for windows (linux shortly ...)
1 parent 27dbe2a commit 771bf47

File tree

4 files changed

+23
-3
lines changed

4 files changed

+23
-3
lines changed

Source/Server.DarkSouls2/Server/GameService/GameManagers/Bloodstain/DS2_BloodstainManager.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ MessageHandleResult DS2_BloodstainManager::Handle_RequestGetDeadingGhost(GameCli
271271
// Doesn't exist, no go.
272272
else
273273
{
274-
WarningS(Client->GetName().c_str(), "Failed to retrieve bloodstain '%i'", Request->bloodstain_id());
274+
WarningS(Client->GetName().c_str(), "Failed to retrieve bloodstain '%u'", Request->bloodstain_id());
275275
}
276276

277277
DS2_Frpg2RequestMessage::RequestGetDeadingGhostResponse Response;

Source/Server.DarkSouls3/Server/GameService/GameManagers/Bloodstain/DS3_BloodstainManager.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ MessageHandleResult DS3_BloodstainManager::Handle_RequestGetDeadingGhost(GameCli
225225
// Doesn't exist, no go.
226226
else
227227
{
228-
WarningS(Client->GetName().c_str(), "Failed to retrieve bloodstain '%i', returning empty ghost data.", Request->bloodstain_id());
228+
WarningS(Client->GetName().c_str(), "Failed to retrieve bloodstain '%u', returning empty ghost data.", Request->bloodstain_id());
229229
}
230230

231231
DS3_Frpg2RequestMessage::RequestGetDeadingGhostResponse Response;

Source/Server/Server/Database/ServerDatabase.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ bool ServerDatabase::RunStatement(const std::string& sql, const std::vector<Data
190190
sqlite3_stmt* statement = nullptr;
191191
if (int result = sqlite3_prepare_v2(db_handle, sql.c_str(), (int)sql.length(), &statement, nullptr); result != SQLITE_OK)
192192
{
193-
Error("sqlite3_prepare_v2 failed with error: %s", sqlite3_errstr(result));
193+
Error("sqlite3_prepare_v2 (%s) failed with error: %s", sql.c_str(), sqlite3_errstr(result));
194194
return false;
195195
}
196196
for (int i = 0; i < Values.size(); i++)

Source/Shared/Platform/Win32/Win32Platform.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,30 @@ struct Win32CtrlSignalHandler
5656

5757
} gWin32CtrlSignalHandler;
5858

59+
LONG WINAPI ExceptionHandler(PEXCEPTION_POINTERS pExceptionInfo)
60+
{
61+
Log("================== Crash Log ==================");
62+
63+
std::unique_ptr<Callstack> Stack = CaptureCallstack(1);
64+
for (auto& Frame : Stack->Frames)
65+
{
66+
Log("0x%016p %-30s %s@%zi",
67+
Frame.Address,
68+
Frame.Function.empty() ? "<unknown>" : Frame.Function.c_str(),
69+
Frame.Filename.empty() ? "<unknown>" : Frame.Filename.c_str(),
70+
Frame.Line
71+
);
72+
}
73+
74+
return EXCEPTION_CONTINUE_SEARCH;
75+
}
76+
5977
bool PlatformInit()
6078
{
6179
LoadSymbols();
6280

81+
SetUnhandledExceptionFilter(ExceptionHandler);
82+
6383
WSADATA wsaData;
6484
if (int Result = WSAStartup(MAKEWORD(2, 2), &wsaData); Result != 0)
6585
{

0 commit comments

Comments
 (0)