2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 14:38:15 +00:00

Swap 'alpha' and 'beta'. Happy debugging!

This commit is contained in:
John Preston
2018-09-26 17:58:09 +03:00
parent a949c5e287
commit 6e566e0165
32 changed files with 379 additions and 727 deletions

View File

@@ -175,81 +175,6 @@ QStringList addr2linestr(uint64 *addresses, int count) {
return result;
}
QString psPrepareCrashDump(const QByteArray &crashdump, QString dumpfile) {
QString initial = QString::fromUtf8(crashdump), result;
QStringList lines = initial.split('\n');
result.reserve(initial.size());
int32 i = 0, l = lines.size();
while (i < l) {
uint64 addresses[1024] = { 0 };
for (; i < l; ++i) {
result.append(lines.at(i)).append('\n');
QString line = lines.at(i).trimmed();
if (line == qstr("Backtrace:")) {
++i;
break;
}
}
int32 start = i;
for (; i < l; ++i) {
QString line = lines.at(i).trimmed();
if (line.isEmpty()) break;
QRegularExpressionMatch m1 = QRegularExpression(qsl("^(.+)\\(([^+]+)\\+([^\\)]+)\\)\\[(.+)\\]$")).match(line);
QRegularExpressionMatch m2 = QRegularExpression(qsl("^(.+)\\[(.+)\\]$")).match(line);
QString addrstr = m1.hasMatch() ? m1.captured(4) : (m2.hasMatch() ? m2.captured(2) : QString());
if (!addrstr.isEmpty()) {
uint64 addr = addrstr.startsWith(qstr("0x")) ? addrstr.mid(2).toULongLong(0, 16) : addrstr.toULongLong();
if (addr > 1) {
addresses[i - start] = addr;
}
}
}
QStringList addr2line = addr2linestr(addresses, i - start);
for (i = start; i < l; ++i) {
QString line = lines.at(i).trimmed();
if (line.isEmpty()) break;
result.append(qsl("\n%1. ").arg(i - start));
if (line.startsWith(qstr("ERROR: "))) {
result.append(line).append('\n');
continue;
}
if (line == qstr("[0x1]")) {
result.append(qsl("(0x1 separator)\n"));
continue;
}
QRegularExpressionMatch m1 = QRegularExpression(qsl("^(.+)\\(([^+]*)\\+([^\\)]+)\\)(.+)$")).match(line);
QRegularExpressionMatch m2 = QRegularExpression(qsl("^(.+)\\[(.+)\\]$")).match(line);
if (!m1.hasMatch() && !m2.hasMatch()) {
result.append(qstr("BAD LINE: ")).append(line).append('\n');
continue;
}
if (m1.hasMatch()) {
result.append(demanglestr(m1.captured(2))).append(qsl(" + ")).append(m1.captured(3)).append(qsl(" [")).append(m1.captured(1)).append(qsl("] "));
if (!addr2line.at(i - start).isEmpty() && addr2line.at(i - start) != qsl("??:0")) {
result.append(qsl(" (")).append(addr2line.at(i - start)).append(qsl(")\n"));
} else {
result.append(m1.captured(4)).append(qsl(" (demangled)")).append('\n');
}
} else {
result.append('[').append(m2.captured(1)).append(']');
if (!addr2line.at(i - start).isEmpty() && addr2line.at(i - start) != qsl("??:0")) {
result.append(qsl(" (")).append(addr2line.at(i - start)).append(qsl(")\n"));
} else {
result.append(' ').append(m2.captured(2)).append('\n');
}
}
}
}
return result;
}
bool _removeDirectory(const QString &path) { // from http://stackoverflow.com/questions/2256945/removing-a-non-empty-directory-programmatically-in-c-or-c
QByteArray pathRaw = QFile::encodeName(path);
DIR *d = opendir(pathRaw.constData());
@@ -409,7 +334,7 @@ QString SystemLanguage() {
void RegisterCustomScheme() {
#ifndef TDESKTOP_DISABLE_REGISTER_CUSTOM_SCHEME
auto home = getHomeDir();
if (home.isEmpty() || cBetaVersion() || cExeName().isEmpty()) return; // don't update desktop file for beta version
if (home.isEmpty() || cAlphaVersion() || cExeName().isEmpty()) return; // don't update desktop file for alpha version
if (Core::UpdaterDisabled())
return;

View File

@@ -44,7 +44,6 @@ inline void psCheckLocalSocket(const QString &serverName) {
}
void psWriteDump();
QString psPrepareCrashDump(const QByteArray &crashdump, QString dumpfile);
void psDeleteDir(const QString &dir);