Support float_type arrays when using lttng
lttng ctf_array does not support float types which causes compilation error when a float type is passed to the function. A solution is to pass the array elements one by one to TP_FIELDS. Fixes: QTBUG-112761 Pick-to: 6.5 Change-Id: I30e7049d9eda1141298145897df372213145c1b4 Reviewed-by: Antti Määttä <antti.maatta@qt.io> Reviewed-by: Janne Koskinen <janne.p.koskinen@qt.io>
This commit is contained in:
parent
21e4116874
commit
c10c66e552
@ -20,8 +20,19 @@ static void writeCtfMacro(QTextStream &stream, const Provider &provider, const T
|
||||
const int arrayLen = field.arrayLen;
|
||||
|
||||
if (arrayLen > 0) {
|
||||
stream << "ctf_array(" <<paramType << ", "
|
||||
<< name << ", " << name << ", " << arrayLen << ")";
|
||||
if (paramType == QStringLiteral("double") || paramType == QStringLiteral("float")) {
|
||||
const char *newline = nullptr;
|
||||
for (int i = 0; i < arrayLen; i++) {
|
||||
stream << newline;
|
||||
stream << "ctf_float(" <<paramType << ", " << name << "_" << QString::number(i) << ", "
|
||||
<< name << "[" << QString::number(i) << "]" << ")";
|
||||
newline = "\n ";
|
||||
}
|
||||
|
||||
} else {
|
||||
stream << "ctf_array(" <<paramType << ", "
|
||||
<< name << ", " << name << ", " << arrayLen << ")";
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user