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>
64 #include <QStringList>
71 namespace CrashReporter
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());