From b1753ce51161007f1b0f4c210d7ed273291824a9 Mon Sep 17 00:00:00 2001 From: Gerald Combs Date: Tue, 11 Aug 2020 08:49:29 -0700 Subject: 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 Petri-Dish: Gerald Combs Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman --- ui/qt/packet_diagram.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'ui') 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 #endif +// Item offsets and lengths +//#define DEBUG_PACKET_DIAGRAM 1 + +#ifdef DEBUG_PACKET_DIAGRAM #include +#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; } } -- cgit v1.2.3