Debugging wxWidgets library code

General questions regarding the usage of CodeLite
coder99
CodeLite Expert
Posts: 147
Joined: Wed Oct 22, 2008 6:50 am
Contact:

Debugging wxWidgets library code

Post by coder99 » Wed Mar 07, 2018 3:32 am

I have seen only one other reference in this forum to this issue and I think I have followed the same advice given there, but I still don't seem to be able to see the wxWidgets source code displayed.
I have compiled the 3.1.0 libraries with:

Code: Select all

~/public/wxWidgets-3.1.0/gtk-build$ ../configure --enable-debug --enable-debug_gdb --prefix=$(pwd)
When I open my app under CL, I can seem to step into the wxWidgets code in that the Call Stack window shows that I am stepping through the library code, but the source code window does not reflect the corresponding source lines

Just now I have realized the the file path shown in the call stack window refers to

Code: Select all

 /home/david/devel/packages/wx/3.1.0/wxwidgets3.1-3.1.0/objs_gtk_sh/../src/gtk/toplevel.cpp
a path which obviously does not exist on my system - How can I fix this???
PS: I did a complete rebuild after the compile mentioned above before trying to debug & step into the libraries.
My initial libraries did come from the Codelite web pages, but the source I compiled from did not
Win 10 64-bit, MSVC 2017/2019, wxWidgets 3.1.0, CodeLite 13.0 Mint 19.2
Fight Spam, report it with wxSR

DavidGH
CodeLite Plugin
Posts: 605
Joined: Wed Sep 03, 2008 7:26 pm
Contact:

Re: Debugging wxWidgets library code

Post by DavidGH » Wed Mar 07, 2018 2:24 pm

Hi,
/home/david/devel/packages/wx/3.1.0/wxwidgets3.1-3.1.0/objs_gtk_sh/../src/gtk/toplevel.cpp
a path which obviously does not exist on my system
That looks like a path from my unofficial wx3.1.0 packages build. There's no way that you can have got that from building your own wx3.1.0 from the official wx source.
Did you uninstall all the unofficial packages, including the debug ones? And how? Using apt or by hand?

What is the result (in terms of paths) of doing, in a terminal:
wx-config --libs

Do you have any stale paths in your Project Settings? Look in particular in the Compiling, Linking and Debugging sections. Also in Environment if you added anything there, and ditto in the global Settings > Environment Variables.

If none of the above seems helpful, try debugging your program again; this time turn on 'Enable full debugger logging' from Settings > GDB Settings: Misc or with the checkbox in the Output pane in the Debugger view. That should show the filepath of each lib's debug symbols that are loaded. e.g. one relevant line for me is:

Code: Select all

DEBUG>>=library-loaded,id="/home/david/devel/git/wx/udb/lib/libwx_gtk2u_xrc-3.1.so.1",target-name="/home/david/devel/git/wx/udb/lib/libwx_gtk2u_xrc-3.1.so.1",host-name="/home/david/devel/git/wx/udb/lib/libwx_gtk2u_xrc-3.1.so.1",symbols-loaded="0",thread-group="i1"
=library-loaded,id="/home/david/devel/git/wx/udb/lib/libwx_gtk2u_xrc-3.1.so.1",target-name="/home/david/devel/git/wx/udb/lib/libwx_gtk2u_xrc-3.1.so.1",host-name="/home/david/devel/git/wx/udb/lib/libwx_gtk2u_xrc-3.1.so.1",symbols-loaded="0",thread-group="i1"
so you can see my local wx build is in /home/david/devel/git/wx/udb/

Regards,

David

coder99
CodeLite Expert
Posts: 147
Joined: Wed Oct 22, 2008 6:50 am
Contact:

Re: Debugging wxWidgets library code

Post by coder99 » Wed Mar 07, 2018 10:58 pm

DavidGH wrote: What is the result (in terms of paths) of doing, in a terminal:
wx-config --libs
...old@xeon:/usr/include$ wx-config --libs
-L/usr/local/lib -pthread /usr/local/lib/libwx_gtk2u_xrc-3.1.a /usr/local/lib/libwx_gtk2u_qa-3.1.a /usr/local/lib/libwx_baseu_net-3.1.a /usr/local/lib/libwx_gtk2u_html-3.1.a /usr/local/lib/libwx_gtk2u_adv-3.1.a /usr/local/lib/libwx_gtk2u_core-3.1.a /usr/local/lib/libwx_baseu_xml-3.1.a /usr/local/lib/libwx_baseu-3.1.a -lgthread-2.0 -pthread -lX11 -lXxf86vm -lSM -lgtk-x11-2.0 -lgdk-x11-2.0 -lpangocairo-1.0 -latk-1.0 -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lpangoft2-1.0 -lpango-1.0 -lgobject-2.0 -lglib-2.0 -lfontconfig -lfreetype -lpng -lexpat -lwxregexu-3.1 -lwxtiff-3.1 -lwxjpeg-3.1 -lz -ldl -lm
DavidGH wrote: Do you have any stale paths in your Project Settings? Look in particular in the Compiling, Linking and Debugging sections. Also in Environment if you added anything there, and ditto in the global Settings > Environment Variables.
None that I could find, though by now I have manually cleaned out all the 'unofficial' items and recompiled wxWidgets from source. However, I now have to sort out all of the missing paths and will have to see where that gets me.
Thank you for the info on how to check what the debugger sees. Last I still had a good compile, it was still looking for the path on your system
[edit]
After recompiling all of the source and doing a 'make install' as I wanted to be sure it all 'took' - and ignoring wxWidgets 3.1.1 for now, I was able to compile my app and step into the wxWidgets code. Still have to sort out some other issues, but this one is resolved, though it seems I would not be able to use the unofficial' code, if I need to trace into wxWidgets code.
Win 10 64-bit, MSVC 2017/2019, wxWidgets 3.1.0, CodeLite 13.0 Mint 19.2
Fight Spam, report it with wxSR

DavidGH
CodeLite Plugin
Posts: 605
Joined: Wed Sep 03, 2008 7:26 pm
Contact:

Re: Debugging wxWidgets library code

Post by DavidGH » Thu Mar 08, 2018 12:17 am

...old@xeon:/usr/include$ wx-config --libs
-L/usr/local/lib
Did you 'make install' your '--prefix=' wx build? I normally don't; it's designed to be used inside the pwd. You access it by pointing to that wx-config in your terminal's $PATH, or by using a /full/path/to/that/wx-config in your Compilation and Linking settings.
Anyway, you seem to be finding the correct wx-config.

Another thing you can usefully do is:
ldd /path/to/your/program
and see what wx libs it actually links to. I did that in a ubuntu xenial virtualbox guest with my unofficial wx packages installed. It gave results like:

Code: Select all

libwx_gtk2u_unofficial_xrc-3.1.so.1 => /usr/lib/x86_64-linux-gnu/libwx_gtk2u_unofficial_xrc-3.1.so.1 (0xb7642000)
The equivalent gdb output with full debugging enabled:

Code: Select all

DEBUG>>=library-loaded,id="/usr/lib/x86_64-linux-gnu/libwx_gtk2u_unofficial_xrc-3.1.so.1",target-name="/usr/lib/x86_64-linux-gnu/libwx_gtk2u_unofficial_xrc-3.1.so.1",host-name="/usr/lib/x86_64-linux-gnu/libwx_gtk2u_unofficial_xrc-3.1.so.1",symbols-loaded="0",thread-group="i1"
If all else fails, what happens if you create a new project from one of the C++ with Gui templates, and build and debug that? Does that still find the wrong debug symbols? If not, you'll know it's some stale entry in the settings of your real project. You could open your ${projectname}.project file in an editor and see if you can spot any.

coder99
CodeLite Expert
Posts: 147
Joined: Wed Oct 22, 2008 6:50 am
Contact:

Re: Debugging wxWidgets library code

Post by coder99 » Thu Mar 08, 2018 4:27 am

Initially, I did use --prefix-$(pwd) and make install, but seemed to have problems with Codelite finding files etc.
So I recompiled without the --prefix and then did a make install, which made things work.
Still, I'll keep your recommendations in mind, as I am sure to need them not too long from now.

It allowed me to trace into the wxDialUpManager code and left me with some questions for the people looking after it, but, this issue too is now somewhat lower on my priority totem pole.
Right now I want to make the essentials work and then I'll take a stab at the wibnis

As I am quite new to both Codelite & wxWidgets under Ubuntu, I will stick with the single wxWidgets 3.1.0 version and slowly make my way to the more complicated options /alternatives :)
Win 10 64-bit, MSVC 2017/2019, wxWidgets 3.1.0, CodeLite 13.0 Mint 19.2
Fight Spam, report it with wxSR

Post Reply