I am writing an amf plugin . I want to debug it during live packet capture. Is it possible? asked 06 Nov '12, 21:15 Akhil edited 09 Nov '12, 02:29 Kurt Knochner ♦ |
One Answer:
Sure, although processing the captured packets will necessarily be inhibited while you have the program halted in the debugger. Due to the vagaries of network transmissions I think that attempting to do so will make your debugging much more difficult. Why not just capture the amf traffic to a file, then in your debug session load the capture file. This will allow you to debug the dissector in a much more controlled fashion as you know what packets should be there (by prior inspection of the raw packet data before dissection). answered 07 Nov '12, 00:25 grahamb ♦ showing 5 of 19 show 14 more comments |
But how to start a debug session???? I couldn't find debug console in Edit->Preferences
Go to "Edit->Preference". In the option "Open a console window", change it from "Never" to "Always(debugging)" and click "Apply"
The console window allows "printf" style debugging. This may be all you require, but you can also use whatever other debuggers your Os supports, e.g. gdb for linux and other unicies, or WinDBg and Visual Studio for Windows.
I couldn't find the option "Open a console window" in Edit->Preferences. I am using wireshark 1.7.0 in Ubuntu 10.04
Linux doesn't need this option, just launch Wireshark from a terminal window.
I am launching wireshark from terminal. How to start debug session??????????????
As said earlier nothing will be shown there unless you add debug code to your plugin.
how to add debug code???
By typing? - seriosly - you need to have an idea of what you want to "debug" say a value of a variable before a switch statment or something like that. Try browsing the code of other dissectors to see how people have done things there ( grep -r DRBUG * )(grep -r g_warning *). If you say you want to do debuging that implies something is not working as expected so you need to find out why another wy is to try to find similar code and figure ut how that works.
I need to set breakpoints in my plugin. How should I do it?
You will need to run Wireshark in a debugger then. gdb is the usual debugger on your platform, but there are some wrinkles to running Wireshark under the debugger. If you have a look at the Developers Guide there is a section on debugging
I tried debygging using DDD.When i open my plugin .c file. the debugger prompts "File format not recognised"
Akhil, this is the Wireshark Q&A site. If you have specific questions about a certain debugger (DDD), I recommend to visit a forum dedicated to that debugger or ask the question in stackoverflow.com (a Q&A site dedicated to programming).
Furthermore, the documentation of DDD contains a fairly good tutorial how to use DDD.
BTW: Did you read the Dev Guide section about debugging and the way how to run ddd?
I have read the Dev Guide section about debugging....but could find how to set breakpoint?????
see my comment in your other question.
I have added "g_printf()" statement in my code.....but where could i find it printed?????
Nothing is printed on the console
see my comment in your other/same question:
Besides setting the Breakpoint manually in the debugger, you can use the macro G_BREAKPOINT() anywhere in your code. Code execution will stop as soon as that statement gets executed and the debugger will "jump" to the next line of code and wait for your commands. Tested with ddd on Ubuntu 12.04.
Thanks Kurt. I added G_BREAKPOINT() in my dissector and I could debug my dissector using gdb successfully