Ethereal-dev: [Ethereal-dev] help: Two debugging questions on new dissector

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: "Wei Li (Michael)" <mich@xxxxxxxxxxxxxxxxxxxx>
Date: Thu, 15 Apr 2004 16:47:03 -0500
Hi,
  There is sth weird when I am debugging a new dissector in Ethereal. During debugging, the execution order of program statements is not following the program flow. For example, in the following capture of debugging session, it jumpped around the statement 2105 quite a few times until finally execute it. I have never met such problems with GDB.
 
A sample debugging session:
2105            gchar * pdu_type_string = val_to_str(pdu_type, pdu_types,
(gdb) n
2092    {
(gdb) n
2105            gchar * pdu_type_string = val_to_str(pdu_type, pdu_types,
(gdb) n
2097        gchar * str = NULL;
(gdb) n
2101            proto_tree * argu_tree = NULL;
(gdb) print pdu_type_string
$14 = (gchar *) 0x0
(gdb) n
2102            proto_tree * subtree = NULL;
(gdb) n
2105            gchar * pdu_type_string = val_to_str(pdu_type, pdu_types,
(gdb) n
2108            ret = asn1_sequence_decode (asn1, &len, &header_length);
(gdb) print pdu_type_string
$15 = (gchar *) 0x0
(gdb) n
2105            gchar * pdu_type_string = val_to_str(pdu_type, pdu_types,
(gdb) print pdu_type_string
$16 = (gchar *) 0x4047f5c8 "System Status"
 
By the way, after I successfully dissect the first two packets in the dump file, the program suddenly aborted because of failing on the following assertion: ** ERROR **: file tvbuff.c: line 379 (check_offset_length_no_exception): assertion failed: (tvb->initialized). Could anybody help me out here?
 
Assertion failure backtrace:
#5  0x40172a89 in check_offset_length_no_exception (tvb=0x8185bec, offset=0,
    length=1, offset_ptr=0xbfffe238, length_ptr=0xbfffe23c,
    exception=0xbfffe26c) at tvbuff.c:379
#6  0x4017362d in ensure_contiguous_no_exception (tvb=0x8185bec, offset=0,
    length=1, exception=0xbfffe26c) at tvbuff.c:815
#7  0x40173706 in ensure_contiguous (tvb=0x8185bec, offset=0, length=1)
    at tvbuff.c:850
#8  0x40173b3b in tvb_get_guint8 (tvb=0x8185bec, offset=0) at tvbuff.c:1020
#9  0x4042a3f4 in asn1_octet_decode (asn1=0x8185bec, ch=0xbfffe2eb "")
    at ../asn1.c:135
#10 0x4042a7a6 in asn1_int32_value_decode (asn1=0x8185bec, enc_len=2,
    integer=0xbfffe348) at ../asn1.c:480
 
Many Thanks!
Michael