Fix backward compatibility issue with QmlProfiler

Previous implementation uses MaxMessage and MaxRangeType constants to
specify events with undefined message or range type. This causes
backwards compatibility issue if new message or range types are
added, because those constants are also written to files when saving
profiler traces.

Add UndefinedMessage and UndefinedRangeType constants and use those
instead of the MaxMessage and MaxRangeType constants. This doesn't fix
opening old traces, but the same problem won't happend again with new
traces.

Also update profiler autotests with fixed data.

Task-number: QTCREATORBUG-28146
Change-Id: Ief003d39f871dd1ff2cc908e6a4d4b4678fd0868
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
Antti Määttä
2022-09-19 15:34:52 +03:00
parent e8ebd8e497
commit 0f49728c32
24 changed files with 60 additions and 58 deletions

View File

@@ -170,7 +170,7 @@ void QmlProfilerTraceClientPrivate::processCurrentEvent()
// all ranges are perfectly nested. This is why we can defer the type resolution until either
// the range ends or a child range starts. With only the information in RangeStart we wouldn't
// be able to uniquely identify the event type.
Message rangeStage = currentEvent.type.rangeType() == MaximumRangeType ?
Message rangeStage = currentEvent.type.rangeType() == UndefinedRangeType ?
currentEvent.type.message() : currentEvent.event.rangeStage();
switch (rangeStage) {
case RangeStart:
@@ -333,7 +333,7 @@ void QmlProfilerTraceClient::setRequestedFeatures(quint64 features)
d->currentEvent.event.setTimestamp(context.timestamp > 0 ? context.timestamp : 0);
d->currentEvent.event.setTypeIndex(-1);
d->currentEvent.event.setString(text);
d->currentEvent.type = QmlEventType(DebugMessage, MaximumRangeType, type,
d->currentEvent.type = QmlEventType(DebugMessage, UndefinedRangeType, type,
QmlEventLocation(context.file, context.line, 1));
d->currentEvent.serverTypeId = 0;
d->processCurrentEvent();