This wiki has been migrated to https://gitlab.com/wireshark/wireshark/-/wikis/home and is now deprecated. Please use that site instead.
Differences between revisions 2 and 3
Revision 2 as of 2005-01-20 10:44:24
Size: 842
Editor: GuyHarris
Comment: Mention conditional breakpoints.
Revision 3 as of 2005-01-20 11:09:44
Size: 851
Editor: UlfLamping
Comment: MSVC is also able to make breakpoints conditional (deep in it's dialog)
Deletions are marked like this. Additions are marked like this.
Line 21: Line 21:
Some debuggers, such as gdb, also let you make breakpoints conditional; you could set a breakpoint at some point in a routine, and make the condition for the breakpoint be {{{pinfo->fd->num == 1234}}}. Some debuggers, such as gdb and MSVC, also let you make breakpoints conditional; you could set a breakpoint at some point in a routine, and make the condition for the breakpoint be {{{pinfo->fd->num == 1234}}}.

Development Tips

Here you will find various tips useful while development and debugging.

Breakpoint on a specific packet number

Often you know, that you have a bug/problem in your dissector, which can be found only in a specific packet.

Let's say you know packet number 1234 has a bug, so you can add the following to your code:

{{{ if(pinfo->fd->num == 1234) {

  • printf("Here is my bug\n");

} }}}

and simply set a breakpoint to the printf call.

Of course you will need access to pinfo, but this should be the case in any dissector.

Don't forget to remove this later, after you've found your bug :-)

Some debuggers, such as gdb and MSVC, also let you make breakpoints conditional; you could set a breakpoint at some point in a routine, and make the condition for the breakpoint be pinfo->fd->num == 1234.

Development/Tips (last edited 2019-02-01 14:23:13 by PeterWu)