improved minidump choosing when sending crash report
This commit is contained in:
parent
fa2767cc65
commit
9f7b92eccd
|
@ -600,6 +600,19 @@ namespace SignalHandlers {
|
|||
return stream;
|
||||
}
|
||||
|
||||
const dump &operator<<(const dump &stream, const wchar_t *str) {
|
||||
if (!CrashDumpFile) return stream;
|
||||
|
||||
for (int i = 0, l = wcslen(str); i < l; ++i) {
|
||||
if (str[i] >= 0 && str[i] < 128) {
|
||||
_writeChar(char(str[i]));
|
||||
} else {
|
||||
_writeChar('?');
|
||||
}
|
||||
}
|
||||
return stream;
|
||||
}
|
||||
|
||||
template <typename Type>
|
||||
const dump &_writeNumber(const dump &stream, Type number) {
|
||||
if (!CrashDumpFile) return stream;
|
||||
|
@ -658,6 +671,9 @@ namespace SignalHandlers {
|
|||
bool LoggingCrashHeaderWritten = false;
|
||||
QMutex LoggingCrashMutex;
|
||||
|
||||
const char *BreakpadDumpPath = 0;
|
||||
const wchar_t *BreakpadDumpPathW = 0;
|
||||
|
||||
// see https://github.com/benbjohnson/bandicoot
|
||||
#if defined Q_OS_MAC || defined Q_OS_LINUX32 || defined Q_OS_LINUX64
|
||||
struct sigaction SIG_def[32];
|
||||
|
@ -720,6 +736,11 @@ namespace SignalHandlers {
|
|||
dump() << "Caught signal " << signum << " (" << name << ") in thread " << uint64(thread) << "\n";
|
||||
} else if (signum == -1) {
|
||||
dump() << "Google Breakpad caught a crash, minidump written in thread " << uint64(thread) << "\n";
|
||||
if (BreakpadDumpPath) {
|
||||
dump() << "Minidump: " << BreakpadDumpPath << "\n";
|
||||
} else if (BreakpadDumpPathW) {
|
||||
dump() << "Minidump: " << BreakpadDumpPathW << "\n";
|
||||
}
|
||||
} else {
|
||||
dump() << "Caught signal " << signum << " in thread " << uint64(thread) << "\n";
|
||||
}
|
||||
|
@ -809,7 +830,18 @@ namespace SignalHandlers {
|
|||
bool DumpCallback(const google_breakpad::MinidumpDescriptor &md, void *context, bool success)
|
||||
#endif
|
||||
{
|
||||
#ifdef Q_OS_WIN
|
||||
BreakpadDumpPathW = _minidump_id;
|
||||
Handler(-1);
|
||||
#else
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
BreakpadDumpPath = _minidump_id;
|
||||
#else
|
||||
BreakpadDumpPath = md.path();
|
||||
#endif
|
||||
Handler(-1, 0, 0);
|
||||
#endif
|
||||
return success;
|
||||
}
|
||||
|
||||
|
|
|
@ -92,6 +92,7 @@ namespace SignalHandlers {
|
|||
~dump();
|
||||
};
|
||||
const dump &operator<<(const dump &stream, const char *str);
|
||||
const dump &operator<<(const dump &stream, const wchar_t *str);
|
||||
const dump &operator<<(const dump &stream, int num);
|
||||
const dump &operator<<(const dump &stream, unsigned int num);
|
||||
const dump &operator<<(const dump &stream, unsigned long num);
|
||||
|
|
|
@ -2018,9 +2018,22 @@ LastCrashedWindow::LastCrashedWindow()
|
|||
{
|
||||
|
||||
if (_sendingState != SendingNoReport) {
|
||||
qint64 dumpSize = 0;
|
||||
QString possibleDump = getReportField(qstr("minidump"), qstr("Minidump:"));
|
||||
if (!possibleDump.isEmpty()) {
|
||||
if (!possibleDump.startsWith('/')) {
|
||||
possibleDump = cWorkingDir() + qsl("tdumps/") + possibleDump;
|
||||
}
|
||||
QFileInfo possibleInfo(possibleDump);
|
||||
if (possibleInfo.exists()) {
|
||||
_minidumpName = possibleInfo.fileName();
|
||||
_minidumpFull = possibleInfo.absoluteFilePath();
|
||||
dumpSize = possibleInfo.size();
|
||||
}
|
||||
}
|
||||
if (_minidumpFull.isEmpty()) {
|
||||
QString maxDump, maxDumpFull;
|
||||
QDateTime maxDumpModified, workingModified = QFileInfo(cWorkingDir() + qsl("tdata/working")).lastModified();
|
||||
qint64 maxDumpSize = 0;
|
||||
QFileInfoList list = QDir(cWorkingDir() + qsl("tdumps")).entryInfoList();
|
||||
for (int32 i = 0, l = list.size(); i < l; ++i) {
|
||||
QString name = list.at(i).fileName();
|
||||
|
@ -2030,16 +2043,17 @@ LastCrashedWindow::LastCrashedWindow()
|
|||
maxDump = name;
|
||||
maxDumpModified = modified;
|
||||
maxDumpFull = list.at(i).absoluteFilePath();
|
||||
maxDumpSize = list.at(i).size();
|
||||
dumpSize = list.at(i).size();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!maxDump.isEmpty() && qAbs(workingModified.secsTo(maxDumpModified)) < 10) {
|
||||
_minidumpName = maxDump;
|
||||
_minidumpFull = maxDumpFull;
|
||||
}
|
||||
}
|
||||
|
||||
_minidump.setText(qsl("+ %1 (%2 KB)").arg(_minidumpName).arg(maxDumpSize / 1024));
|
||||
_minidump.setText(qsl("+ %1 (%2 KB)").arg(_minidumpName).arg(dumpSize / 1024));
|
||||
}
|
||||
|
||||
_networkSettings.setText(qsl("NETWORK SETTINGS"));
|
||||
|
|
Loading…
Reference in New Issue