mirror of
https://github.com/geode-sdk/geode.git
synced 2025-03-23 03:15:58 -04:00
fork breakpad and then change the api
This commit is contained in:
parent
a971322393
commit
7eb5953762
2 changed files with 11 additions and 54 deletions
loader
|
@ -127,58 +127,7 @@ endif()
|
|||
|
||||
|
||||
if (ANDROID AND GEODE_USE_BREAKPAD)
|
||||
CPMAddPackage(
|
||||
NAME "Breakpad"
|
||||
VERSION "2023.06.01"
|
||||
GIT_REPOSITORY "https://chromium.googlesource.com/breakpad/breakpad.git"
|
||||
)
|
||||
|
||||
if (Breakpad_ADDED)
|
||||
# uses fetchcontent to store the library in an arbitrary path (the binary dir)
|
||||
include(FetchContent)
|
||||
|
||||
FetchContent_Declare(lss
|
||||
GIT_REPOSITORY https://chromium.googlesource.com/linux-syscall-support.git
|
||||
GIT_TAG v2022.10.12
|
||||
SOURCE_DIR ${Breakpad_BINARY_DIR}/src/third_party/lss
|
||||
)
|
||||
|
||||
FetchContent_MakeAvailable(lss)
|
||||
|
||||
add_library(Breakpad STATIC
|
||||
${Breakpad_SOURCE_DIR}/src/client/linux/crash_generation/crash_generation_client.cc
|
||||
${Breakpad_SOURCE_DIR}/src/client/linux/dump_writer_common/thread_info.cc
|
||||
${Breakpad_SOURCE_DIR}/src/client/linux/dump_writer_common/ucontext_reader.cc
|
||||
${Breakpad_SOURCE_DIR}/src/client/linux/handler/exception_handler.cc
|
||||
${Breakpad_SOURCE_DIR}/src/client/linux/handler/minidump_descriptor.cc
|
||||
${Breakpad_SOURCE_DIR}/src/client/linux/log/log.cc
|
||||
${Breakpad_SOURCE_DIR}/src/client/linux/microdump_writer/microdump_writer.cc
|
||||
${Breakpad_SOURCE_DIR}/src/client/linux/minidump_writer/linux_dumper.cc
|
||||
${Breakpad_SOURCE_DIR}/src/client/linux/minidump_writer/linux_ptrace_dumper.cc
|
||||
${Breakpad_SOURCE_DIR}/src/client/linux/minidump_writer/minidump_writer.cc
|
||||
${Breakpad_SOURCE_DIR}/src/client/linux/minidump_writer/pe_file.cc
|
||||
${Breakpad_SOURCE_DIR}/src/client/minidump_file_writer.cc
|
||||
${Breakpad_SOURCE_DIR}/src/common/convert_UTF.cc
|
||||
${Breakpad_SOURCE_DIR}/src/common/md5.cc
|
||||
${Breakpad_SOURCE_DIR}/src/common/string_conversion.cc
|
||||
${Breakpad_SOURCE_DIR}/src/common/linux/breakpad_getcontext.S
|
||||
${Breakpad_SOURCE_DIR}/src/common/linux/elfutils.cc
|
||||
${Breakpad_SOURCE_DIR}/src/common/linux/file_id.cc
|
||||
${Breakpad_SOURCE_DIR}/src/common/linux/guid_creator.cc
|
||||
${Breakpad_SOURCE_DIR}/src/common/linux/linux_libc_support.cc
|
||||
${Breakpad_SOURCE_DIR}/src/common/linux/memory_mapped_file.cc
|
||||
${Breakpad_SOURCE_DIR}/src/common/linux/safe_readlink.cc
|
||||
)
|
||||
|
||||
target_include_directories(Breakpad PUBLIC
|
||||
${Breakpad_SOURCE_DIR}/src/common/android/include/
|
||||
${Breakpad_SOURCE_DIR}/src/
|
||||
${Breakpad_SOURCE_DIR}/src/common/android/include/
|
||||
|
||||
# add lss headers
|
||||
${Breakpad_BINARY_DIR}/src/
|
||||
)
|
||||
endif()
|
||||
CPMAddPackage("gh:qimiko/breakpad#161e908")
|
||||
endif()
|
||||
|
||||
add_library(${PROJECT_NAME} SHARED ${SOURCES})
|
||||
|
@ -229,7 +178,6 @@ if (ANDROID)
|
|||
|
||||
if (GEODE_USE_BREAKPAD)
|
||||
target_compile_definitions(${PROJECT_NAME} PRIVATE -DGEODE_USE_BREAKPAD)
|
||||
enable_language(ASM)
|
||||
target_link_libraries(${PROJECT_NAME} Breakpad)
|
||||
endif()
|
||||
endif()
|
||||
|
|
|
@ -5,6 +5,7 @@ static bool s_lastLaunchCrashed = false;
|
|||
#ifdef GEODE_USE_BREAKPAD
|
||||
|
||||
#include <memory>
|
||||
#include <fmt/chrono.h>
|
||||
|
||||
#include <client/linux/handler/exception_handler.h>
|
||||
#include <client/linux/handler/minidump_descriptor.h>
|
||||
|
@ -29,6 +30,14 @@ namespace {
|
|||
|
||||
return succeeded;
|
||||
}
|
||||
|
||||
std::string crashdumpName() {
|
||||
auto timeEpoch = std::chrono::system_clock::to_time_t(
|
||||
std::chrono::system_clock::now());
|
||||
auto localtime = fmt::localtime(timeEpoch);
|
||||
|
||||
return fmt::format("Crash {:%F %H.%M.%S}.dmp", localtime);
|
||||
}
|
||||
}
|
||||
|
||||
bool crashlog::setupPlatformHandler() {
|
||||
|
@ -36,7 +45,7 @@ bool crashlog::setupPlatformHandler() {
|
|||
|
||||
(void)geode::utils::file::createDirectoryAll(logDirectory);
|
||||
|
||||
google_breakpad::MinidumpDescriptor descriptor(logDirectory.string());
|
||||
google_breakpad::MinidumpDescriptor descriptor(logDirectory.string(), crashdumpName());
|
||||
|
||||
s_exceptionHandler = std::make_unique<google_breakpad::ExceptionHandler>(
|
||||
descriptor, nullptr, crashCallback, nullptr, true, -1
|
||||
|
|
Loading…
Reference in a new issue