49#if defined(Q_OS_WIN32)
50#include <client/windows/handler/exception_handler.h>
51#elif defined(Q_OS_MAC)
52#include <client/mac/handler/exception_handler.h>
55#elif defined(Q_OS_LINUX)
56#include <client/linux/handler/exception_handler.h>
59#elif defined(Q_OS_SOLARIS)
60#include <client/solaris/handler/exception_handler.h>
73#if defined(Q_OS_WIN32)
76#define PATH_SEPARATOR TEXT("\\")
77# ifdef _USE_32BIT_TIME_T
78# define TIME_TO_STRING(buf, buflen, t) \
79 _ltoa_s(t, buf, buflen, 10)
81# define TIME_TO_STRING(buf, buflen, t) \
82 _i64toa_s(t, buf, buflen, 10)
87#define PATH_SEPARATOR "/"
89#define TIME_TO_STRING(buf, buflen, t) \
90 snprintf(buf, buflen, "%ld", t)
156 while (n-- != 0 && *d !=
TEXT(
'\0'))
162#if defined(Q_OS_WIN32)
163 return (dlen + wcslen(s));
165 return(dlen + strlen(s));
168 while (*s !=
TEXT(
'\0')) {
177 return(dlen + (s - src));
187#if defined(Q_OS_WIN32)
189 WriteFile(hFile, key, strlen(key), &dwWritten, NULL);
190 WriteFile(hFile,
"=", 1, &dwWritten, NULL);
191 WriteFile(hFile, val, strlen(val), &dwWritten, NULL);
192 WriteFile(hFile,
"\n", 1, &dwWritten, NULL);
194 write(hFile, key, strlen(key));
195 write(hFile,
"=", 1);
196 write(hFile, val, strlen(val));
197 write(hFile,
"\n", 1);
212 static const char *KeyBuildVersion =
"BuildVersion";
213 static const char *KeyCrashTime =
"CrashTime";
214 static const char *KeyStartupTime =
"StartupTime";
215 static const char *KeyRestartExecutable =
"RestartExecutable";
216 static const char *KeyRestartExecutableArgs =
"RestartExecutableArgs";
226#if defined(Q_OS_WIN32)
227 HANDLE hFile = CreateFile(extraInfoPath, GENERIC_WRITE, 0, NULL,
228 CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
229 if (hFile == INVALID_HANDLE_VALUE)
238 char crashTimeString[24], startupTimeString[24];
248#if defined(Q_OS_WIN32)
266#
if defined(Q_OS_WIN32)
267 EXCEPTION_POINTERS *exInfo,
268 MDRawAssertionInfo *assertionInfo,
279#if defined(Q_OS_WIN32)
293 PROCESS_INFORMATION pi;
296 ZeroMemory(&pi,
sizeof(pi));
297 ZeroMemory(&si,
sizeof(si));
299 si.dwFlags = STARTF_USESHOWWINDOW;
300 si.wShowWindow = SW_SHOWDEFAULT;
302 BOOL rc = CreateProcess(NULL, (LPWSTR)commandLine, NULL, NULL, FALSE, 0,
303 NULL, NULL, &si, &pi);
305 CloseHandle(pi.hThread);
306 CloseHandle(pi.hProcess);
308 TerminateProcess(GetCurrentProcess(), 1);
324 pid_t
p = fork(), ret;
341 QDir dumpDir(dumpPath);
342 if (! dumpDir.exists() && ! dumpDir.mkdir(
"."))
347#
if defined(Q_OS_WIN32)
348 dumpDir.absolutePath().toStdWString(),
350 dumpDir.absolutePath().toStdString(),
355#
if defined(Q_OS_WIN32)
356 google_breakpad::ExceptionHandler::HANDLER_ALL);
379#if defined(Q_OS_WIN32)
384 QByteArray utf8 = crashReporter.toUtf8();
403 QByteArray exe = executable.toUtf8();
426 QByteArray ascii = version.toAscii();
427 memcpy(
buildVersion, ascii.constData(), ascii.length());
#define TIME_TO_STRING(buf, buflen, t)
static _char_t crashReporterExecutable[MAX_PATH_LEN+1]
static bool showCrashReporter
static const int MAX_CMD_LEN
static char buildVersion[MAX_VERSION_LEN+1]
static bool write_extra_dump_info(const _char_t *path, const _char_t *id, time_t crashTime)
bool set_build_version(const QString &version)
static size_t append_string(_char_t *dst, const _char_t *src, size_t siz)
bool set_crash_reporter(const QString &crashReporter)
bool install_exception_handler(const QString &dumpPath)
static void write_keyval_to_file(_file_handle_t hFile, const char *key, const char *val)
static google_breakpad::ExceptionHandler * exceptionHandler
static const int MAX_PATH_LEN
bool minidump_callback(const _char_t *path, const _char_t *id, void *context, bool succeeded)
void remove_exception_handler(void)
static const int MAX_VERSION_LEN
static char restartExecutable[MAX_CMD_LEN+1]
bool set_restart_options(const QString &executable, const QStringList &arguments)
static time_t startupTime
static char restartExecutableArgs[MAX_CMD_LEN+1]
QString string_format_arguments(const QStringList &args)