mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-19 04:26:52 -04:00
Commit SHA in error log
This commit is contained in:
parent
2984d7ff26
commit
2acb32c1cd
@ -76,6 +76,10 @@ typedef struct Bitmap_ { uint8_t* Scan0; int Width, Height; } Bitmap;
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef CC_COMMIT_SHA
|
||||||
|
#define CC_COMMIT_SHA "Unknown"
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef CC_BUILD_D3D9
|
#ifdef CC_BUILD_D3D9
|
||||||
typedef void* GfxResourceID;
|
typedef void* GfxResourceID;
|
||||||
#define GFX_NULL NULL
|
#define GFX_NULL NULL
|
||||||
|
@ -27,7 +27,7 @@ static int ErrorHandler_GetFrames(CONTEXT* ctx, struct StackPointers* pointers,
|
|||||||
STACKFRAME frame = { 0 };
|
STACKFRAME frame = { 0 };
|
||||||
frame.AddrPC.Mode = AddrModeFlat;
|
frame.AddrPC.Mode = AddrModeFlat;
|
||||||
frame.AddrFrame.Mode = AddrModeFlat;
|
frame.AddrFrame.Mode = AddrModeFlat;
|
||||||
frame.AddrStack.Mode = AddrModeFlat;
|
frame.AddrStack.Mode = AddrModeFlat;
|
||||||
DWORD type;
|
DWORD type;
|
||||||
|
|
||||||
#ifdef _M_IX86
|
#ifdef _M_IX86
|
||||||
@ -56,7 +56,7 @@ static int ErrorHandler_GetFrames(CONTEXT* ctx, struct StackPointers* pointers,
|
|||||||
int count;
|
int count;
|
||||||
CONTEXT copy = *ctx;
|
CONTEXT copy = *ctx;
|
||||||
|
|
||||||
for (count = 0; count < max; count++) {
|
for (count = 0; count < max; count++) {
|
||||||
if (!StackWalk(type, process, thread, &frame, ©, NULL, SymFunctionTableAccess, SymGetModuleBase, NULL)) break;
|
if (!StackWalk(type, process, thread, &frame, ©, NULL, SymFunctionTableAccess, SymGetModuleBase, NULL)) break;
|
||||||
if (!frame.AddrFrame.Offset) break;
|
if (!frame.AddrFrame.Offset) break;
|
||||||
|
|
||||||
@ -140,7 +140,7 @@ static void ErrorHandler_DumpRegisters(CONTEXT* ctx) {
|
|||||||
String str = String_FromArray(strBuffer);
|
String str = String_FromArray(strBuffer);
|
||||||
String_AppendConst(&str, "-- registers --\r\n");
|
String_AppendConst(&str, "-- registers --\r\n");
|
||||||
|
|
||||||
#ifdef _M_IX86
|
#ifdef _M_IX86
|
||||||
String_Format3(&str, "eax=%x ebx=%x ecx=%x\r\n", &ctx->Eax, &ctx->Ebx, &ctx->Ecx);
|
String_Format3(&str, "eax=%x ebx=%x ecx=%x\r\n", &ctx->Eax, &ctx->Ebx, &ctx->Ecx);
|
||||||
String_Format3(&str, "edx=%x esi=%x edi=%x\r\n", &ctx->Edx, &ctx->Esi, &ctx->Edi);
|
String_Format3(&str, "edx=%x esi=%x edi=%x\r\n", &ctx->Edx, &ctx->Esi, &ctx->Edi);
|
||||||
String_Format3(&str, "eip=%x ebp=%x esp=%x\r\n", &ctx->Eip, &ctx->Ebp, &ctx->Esp);
|
String_Format3(&str, "eip=%x ebp=%x esp=%x\r\n", &ctx->Eip, &ctx->Ebp, &ctx->Esp);
|
||||||
@ -210,12 +210,12 @@ void ErrorHandler_Fail2(ReturnCode result, const char* raw_msg) {
|
|||||||
/* [ebp] is previous frame's EBP */
|
/* [ebp] is previous frame's EBP */
|
||||||
/* [ebp+4] is previous frame's EIP (return address) */
|
/* [ebp+4] is previous frame's EIP (return address) */
|
||||||
/* address of [ebp+8] is previous frame's ESP */
|
/* address of [ebp+8] is previous frame's ESP */
|
||||||
__asm {
|
__asm {
|
||||||
mov eax, [ebp]
|
mov eax, [ebp]
|
||||||
mov [ctx.Ebp], eax
|
mov [ctx.Ebp], eax
|
||||||
mov eax, [ebp+4]
|
mov eax, [ebp+4]
|
||||||
mov [ctx.Eip], eax
|
mov [ctx.Eip], eax
|
||||||
lea eax, [ebp+8]
|
lea eax, [ebp+8]
|
||||||
mov [ctx.Esp], eax
|
mov [ctx.Esp], eax
|
||||||
mov [ctx.ContextFlags], CONTEXT_CONTROL
|
mov [ctx.ContextFlags], CONTEXT_CONTROL
|
||||||
}
|
}
|
||||||
@ -641,8 +641,10 @@ static void ErrorHandler_FailCommon(ReturnCode result, const char* raw_msg, void
|
|||||||
String msg = String_NT_Array(msgBuffer);
|
String msg = String_NT_Array(msgBuffer);
|
||||||
|
|
||||||
String_Format3(&msg, "ClassiCube crashed.%cMessage: %c%c", Platform_NewLine, raw_msg, Platform_NewLine);
|
String_Format3(&msg, "ClassiCube crashed.%cMessage: %c%c", Platform_NewLine, raw_msg, Platform_NewLine);
|
||||||
if (result) {
|
String_Format2(&msg, "Commit SHA: %c%c", CC_COMMIT_SHA, Platform_NewLine);
|
||||||
String_Format2(&msg, "%h%c", &result, Platform_NewLine);
|
|
||||||
|
if (result) {
|
||||||
|
String_Format2(&msg, "%h%c", &result, Platform_NewLine);
|
||||||
} else { result = 1; }
|
} else { result = 1; }
|
||||||
|
|
||||||
ErrorHandler_Log(&msg);
|
ErrorHandler_Log(&msg);
|
||||||
|
@ -3,6 +3,7 @@ LIBS=-lGL -lcurl -lopenal -lpthread -lX11 -lm
|
|||||||
CFLAGS=-g -w -no-pie
|
CFLAGS=-g -w -no-pie
|
||||||
SOURCES=$(wildcard *.c)
|
SOURCES=$(wildcard *.c)
|
||||||
OBJECTS=$(patsubst %.c, %.o, $(SOURCES))
|
OBJECTS=$(patsubst %.c, %.o, $(SOURCES))
|
||||||
|
COMMITSHA=$(shell git rev-parse HEAD | cut -c '1-7')
|
||||||
|
|
||||||
EXECUTABLE=ClassiCube
|
EXECUTABLE=ClassiCube
|
||||||
|
|
||||||
@ -10,7 +11,7 @@ $(EXECUTABLE): $(OBJECTS)
|
|||||||
$(CC) $(CFLAGS) -o $@ $(OBJECTS) $(LIBS)
|
$(CC) $(CFLAGS) -o $@ $(OBJECTS) $(LIBS)
|
||||||
|
|
||||||
$(OBJECTS): %.o : %.c
|
$(OBJECTS): %.o : %.c
|
||||||
$(CC) $(CFLAGS) -c $< $(LIBS) -o $@
|
$(CC) $(CFLAGS) -DCC_COMMIT_SHA=\"$(COMMITSHA)\" -c $< $(LIBS) -o $@
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f $(EXECUTABLE) $(OBJECTS)
|
rm -f $(EXECUTABLE) $(OBJECTS)
|
||||||
|
@ -71,7 +71,7 @@ int main(int argc, char** argv) {
|
|||||||
String_Format1(&defPath, "texpacks%rdefault.zip", &Directory_Separator);
|
String_Format1(&defPath, "texpacks%rdefault.zip", &Directory_Separator);
|
||||||
|
|
||||||
if (!File_Exists(&defPath)) {
|
if (!File_Exists(&defPath)) {
|
||||||
ErrorHandler_ShowDialog("Missing file",
|
ErrorHandler_ShowDialog("Missing file",
|
||||||
"default.zip is missing, try running launcher first.\n\nThe game will still run, but without any textures");
|
"default.zip is missing, try running launcher first.\n\nThe game will still run, but without any textures");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -88,12 +88,12 @@ int main(int argc, char** argv) {
|
|||||||
String_Copy(&Game_Username, &args[0]);
|
String_Copy(&Game_Username, &args[0]);
|
||||||
String_Copy(&Game_Mppass, &args[1]);
|
String_Copy(&Game_Mppass, &args[1]);
|
||||||
String_Copy(&Game_IPAddress, &args[2]);
|
String_Copy(&Game_IPAddress, &args[2]);
|
||||||
|
|
||||||
if (!Utils_ParseIP(&args[2], ip)) {
|
if (!Utils_ParseIP(&args[2], ip)) {
|
||||||
ErrorHandler_ShowDialog("Failed to start", "Invalid IP");
|
ErrorHandler_ShowDialog("Failed to start", "Invalid IP");
|
||||||
Platform_Exit(1); return 1;
|
Platform_Exit(1); return 1;
|
||||||
}
|
}
|
||||||
if (!Convert_TryParseUInt16(&args[3], &port)) {
|
if (!Convert_TryParseUInt16(&args[3], &port)) {
|
||||||
ErrorHandler_ShowDialog("Failed to start", "Invalid port");
|
ErrorHandler_ShowDialog("Failed to start", "Invalid port");
|
||||||
Platform_Exit(1); return 1;
|
Platform_Exit(1); return 1;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user