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ää <tomi.korpipaa@qt.io>
This commit is contained in:
parent
135a792940
commit
f488c65721
@ -22,6 +22,15 @@ static void writeEtwMacro(QTextStream &stream, const Tracepoint::Field &field)
|
|||||||
{
|
{
|
||||||
const QString &name = field.name;
|
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) {
|
switch (field.backendType) {
|
||||||
case Tracepoint::Field::QtString:
|
case Tracepoint::Field::QtString:
|
||||||
stream << "TraceLoggingCountedWideString(reinterpret_cast<LPCWSTR>("
|
stream << "TraceLoggingCountedWideString(reinterpret_cast<LPCWSTR>("
|
||||||
|
@ -19,11 +19,13 @@ static void writeCtfMacro(QTextStream &stream, const Tracepoint::Field &field)
|
|||||||
const QString &seqLen = field.seqLen;
|
const QString &seqLen = field.seqLen;
|
||||||
const int arrayLen = field.arrayLen;
|
const int arrayLen = field.arrayLen;
|
||||||
|
|
||||||
switch (field.backendType) {
|
if (arrayLen > 0) {
|
||||||
case Tracepoint::Field::Array:
|
|
||||||
stream << "ctf_array(" <<paramType << ", "
|
stream << "ctf_array(" <<paramType << ", "
|
||||||
<< name << ", " << name << ", " << arrayLen << ")";
|
<< name << ", " << name << ", " << arrayLen << ")";
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (field.backendType) {
|
||||||
case Tracepoint::Field::Sequence:
|
case Tracepoint::Field::Sequence:
|
||||||
stream << "ctf_sequence(" << paramType
|
stream << "ctf_sequence(" << paramType
|
||||||
<< ", " << name << ", " << name
|
<< ", " << name << ", " << name
|
||||||
|
@ -150,8 +150,9 @@ static Tracepoint::Field::BackendType backendType(QString rawType)
|
|||||||
return Tracepoint::Field::Unknown;
|
return Tracepoint::Field::Unknown;
|
||||||
};
|
};
|
||||||
|
|
||||||
if (arrayLength(rawType) > 0)
|
int arrayLen = arrayLength(rawType);
|
||||||
return Tracepoint::Field::Array;
|
if (arrayLen > 0)
|
||||||
|
rawType = removeBraces(rawType);
|
||||||
|
|
||||||
if (!sequenceLength(rawType).isNull())
|
if (!sequenceLength(rawType).isNull())
|
||||||
return Tracepoint::Field::Sequence;
|
return Tracepoint::Field::Sequence;
|
||||||
|
@ -21,7 +21,6 @@ struct Tracepoint
|
|||||||
struct Field
|
struct Field
|
||||||
{
|
{
|
||||||
enum BackendType {
|
enum BackendType {
|
||||||
Array,
|
|
||||||
Sequence,
|
Sequence,
|
||||||
Integer,
|
Integer,
|
||||||
IntegerHex,
|
IntegerHex,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user