Add some more crash debug information.

This commit is contained in:
John Preston 2017-11-28 14:05:11 +04:00
parent c04991f707
commit a63abe5154
2 changed files with 44 additions and 34 deletions

View File

@ -2324,25 +2324,37 @@ void HistoryWidget::messagesReceived(PeerData *peer, const MTPmessages_Messages
const auto ExtractLastId = [&] { const auto ExtractLastId = [&] {
return histList->empty() ? -1 : idFromMessage(histList->back()); return histList->empty() ? -1 : idFromMessage(histList->back());
}; };
const auto PeerString = [](PeerId peerId) {
if (peerIsUser(peerId)) {
return QString("User-%1").arg(peerToUser(peerId));
} else if (peerIsChat(peerId)) {
return QString("Chat-%1").arg(peerToChat(peerId));
} else if (peerIsChannel(peerId)) {
return QString("Channel-%1").arg(peerToChannel(peerId));
}
return QString("Bad-%1").arg(peerId);
};
if (_preloadRequest == requestId) { if (_preloadRequest == requestId) {
auto to = toMigrated ? _migrated : _history; auto to = toMigrated ? _migrated : _history;
SignalHandlers::setCrashAnnotation("old_minmaxbefore_minmaxnow", QString( if (cBetaVersion()) {
"%1=%6;%2=%7;%3;%4;%5;(%8:%9)" SignalHandlers::setCrashAnnotation("old_debugstr", QString(
).arg(_debug_preloadMin "%1_%2_%3_%4:%5_%6 (%7)"
).arg(_debug_preloadMax ).arg(PeerString(_debug_preloadDownPeer)
).arg(_debug_preloadOffsetId ).arg(_debug_preloadOffsetId
).arg(_debug_preloadAddOffset ).arg(_debug_preloadAddOffset
).arg(_debug_preloadLoadCount ).arg(_debug_preloadLoadCount
).arg(to->minMsgId() ).arg(ExtractFirstId()
).arg(to->maxMsgId() ).arg(ExtractLastId()
).arg(ExtractFirstId() ).arg(Auth().userId()
).arg(ExtractLastId() ));
)); }
addMessagesToFront(peer, *histList); addMessagesToFront(peer, *histList);
SignalHandlers::setCrashAnnotation("old_minmaxbefore_minmaxnow", QString()); if (cBetaVersion()) {
SignalHandlers::setCrashAnnotation("old_debugstr", QString());
}
_preloadRequest = 0; _preloadRequest = 0;
preloadHistoryIfNeeded(); preloadHistoryIfNeeded();
@ -2352,22 +2364,24 @@ void HistoryWidget::messagesReceived(PeerData *peer, const MTPmessages_Messages
} }
} else if (_preloadDownRequest == requestId) { } else if (_preloadDownRequest == requestId) {
auto to = toMigrated ? _migrated : _history; auto to = toMigrated ? _migrated : _history;
SignalHandlers::setCrashAnnotation("new_minmaxbefore_minmaxnow", QString( if (cBetaVersion()) {
"%1=%6;%2=%7;%3;%4;%5;(%8:%9)" SignalHandlers::setCrashAnnotation("new_debugstr", QString(
).arg(_debug_preloadDownMin "%1_%2_%3_%4:%5_%6 (%7)"
).arg(_debug_preloadDownMax ).arg(PeerString(_debug_preloadDownPeer)
).arg(_debug_preloadDownOffsetId ).arg(_debug_preloadDownOffsetId
).arg(_debug_preloadDownAddOffset ).arg(_debug_preloadDownAddOffset
).arg(_debug_preloadDownLoadCount ).arg(_debug_preloadDownLoadCount
).arg(to->minMsgId() ).arg(ExtractFirstId()
).arg(to->maxMsgId() ).arg(ExtractLastId()
).arg(ExtractFirstId() ).arg(Auth().userId()
).arg(ExtractLastId() ));
)); }
addMessagesToBack(peer, *histList); addMessagesToBack(peer, *histList);
SignalHandlers::setCrashAnnotation("new_minmaxbefore_minmaxnow", QString()); if (cBetaVersion()) {
SignalHandlers::setCrashAnnotation("new_debugstr", QString());
}
_preloadDownRequest = 0; _preloadDownRequest = 0;
preloadHistoryIfNeeded(); preloadHistoryIfNeeded();
@ -2560,11 +2574,10 @@ void HistoryWidget::loadMessages() {
auto minId = 0; auto minId = 0;
auto historyHash = 0; auto historyHash = 0;
_debug_preloadMin = from->minMsgId();
_debug_preloadMax = from->maxMsgId();
_debug_preloadOffsetId = offsetId + 1; _debug_preloadOffsetId = offsetId + 1;
_debug_preloadAddOffset = addOffset; _debug_preloadAddOffset = addOffset;
_debug_preloadLoadCount = loadCount; _debug_preloadLoadCount = loadCount;
_debug_preloadPeer = from->peer->id;
_preloadRequest = MTP::send( _preloadRequest = MTP::send(
MTPmessages_GetHistory( MTPmessages_GetHistory(
from->peer->input, from->peer->input,
@ -2605,11 +2618,10 @@ void HistoryWidget::loadMessagesDown() {
auto minId = 0; auto minId = 0;
auto historyHash = 0; auto historyHash = 0;
_debug_preloadDownMin = from->minMsgId();
_debug_preloadDownMax = from->maxMsgId();
_debug_preloadDownOffsetId = offsetId + 1; _debug_preloadDownOffsetId = offsetId + 1;
_debug_preloadDownAddOffset = addOffset; _debug_preloadDownAddOffset = addOffset;
_debug_preloadDownLoadCount = loadCount; _debug_preloadDownLoadCount = loadCount;
_debug_preloadDownPeer = from->peer->id;
_preloadDownRequest = MTP::send( _preloadDownRequest = MTP::send(
MTPmessages_GetHistory( MTPmessages_GetHistory(
from->peer->input, from->peer->input,

View File

@ -725,16 +725,14 @@ private:
mtpRequestId _preloadRequest = 0; mtpRequestId _preloadRequest = 0;
mtpRequestId _preloadDownRequest = 0; mtpRequestId _preloadDownRequest = 0;
MsgId _debug_preloadMin = 0;
MsgId _debug_preloadMax = 0;
MsgId _debug_preloadOffsetId = 0; MsgId _debug_preloadOffsetId = 0;
int32 _debug_preloadAddOffset = 0; int32 _debug_preloadAddOffset = 0;
int32 _debug_preloadLoadCount = 0; int32 _debug_preloadLoadCount = 0;
MsgId _debug_preloadDownMin = 0; PeerId _debug_preloadPeer = 0;
MsgId _debug_preloadDownMax = 0;
MsgId _debug_preloadDownOffsetId = 0; MsgId _debug_preloadDownOffsetId = 0;
int32 _debug_preloadDownAddOffset = 0; int32 _debug_preloadDownAddOffset = 0;
int32 _debug_preloadDownLoadCount = 0; int32 _debug_preloadDownLoadCount = 0;
PeerId _debug_preloadDownPeer = 0;
MsgId _delayedShowAtMsgId = -1; // wtf? MsgId _delayedShowAtMsgId = -1; // wtf?
mtpRequestId _delayedShowAtRequest = 0; mtpRequestId _delayedShowAtRequest = 0;