summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHatem ElKharashy <hatem.elkharashy@qt.io>2023-04-11 12:24:26 +0300
committerHatem ElKharashy <hatem.elkharashy@qt.io>2023-04-25 20:57:43 +0000
commitc10c66e552e3ab19758709e84bac187cda27962c (patch)
tree84eab0095e343853fb22cefa79e2317f5f075358
parent21e411687428d05655b8db2634466384fa35cc03 (diff)
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>
-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;
}