diff options
author | Antti Määttä <[email protected]> | 2022-12-14 09:32:59 +0200 |
---|---|---|
committer | Antti Määttä <[email protected]> | 2023-01-13 12:43:44 +0200 |
commit | f488c657216115d33753429e8500b99b6e8e7c4c (patch) | |
tree | d080636308f027ac626f5b46727ede0b28a8fb4e | |
parent | 135a792940ed3a7ed2cfc632e2b11477edea7706 (diff) |
Fix array handling in tracegen tool
Remove the array field type. We need to know the basic datatype as well
for future backends. Use the arrayLen instead. Add the missing array
handling for etw backend.
Task-number: QTBUG-106399
Pick-to: 6.5
Change-Id: I97c38240bd1c79c0e61d268a7d780016b341f110
Reviewed-by: Tomi Korpipää <[email protected]>
-rw-r--r-- | src/tools/tracegen/etw.cpp | 9 | ||||
-rw-r--r-- | src/tools/tracegen/lttng.cpp | 6 | ||||
-rw-r--r-- | src/tools/tracegen/provider.cpp | 5 | ||||
-rw-r--r-- | src/tools/tracegen/provider.h | 1 |
4 files changed, 16 insertions, 5 deletions
diff --git a/src/tools/tracegen/etw.cpp b/src/tools/tracegen/etw.cpp index cf185c3fddf..755470af153 100644 --- a/src/tools/tracegen/etw.cpp +++ b/src/tools/tracegen/etw.cpp @@ -22,6 +22,15 @@ static void writeEtwMacro(QTextStream &stream, const Tracepoint::Field &field) { const QString &name = field.name; + if (field.arrayLen > 0) { + for (int i = 0; i < field.arrayLen; i++) { + stream << "TraceLoggingValue(" << name << "[" << i << "], \"" << name << "[" << i << "]\")"; + if (i + 1 < field.arrayLen) + stream << ",\n "; + } + return; + } + switch (field.backendType) { case Tracepoint::Field::QtString: stream << "TraceLoggingCountedWideString(reinterpret_cast<LPCWSTR>(" diff --git a/src/tools/tracegen/lttng.cpp b/src/tools/tracegen/lttng.cpp index 1ca3f4a974f..d230e024c7f 100644 --- a/src/tools/tracegen/lttng.cpp +++ b/src/tools/tracegen/lttng.cpp @@ -19,11 +19,13 @@ static void writeCtfMacro(QTextStream &stream, const Tracepoint::Field &field) const QString &seqLen = field.seqLen; const int arrayLen = field.arrayLen; - switch (field.backendType) { - case Tracepoint::Field::Array: + if (arrayLen > 0) { stream << "ctf_array(" <<paramType << ", " << name << ", " << name << ", " << arrayLen << ")"; return; + } + + switch (field.backendType) { case Tracepoint::Field::Sequence: stream << "ctf_sequence(" << paramType << ", " << name << ", " << name diff --git a/src/tools/tracegen/provider.cpp b/src/tools/tracegen/provider.cpp index bcfb53f6991..51d0326ecff 100644 --- a/src/tools/tracegen/provider.cpp +++ b/src/tools/tracegen/provider.cpp @@ -150,8 +150,9 @@ static Tracepoint::Field::BackendType backendType(QString rawType) return Tracepoint::Field::Unknown; }; - if (arrayLength(rawType) > 0) - return Tracepoint::Field::Array; + int arrayLen = arrayLength(rawType); + if (arrayLen > 0) + rawType = removeBraces(rawType); if (!sequenceLength(rawType).isNull()) return Tracepoint::Field::Sequence; diff --git a/src/tools/tracegen/provider.h b/src/tools/tracegen/provider.h index 86749de502e..18392baaef2 100644 --- a/src/tools/tracegen/provider.h +++ b/src/tools/tracegen/provider.h @@ -21,7 +21,6 @@ struct Tracepoint struct Field { enum BackendType { - Array, Sequence, Integer, IntegerHex, |