Ethereal-dev: Re: [Ethereal-dev] help: new dissector debugging questions

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: Wed, 21 Apr 2004 17:52:59 -0500
Richard,
Thanks for your help. I tried with your approach. But now it stops inside
asn1_open( ) with a segmentation fault even though the assignment is not
performed on NULL pointers.
The thing confuses me is that I follow the coding in the skeleton code in
README.developer. There should be no logical mistakes in my code. The
protocol I am working on is on top of TCP. Here is the code for my dissector
registration. Could someone clarify the "sub-dissector registration" for me?
Does it mean my protocol dissector uses TCP dissector as sub-dissector
registration?
void
proto_reg_handoff_csta(void)
{
 //dissector_handle_t xxx_handle;

 xxx_handle = create_dissector_handle(dissect_xxx,
     proto_xxx);
 dissector_add("tcp.port", TCP_PORT_XXX, xxx_handle);

 data_handle = find_dissector("data");
}

I notice some others debug with VC++. Is it a better alternative of GDB for
debugging.
Thanks for your help.
Michael


PS. The debugging session:
7476            if (check_col(pinfo->cinfo, COL_PROTOCOL))
(gdb) print tree
$1 = (proto_tree *) 0x0
(gdb) print pinfo->cinfo
$2 = (column_info *) 0x807a96c
(gdb) n
7477                    col_set_str(pinfo->cinfo, COL_PROTOCOL, "xxxx");
(gdb) n
7483            if (tree) {
(gdb) print pinfo->cinfo
$3 = (column_info *) 0x807a96c
(gdb) n
7489            asn1_open(asn1, tvb, 0);
(gdb) print asn1
$4 = (ASN1_SCK *) 0x401797fd
(gdb) s
asn1_open (asn1=0x401797fd, tvb=0x818ccac, offset=0) at ../asn1.c:97
97          asn1->tvb = tvb;
(gdb) print tvb
$5 = (tvbuff_t *) 0x818ccac
(gdb) print asn1
$6 = (ASN1_SCK *) 0x401797fd
(gdb) print asn1->tvb
$7 = (tvbuff_t *) 0x97c3815b
(gdb) n

Program received signal SIGSEGV, Segmentation fault.
0x4050775d in asn1_open (asn1=0x401797fd, tvb=0x818ccac, offset=0)
    at ../asn1.c:97
97          asn1->tvb = tvb;