summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHatem ElKharashy <hatem.elkharashy@qt.io>2023-04-11 12:24:26 +0300
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2023-04-25 23:39:06 +0000
commit81caae1ddc212747dbe4e891a568cefd86f6355d (patch)
treef34473f9975ce68bf9e8970c6f3aeb943ab94948
parentd3b44686c70ec6058decbb866ee2d2291653e7a1 (diff)
downloadqtbase-81caae1ddc212747dbe4e891a568cefd86f6355d.tar.gz
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 Change-Id: I30e7049d9eda1141298145897df372213145c1b4 Reviewed-by: Antti Määttä <antti.maatta@qt.io> Reviewed-by: Janne Koskinen <janne.p.koskinen@qt.io> (cherry picked from commit c10c66e552e3ab19758709e84bac187cda27962c) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/tools/tracegen/lttng.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/tools/tracegen/lttng.cpp b/src/tools/tracegen/lttng.cpp
index b812682217..ff94bba3f3 100644
--- a/src/tools/tracegen/lttng.cpp
+++ b/src/tools/tracegen/lttng.cpp
@@ -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;
}