1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-08 07:07:05 +02:00

Fix breakpad on OSX

This commit is contained in:
Dominik Schmidt
2014-04-15 19:42:55 +02:00
parent b4f05b0831
commit 8ffa6634b8
2 changed files with 32 additions and 7 deletions

View File

@@ -40,13 +40,37 @@ bool s_active = true;
static bool
#ifdef Q_OS_LINUX
LaunchUploader( const google_breakpad::MinidumpDescriptor& descriptor, void* context, bool succeeded )
{
#else // Q_OS_MAC
LaunchUploader( const char* dump_dir, const char* minidump_id, void* context, bool succeeded)
{
#endif
if ( !succeeded )
{
printf("Could not write crash dump file");
return false;
}
// DON'T USE THE HEAP!!!
// So that indeed means, no QStrings, no qDebug(), no QAnything, seriously!
if ( !succeeded )
return false;
#ifdef Q_OS_LINUX
const char* path = descriptor.path();
#else // Q_OS_MAC
const char* extension = "dmp";
char path[4096];
strcpy(path, dump_dir);
strcat(path, "/");
strcat(path, minidump_id);
strcat(path, ".");
strcat(path, extension);
#endif
printf("Dump file was written to: %s\n", path);
const char* crashReporter = static_cast<BreakPad*>(context)->crashReporter();
if ( !s_active || strlen( crashReporter ) == 0 )
@@ -60,7 +84,7 @@ LaunchUploader( const google_breakpad::MinidumpDescriptor& descriptor, void* con
// we are the fork
execl( crashReporter,
crashReporter,
descriptor.path(),
path,
(char*) 0 );
// execl replaces this process, so no more code will be executed
@@ -75,8 +99,10 @@ LaunchUploader( const google_breakpad::MinidumpDescriptor& descriptor, void* con
BreakPad::BreakPad( const QString& path, bool active )
#ifdef Q_OS_LINUX
#if defined Q_OS_LINUX
: google_breakpad::ExceptionHandler( google_breakpad::MinidumpDescriptor(path.toStdString()), NULL, LaunchUploader, this, true, -1 )
#elif defined Q_OS_MAC
: google_breakpad::ExceptionHandler( path.toStdString(), NULL, LaunchUploader, this, true, NULL)
#else
: google_breakpad::ExceptionHandler( path.toStdString(), 0, LaunchUploader, this, true, 0 )
#endif

View File

@@ -24,8 +24,6 @@ IF(UNIX)
client/mac/handler/exception_handler.cc
client/mac/handler/minidump_generator.cc
client/mac/handler/protected_memory_allocator.cc
# client/mac/Framework/Breakpad.mm
# client/mac/Framework/OnDemandServer.mm
common/mac/file_id.cc
common/mac/macho_id.cc
common/mac/macho_reader.cc
@@ -35,8 +33,9 @@ IF(UNIX)
common/md5.cc
common/mac/dump_syms.mm
common/mac/MachIPC.mm
common/mac/SimpleStringDictionary.mm
common/dwarf/dwarf2reader.cc
common/mac/bootstrap_compat.cc
common/dwarf_cfi_to_module.cc
)
ELSE(APPLE)
SET( breakpadSources