Wireshark-dev: Re: [Wireshark-dev] Not hitting some breakpoints with CLion macOS

From: Anders Broman <anders.broman@xxxxxxxxxxxx>
Date: Tue, 18 Dec 2018 09:20:03 +0000

Hi,

Can you push the patch trough gerrit?

Regards

Anders

 

From: Wireshark-dev <wireshark-dev-bounces@xxxxxxxxxxxxx> On Behalf Of Jan Venekamp
Sent: den 17 december 2018 19:36
To: wireshark-dev@xxxxxxxxxxxxx
Subject: Re: [Wireshark-dev] Not hitting some breakpoints with CLion macOS

 

Thank you for pointing to the line pragmas. It turns out CLion does not like these (or maybe there is some setting I could not found).
After setting the -L flag of asn2wrs.py in epan/dissectors/asn1/ulp/CMakeLists.txt and regenerating the ulp dissector I was able to step through the code.

I had to patch the asn2wrs.py script though. Because even with the -L switch it was still outputting line pragmas. Attached is the patch I made.

Kind regards,
Jan Venekamp

On 08/12/2018 06:17, Anders Broman wrote:

 

Den lör 8 dec. 2018 02:44 skrev Jan Venekamp <jan@xxxxxxxxxxxx>:

Hi,

Taking my first steps into Wireshark development, I have successfully
made a first attempt at writing and running a dissector plugin.

However, I am running into some problems while debugging. It seems that
some breakpoint are not hit.

First some observations:
Wireshark #332df92, CLion 2018.3.1, macOS 10.13.6.
In order to successfully build I have to:
- Dissable these in CMakeLists.txt: -Wextra-semi -Wcomma
- Add the following option to cmake (using qt5 from Homebrew):
-DCMAKE_CXX_FLAGS:STRING=-I/usr/local/opt/qt5/include
Full cmake command:
/Applications/CLion.app/Contents/bin/cmake/mac/bin/cmake
-DCMAKE_BUILD_TYPE=Debug
-DCMAKE_CXX_FLAGS:STRING=-I/usr/local/opt/qt5/include -G "CodeBlocks -
Unix Makefiles" /Users/jan/ews/c/wireshark

Then I can build with with CLion and run the wireshark executable. When
I put a breakpoint on the proto_register function of the plugin I am
writing it hits just fine and I am able to step through the code. The
same goes for other plugins. So for example a breakpoint in
proto_register_wimax in plugins/epan/wimax/packet-wmx.c hits. Or setting
a breakpoint in main in ui/qt/main.cpp will also hit.

However, when I set a breakpoint in proto_register_ulp (or other
functions) in epan/dissectors/packet-ulp.c it won't hit. I do not
understand, Is there something I am missing here? I would really like to
step through the code of some of these dissectors.

Any help would be greatly appreciated.

Kind regards,
Jan Venekamp

Debugging the generated dissectors can be a pain. If I remember correctly you can set breakpoints in the cnf or template file. You can also regenerate the dissector with an option to not use line numbers relative to the cnf file. Debug printfs or break points in the ber or per dissectors is also alternatives. 

Regards 

Anders 

___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <wireshark-dev@xxxxxxxxxxxxx>
Archives:    https://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://www.wireshark.org/mailman/options/wireshark-dev
             mailto:wireshark-dev-request@xxxxxxxxxxxxx?subject=unsubscribe



___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <wireshark-dev@xxxxxxxxxxxxx>
Archives:    https://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://www.wireshark.org/mailman/options/wireshark-dev
             mailto:wireshark-dev-request@xxxxxxxxxxxxx?subject=unsubscribe

 

Attachment: smime.p7s
Description: S/MIME cryptographic signature