What debugger do you use under OS X ?

Do you have a typical platform dependent issue you're battling with ? Ask it here. Make sure you mention your platform, compiler, and wxWidgets version.
Post Reply
User avatar
eranon
Can't get richer than this
Can't get richer than this
Posts: 867
Joined: Sun May 13, 2012 11:42 pm
Location: France
Contact:

What debugger do you use under OS X ?

Post by eranon »

Hello,

Being in the porting of my project toward OS X (built for i386 arch with the GCC 4.2 coming with the XCode 4.2's tools under OS X 10.6 Snow Leopard), I'm confronted with the difficulty to watch the wxWidgets structures during debugging (mainly the most used wxString of course). I'm using Codeblocks as IDE and because it provides a plugin to integrate the GNU debugger (gdb), I'm already used to use gdb under Windows... But under OS X (at least the version under the one I am), the gdb provided by Apple with the XCode tools is not Python enabled (so no pretty printer and no way to see the wxString).

Then, I've taken a try with the Python-enabled FSF gdb as per http://sourceware.org/gdb/wiki/BuildingOnDarwin (currently the 7.6), but it seems to be totally lost with my source code and the debug info generated by the Apple flavour of GCC 4.2). First breakpoint is honored, but it doesn't find the next line and issue a "cannot find bounds of current function" ; of course, I've tried this from command line and not through CodeBlocks to be as direct as possible. And, of course too, at this step not any pretty printer is involved (it's the next stage).

So, I ask you : what debugger (a specific gdb version preferably, to operate from Codeblocks, but if not possible, I'll use another front-end to debug) do you use for your wxWidgets-based projects under OS X ?
[Ind. dev. - wxWidgets 3.0/3.1 under "Win 7 64-bit, TDM64-GCC" + "OS X 10.9, LLVM Clang"]
eranif
Moderator
Moderator
Posts: 610
Joined: Tue Nov 29, 2005 7:10 pm
Location: Israel

Re: What debugger do you use under OS X ?

Post by eranif »

Your best bet is gdb 6.3.5 (which is apple build)
Other than that, lldb (which is the clang based debugger) is the next generation debugger for OSX

Note that I am using gdb 6.3.5 on OSX, until the lldb interface for codelite will be ready :P

GDB 6.3.5 works without a problem inside CodeLite IDE, however, like you discovered, the 6.3.5 version has no Python enabled - which makes watching wxString variable a little bit more trickier (in codelite, the tooltip is wxTreeCtrl based, so you need to perform 2 more clicks to view it), but other than that it should function normally
eranon wrote:so no pretty printer and no way to see the wxString
Not really true... You could view wxString by checking its internal members - this is how I do it

Ofc, CodeBlocks is not my IDE (for the obvious reasons), but you should be able to work with GDB 6.3.5

Eran
IDE: CodeLite + wxCrafter
OS: All
https://wxcrafter.codelite.org
https://codelite.org
User avatar
eranon
Can't get richer than this
Can't get richer than this
Posts: 867
Joined: Sun May 13, 2012 11:42 pm
Location: France
Contact:

Re: What debugger do you use under OS X ?

Post by eranon »

Thanks for your feedback, eranif. Until now I assumed I couldn't watch any wxWidgets structure with the Apple-flavor gdb, but it's true that I didn't even tried these days... Well, I'll take a new try from within Codeblocks (re-enabling the default watch option ; not the Python one) against Apple gdb and will tell you here.

In parallel, I opened a thread about LLVM GCC 4.2 and FSF gdb in the gdb mailing-list... At this stage, chance there is an incompatibility (see the Tristan post in the thread)... But maybe it could change a day : http://sourceware-org.1504.n7.nabble.co ... 59756.html

And maybe the other question (for another approach) could be this one : Is it possible to go with a not-Apple GCC under OSX ? A one with more probability to be FSF gdb compliant.

--
EDIT : Re-tried with Apple gdb from with Codeblocks and it doesn't work (not any variable shown) ; but found a thread I opened at beginning of 2013 on the C::B's forum about this (then, just relaunched it) : http://forums.codeblocks.org/index.php/ ... 4.new.html. Using this same Apple gdb from command line allows me to see a wxString in its raw state (with members tree). So, to stay with Codeblocks under OSX with Apple-flavor gdb would certainly require to update the C::B's internal script about variable watching.
[Ind. dev. - wxWidgets 3.0/3.1 under "Win 7 64-bit, TDM64-GCC" + "OS X 10.9, LLVM Clang"]
User avatar
eranon
Can't get richer than this
Can't get richer than this
Posts: 867
Joined: Sun May 13, 2012 11:42 pm
Location: France
Contact:

Re: What debugger do you use under OS X ?

Post by eranon »

SOLVED. Final point (if it can help someone), all of this under OS X 10.8.3 Mountain Lion :

As I said in a previous post above, I needed a Python-enabled debugger and the Apple LLVM-GDB is not, So, I installed a FSF-GDB (6.3 from Homebrew), but it was incompatible with the binaries produced by LLVM-GCC (4.2)... Then, I installed a FSF-GCC (4.7), but for a reason I don't succeed to define, it was wrong too with these new binaries (weird!). Nevertheless this step was not useless since I got ride of the GCC's Apple-flavor and decided to keep the true FSF one (as under MSW I don't use MSVC but MinGW-GCC).

GDB (both LLVM and FSF) being eliminated, I taken a try with the LLDB shipped with Xcode (4.6), and it worked with my binaries coming from FSF-GCC) Next step was to install the last current LLDB (ie. from SVN HEAD) and to find a good front-end : the choice being very poor, I tried the current beta of Affinic Debugger GUI and it works fine (at least with the LLDB 300.x I have now). Next step will be to manage at Python-side to be able to watch wxWidgets's structures (e.g. about wxString, seen this http://stackoverflow.com/questions/1292 ... ng-in-lldb).

Of course, not to say that all of this is a solution awaiting a LLDB plugin for Code::Blocks (the IDE I'm already using under MSW and OSX) ;D

--
EDIT : since I opened a similar thread on the C::B forum, I duplicate this final post over there.

EDIT2 : forgotten : and good luck for your LLDB interfacing in CodeLite, Eranif :wink:
[Ind. dev. - wxWidgets 3.0/3.1 under "Win 7 64-bit, TDM64-GCC" + "OS X 10.9, LLVM Clang"]
eranif
Moderator
Moderator
Posts: 610
Joined: Tue Nov 29, 2005 7:10 pm
Location: Israel

Re: What debugger do you use under OS X ?

Post by eranif »

eranon wrote:EDIT2 : forgotten : and good luck for your LLDB interfacing in CodeLite, Eranif
Thanks

The plugin is ready for testing on OSX/Linux. If you want a bundle of codelite with the plugin included drop me a message.
Here is a screenshot on it looks while debugging a small wxWidgets application on OSX

http://codelite.org/images/tmp/osx-lldb.png

You can use it as standalone debugger (without porting your code to codelite), simply running with the 'Quick Debug' option:
Debugger-> Quick Debug

And select the program you want to debug

Eran
IDE: CodeLite + wxCrafter
OS: All
https://wxcrafter.codelite.org
https://codelite.org
User avatar
eranon
Can't get richer than this
Can't get richer than this
Posts: 867
Joined: Sun May 13, 2012 11:42 pm
Location: France
Contact:

Re: What debugger do you use under OS X ?

Post by eranon »

:) Quick reply in speedy mode : I'm a little bit busy just now (releasing my first alpha OSX today), but thanks a lot for your proposition, eranif. Obviously, I'm interested ! As you know I'm under C::B and like it, but very disappointed about its "retard" under Mac (including lldb support). So, in the future (I can't change "higgledy-piggledy"), all is possible, anyway I have to go forward... And nice to know you thought CodeLite to be able to act as lldb front-end w/o project migration : nice ! If you're agree, you're welcome in my mailbox indicated in my site. Otherwise, I'll send you a mail asap (not sure today). Thanks again !
[Ind. dev. - wxWidgets 3.0/3.1 under "Win 7 64-bit, TDM64-GCC" + "OS X 10.9, LLVM Clang"]
eranif
Moderator
Moderator
Posts: 610
Joined: Tue Nov 29, 2005 7:10 pm
Location: Israel

Re: What debugger do you use under OS X ?

Post by eranif »

eranon wrote:And nice to know you thought CodeLite to be able to act as lldb front-end w/o project migration : nice
Yes, this feature is implemented since we first integrated gdb into codelite, so continuing this direction with lldb only seems naturally
I will try to find some time to package codelite on OSX this weekend and send you a link for the download

Eran
IDE: CodeLite + wxCrafter
OS: All
https://wxcrafter.codelite.org
https://codelite.org
User avatar
eranon
Can't get richer than this
Can't get richer than this
Posts: 867
Joined: Sun May 13, 2012 11:42 pm
Location: France
Contact:

Re: What debugger do you use under OS X ?

Post by eranon »

Thanks a lot, Eranif. As I told you some seconds ago by PM : nothing urgent (since I'm on another subject ](*,) just now) and have a good week-end, first ;)
[Ind. dev. - wxWidgets 3.0/3.1 under "Win 7 64-bit, TDM64-GCC" + "OS X 10.9, LLVM Clang"]
eranif
Moderator
Moderator
Posts: 610
Joined: Tue Nov 29, 2005 7:10 pm
Location: Israel

Re: What debugger do you use under OS X ?

Post by eranif »

Hi eranon,
I just uploaded the initial plugin for testers.
See here:

http://forums.codelite.org/viewtopic.ph ... 469#p11469

Eran
IDE: CodeLite + wxCrafter
OS: All
https://wxcrafter.codelite.org
https://codelite.org
User avatar
eranon
Can't get richer than this
Can't get richer than this
Posts: 867
Joined: Sun May 13, 2012 11:42 pm
Location: France
Contact:

Re: What debugger do you use under OS X ?

Post by eranon »

Thanks Eran. You're fast (more than me) ;) Still in some troubles (not about libstdc++, but min OSX SDK this time) with my OSX builds (maybe I'll open a thread if I don't see any way), but as soon as possible, I'll download CodeLite and your fresh plugin ^^
[Ind. dev. - wxWidgets 3.0/3.1 under "Win 7 64-bit, TDM64-GCC" + "OS X 10.9, LLVM Clang"]
Post Reply