aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2020-08-11 08:49:29 -0700
committerAnders Broman <a.broman58@gmail.com>2020-08-11 17:38:23 +0000
commitb1753ce51161007f1b0f4c210d7ed273291824a9 (patch)
treec585cd76c515583832952ee1f811f68cd3defe10 /ui
parenta72e4154510a2a535945e83766fab2550539dbfd (diff)
Qt: Add debugging ifdefs for the packet diagram.
The PacketDiagram widget prints debugging information about items that it skips and resizes. Make this conditional, similar to what we do elsewhere. Bug: 16769 Change-Id: Id7fbedbdac6096cbca8d997688d489eac4729f52 Reviewed-on: https://code.wireshark.org/review/38121 Reviewed-by: Gerald Combs <gerald@wireshark.org> Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'ui')
-rw-r--r--ui/qt/packet_diagram.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/ui/qt/packet_diagram.cpp b/ui/qt/packet_diagram.cpp
index f83f782ec1..8a9e901d64 100644
--- a/ui/qt/packet_diagram.cpp
+++ b/ui/qt/packet_diagram.cpp
@@ -33,7 +33,12 @@
#include <QSvgGenerator>
#endif
+// Item offsets and lengths
+//#define DEBUG_PACKET_DIAGRAM 1
+
+#ifdef DEBUG_PACKET_DIAGRAM
#include <QDebug>
+#endif
// "rems" are root em widths, aka the regular font height, similar to rems in CSS.
class DiagramLayout {
@@ -533,7 +538,9 @@ void PacketDiagram::addDiagram(proto_node *tl_node)
int length = FI_GET_BITS_SIZE(fi) ? FI_GET_BITS_SIZE(fi) : fi->length * 8;
if (start_bit <= last_start_bit || length <= 0) {
+#ifdef DEBUG_PACKET_DIAGRAM
qDebug() << "Skipping pass 1" << fi->hfinfo->abbrev << start_bit << last_start_bit << length;
+#endif
continue;
}
last_start_bit = start_bit;
@@ -550,9 +557,13 @@ void PacketDiagram::addDiagram(proto_node *tl_node)
WireItem *next_item = &wire_items[idx + 1];
if (wire_item->start_bit + wire_item->length > next_item->start_bit) {
wire_item->length = next_item->start_bit - wire_item->start_bit;
+#ifdef DEBUG_PACKET_DIAGRAM
qDebug() << "Resized pass 2" << fi->hfinfo->abbrev << wire_item->start_bit << wire_item->length << next_item->start_bit;
+#endif
if (wire_item->length <= 0) {
+#ifdef DEBUG_PACKET_DIAGRAM
qDebug() << "Skipping pass 2" << fi->hfinfo->abbrev << wire_item->start_bit << wire_item->length;
+#endif
continue;
}
}