mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-17 11:35:08 -04:00
Avoid logging some memory map for android crash logs
From 121kb to 47kb per crash in the emulator
This commit is contained in:
parent
1093db2191
commit
7d017e7dd1
13
src/Logger.c
13
src/Logger.c
@ -622,6 +622,17 @@ static void DumpMisc(void* ctx) {
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef CC_BUILD_ANDROID
|
||||
static int SkipRange(const cc_string* str) {
|
||||
/* Android has a lot of ranges in /maps, which produces 100-120 kb of logs for one single crash! */
|
||||
/* As such, to cut down the crash logs to more relevant information, ignore shared memory and fonts */
|
||||
/* (e.g. removes a ton of '/dev/ashmem/dalvik-thread local mark stack (deleted)' entries */
|
||||
return String_ContainsConst(str, "/system/fonts/") || String_ContainsConst(str, "/dev/ashmem/");
|
||||
}
|
||||
#else
|
||||
static int SkipRange(const cc_string* str) { return false; }
|
||||
#endif
|
||||
|
||||
static void DumpMisc(void* ctx) {
|
||||
static const cc_string memMap = String_FromConst("-- memory map --\n");
|
||||
cc_string str; char strBuffer[320];
|
||||
@ -635,7 +646,7 @@ static void DumpMisc(void* ctx) {
|
||||
|
||||
while ((n = read(fd, str.buffer, str.capacity)) > 0) {
|
||||
str.length = n;
|
||||
Logger_Log(&str);
|
||||
if (!SkipRange(&str)) Logger_Log(&str);
|
||||
}
|
||||
|
||||
close(fd);
|
||||
|
Loading…
x
Reference in New Issue
Block a user