Wireshark-dev: Re: [Wireshark-dev] Printing?
From: Graham Bloice <graham.bloice@xxxxxxxxxxxxx>
Date: Wed, 14 Apr 2010 14:22:30 +0100
On 14/04/2010 14:00, Shawn Mayer wrote:
On 14/04/2010 01:59, Shawn Mayer wrote:
Do I have to use something other than printf to print from Wireshark? I
have the console set to always open, but still am not seeing anything.
Thanks.

  
Run it under the debugger, much easier than printf.

Is the debugger only for linux?

(Replying to the list for the benefit of others.)

Nope, works fine on Windows as well.  I can't speak for the Express versions of Visual Studio, but certainly for Pro version upwards I regularly use the debugger with Wireshark.  The way I do it is shown below and is using VS2005 Professional.  Menu names etc. might be different in other versions:
  1. Assuming you have built Wireshark somewhere {wiresharkPath}, cd into the resultant directory with the executable and all the required DLL's {wiresharkPath\wireshark-gtk2}.
  2. Start Wireshark from this directory with any required command line options (wireshark.exe ...).
  3. In Visual Studio, from the Tools menu select "Attach to Process...".
  4. From the resultant dialog locate the wireshark.exe process and click the "Attach" button.
  5. To set a breakpoint, open the appropriate source file using "File | Open | File..." (from wherever in {wiresharkPath}) and place a BP in the normal VS manner.
  6. Do whatever you need in WS to cause your BP to be hit.  Occasionally VS will ask where to find a source file if you step into another module, just point it at the appropriate directory under {wiresharkPath}
-- 
Regards,

Graham Bloice