This wiki has been migrated to and is now deprecated. Please use that site instead.

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) {

} }}}

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.

Using MSVC++ for debugging

Extracted from

If you are just wanting to debug Ethereal then the Win32 binaries should already include the debug symbols by default. You can look at the file config.nmake and ensure that the debug switch is enabled...

# Linker flags # /DEBUG generate debug info LOCAL_LDFLAGS=/DEBUG

Once you have a valid binary with debug symbols you can easily debug Ethereal by opening up the binary from within MSVC.

So from within Visual Studio just click on the file/open menu, change the file extension type to be all files, then browse to the installed location of the Ethereal binary. Typically, c:\program files\ethereal... Once you have it open you should see ethereal.exe listed in the far left window of Visual Studio. To execute Ethereal just press the F5 key. If you want to break within some location within Ethereal then just open a source file and set a break point. The execution of Ethereal.exe will halt at the specific location. You can then step through the source code to isolate/debug you issue.