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>
This commit is contained in:
Gerald Combs 2020-08-11 08:49:29 -07:00 committed by Anders Broman
parent a72e415451
commit b1753ce511
1 changed files with 11 additions and 0 deletions

View File

@ -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;
}
}