mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-14 10:05:44 -04:00
Make stacktraces slightly smaller by avoiding 0x at start, also avoid redundantly logging Logger_Backtrace frame on macOS/iOS
Also fix for commands that specify to split arguments, 'argsCount' was still 1 when command arguments was empty string
This commit is contained in:
parent
543a991559
commit
85bca0cb23
@ -362,7 +362,7 @@ static void Commands_Execute(const cc_string* input) {
|
||||
cmd->Execute(&value, value.length != 0);
|
||||
} else {
|
||||
count = String_UNSAFE_Split(&value, ' ', args, Array_Elems(args));
|
||||
cmd->Execute(args, count);
|
||||
cmd->Execute(args, value.length ? count : 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -624,8 +624,7 @@ static void Cw_Callback_1(struct NbtTag* tag) {
|
||||
static void Cw_Callback_2(struct NbtTag* tag) {
|
||||
struct LocalPlayer* p = &LocalPlayer_Instance;
|
||||
|
||||
if (IsTag(tag->parent, "MapGenerator"))
|
||||
{
|
||||
if (IsTag(tag->parent, "MapGenerator")) {
|
||||
if (IsTag(tag, "Seed")) { World.Seed = NbtTag_I32(tag); return; }
|
||||
return;
|
||||
}
|
||||
|
11
src/Logger.c
11
src/Logger.c
@ -169,7 +169,7 @@ static void PrintFrame(cc_string* str, cc_uintptr addr, cc_uintptr symAddr, cons
|
||||
|
||||
module = String_FromReadonly(modName);
|
||||
Utils_UNSAFE_GetFilename(&module);
|
||||
String_Format2(str, "0x%x - %s", &addr, &module);
|
||||
String_Format2(str, "%x - %s", &addr, &module);
|
||||
|
||||
if (symName && symName[0]) {
|
||||
offset = (int)(addr - symAddr);
|
||||
@ -327,7 +327,10 @@ void Logger_Backtrace(cc_string* trace, void* ctx) {
|
||||
extern void thread_stack_pcs(void** buffer, unsigned max, unsigned* nb);
|
||||
|
||||
thread_stack_pcs(addrs, MAX_BACKTRACE_FRAMES, &frames);
|
||||
for (i = 1; i < frames; i++) { /* 1 to skip thread_stack_pcs frame */
|
||||
/* Skip frames don't want to include in backtrace */
|
||||
/* frame 0 = thread_stack_pcs */
|
||||
/* frame 1 = Logger_Backtrace */
|
||||
for (i = 2; i < frames; i++) {
|
||||
DumpFrame(trace, addrs[i]);
|
||||
}
|
||||
String_AppendConst(trace, _NL);
|
||||
@ -800,7 +803,7 @@ static LONG WINAPI UnhandledFilter(struct _EXCEPTION_POINTERS* info) {
|
||||
addr = (cc_uintptr)info->ExceptionRecord->ExceptionAddress;
|
||||
|
||||
String_InitArray_NT(msg, msgBuffer);
|
||||
String_Format2(&msg, "Unhandled exception 0x%h at 0x%x", &code, &addr);
|
||||
String_Format2(&msg, "Unhandled exception 0x%h at %x", &code, &addr);
|
||||
|
||||
numArgs = info->ExceptionRecord->NumberParameters;
|
||||
if (numArgs) {
|
||||
@ -885,7 +888,7 @@ static void SignalHandler(int sig, siginfo_t* info, void* ctx) {
|
||||
addr = (cc_uintptr)info->si_addr;
|
||||
|
||||
String_InitArray_NT(msg, msgBuffer);
|
||||
String_Format3(&msg, "Unhandled signal %i (code %i) at 0x%x", &type, &code, &addr);
|
||||
String_Format3(&msg, "Unhandled signal %i (code %i) at %x", &type, &code, &addr);
|
||||
msg.buffer[msg.length] = '\0';
|
||||
|
||||
#if defined CC_BUILD_ANDROID
|
||||
|
Loading…
x
Reference in New Issue
Block a user