Author Topic: How to watch wxString under OSX from CodeBlocks and GDB ?  (Read 12246 times)

Offline eranon

  • Almost regular
  • **
  • Posts: 180
How to watch wxString under OSX from CodeBlocks and GDB ?
« on: February 15, 2013, 02:52:02 pm »
Hello. Talking about a wxWidgets-based project, under Windows, I use the well known pretty printing Python script for wxWidgets, but what about OSX ? I'm under OS X 10.6.8 and the GDB installed (I suppose coming with XCode 4) seems to be not python-enabled. Does it exist a python-enabled GDB under OSX ? Or is there another way to easily watch wxString values ?
[Independent dev. - wxWidgets 3.0.0 under "Win 7 Pro 64-bit, C::B SVN 9435 & wxSmith, TDM64-GCC 4.7 & MSVC9" + "OS X 10.8, FSF GCC 4.7 & C::B SVN 8909"]

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: How to watch wxString under OSX from CodeBlocks and GDB ?
« Reply #1 on: February 15, 2013, 03:10:28 pm »
You can try the "Enable watch script" option, but it won't work for wx2.9.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline eranon

  • Almost regular
  • **
  • Posts: 180
Re: How to watch wxString under OSX from CodeBlocks and GDB ?
« Reply #2 on: February 15, 2013, 03:43:36 pm »
Aaargh :-\ Thanks obfuscated, but my project is linked with wxWidgets 2.9.4.
[Independent dev. - wxWidgets 3.0.0 under "Win 7 Pro 64-bit, C::B SVN 9435 & wxSmith, TDM64-GCC 4.7 & MSVC9" + "OS X 10.8, FSF GCC 4.7 & C::B SVN 8909"]

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: How to watch wxString under OSX from CodeBlocks and GDB ?
« Reply #3 on: February 15, 2013, 03:44:52 pm »
Aaargh :-\ Thanks obfuscated, but my project is linked with wxWidgets 2.9.4.
Then you'll have to modify the script or you'll have to find a python enabled gdb.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline eranon

  • Almost regular
  • **
  • Posts: 180
Re: How to watch wxString under OSX from CodeBlocks and GDB ?
« Reply #4 on: February 15, 2013, 06:34:26 pm »
Then you'll have to modify the script.
Where is it ? In what language ? What's this difference between wx 2.8 and 2.9 that broken the mechanism ? I guess it's not a simple matter of data format coming from wxWidgets data classes.

Or you'll have to find a python enabled gdb
It would be the easiest and quickest, of course. Do you know one ?
[Independent dev. - wxWidgets 3.0.0 under "Win 7 Pro 64-bit, C::B SVN 9435 & wxSmith, TDM64-GCC 4.7 & MSVC9" + "OS X 10.8, FSF GCC 4.7 & C::B SVN 8909"]

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: How to watch wxString under OSX from CodeBlocks and GDB ?
« Reply #5 on: February 15, 2013, 06:50:56 pm »
It would be the easiest and quickest, of course. Do you know one ?
Yes, every major linux has one, for me macosx is something I want to stay away as much and as far as possible.

wx2.9 rewrote the string class, so the internals are very different and need newer scripts.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline eranon

  • Almost regular
  • **
  • Posts: 180
Re: How to watch wxString under OSX from CodeBlocks and GDB ?
« Reply #6 on: February 15, 2013, 07:27:00 pm »
Yes, every major linux has one, for me macosx is something I want to stay away as much and as far as possible.
Outside of OSX, of course, there're ;) But, obviously, I told about one which runs under OSX... However, originally, I'm like you (far away from Mac), but I can't forget it (no choice and it's the main part of my decision to go the cross-platform and wxWidgets way) just because there're a lot of Mac users in the field where my app will be released ::)

wx2.9 rewrote the string class, so the internals are very different and need newer scripts.
On C::B side, I guess its the script called "gdb_types.script" under "src/plugins" in SVN repo. I see it's written by MortenMacFly... Hello Morten :) Do you plan to update it for wx 2.9 ? ;D Or do you wait for wx 3.x :o
« Last Edit: February 15, 2013, 07:28:34 pm by eranon »
[Independent dev. - wxWidgets 3.0.0 under "Win 7 Pro 64-bit, C::B SVN 9435 & wxSmith, TDM64-GCC 4.7 & MSVC9" + "OS X 10.8, FSF GCC 4.7 & C::B SVN 8909"]

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: How to watch wxString under OSX from CodeBlocks and GDB ?
« Reply #7 on: February 15, 2013, 08:57:11 pm »
On C::B side, I guess its the script called "gdb_types.script" under "src/plugins" in SVN repo. I see it's written by MortenMacFly... Hello Morten :) Do you plan to update it for wx 2.9 ? ;D Or do you wait for wx 3.x :o
This script is something from the past. There are no plans to further improve it.

See this: http://doc.qt.digia.com/qtcreator/creator-debugger-engines.html
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline eranon

  • Almost regular
  • **
  • Posts: 180
Re: How to watch wxString under OSX from CodeBlocks and GDB ?
« Reply #8 on: February 15, 2013, 09:31:25 pm »
I agree about the fact a Python-enabled debugger would be the best way. In the page you pointed for me (thanks), I read (and I guess its the info you wanted I see) there's currently and experimental and unstable Python-enabled GDB for OSX around (the FSF GDB). Well, all depends of the level of unstability (i.e. what to avoid to do during a debugging session).

--
EDIT : Finally taken a try building current FSF GDB from Git repository, then codesigned it against a new certificate. Now it shows the wxString (not on a single ligne, but doesn't matter : it displays the structure and I can navigate to see useful data), but I can't always do what I want about breakpoints, steps, and sometimes I can't stop it (I have to close C::B)... Well, so, not sure at this step what to do : go on with erratic FSF GDB or use Apple-restricted GDB w/o full watching feature... Well, well ::)
« Last Edit: February 16, 2013, 02:09:35 am by eranon »
[Independent dev. - wxWidgets 3.0.0 under "Win 7 Pro 64-bit, C::B SVN 9435 & wxSmith, TDM64-GCC 4.7 & MSVC9" + "OS X 10.8, FSF GCC 4.7 & C::B SVN 8909"]

Offline eranon

  • Almost regular
  • **
  • Posts: 180
Re: How to watch wxString under OSX from CodeBlocks and GDB ?
« Reply #9 on: February 06, 2014, 07:58:10 pm »
up

Still in trouble with gdb under OSX from within Codeblocks. Well,

1) If I use the Apple-flavor of gdb, I have no Python support and can just check the "Enable watch scripts" ("Watch local variable" being pre-enabled and greyed)... But it doesn't show anything during debugging (knowing, talking about a wxWidgets-based project, I can at least see a wxString structure like a raw tree using this same gdb from command line). So, if I refer to this old thread, chance the underlying script be broken. Is there a plan to update it ?

2) If I use a Python-enabled FSF gdb, it seems I fall in an incompatibility with the binaries produced by the Apple LLVM GCC 4.2 shipped with the Xcode tools (an info coming from the FSF gdb mailing-list where I've asked). So, is there another Python ebaled gdb which would be LLVM GCC 4.2 compliant and supported by Codeblocks ?
[Independent dev. - wxWidgets 3.0.0 under "Win 7 Pro 64-bit, C::B SVN 9435 & wxSmith, TDM64-GCC 4.7 & MSVC9" + "OS X 10.8, FSF GCC 4.7 & C::B SVN 8909"]

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: How to watch wxString under OSX from CodeBlocks and GDB ?
« Reply #10 on: February 07, 2014, 01:10:20 am »
1) If I use the Apple-flavor of gdb, I have no Python support and can just check the "Enable watch scripts" ("Watch local variable" being pre-enabled and greyed)... But it doesn't show anything during debugging (knowing, talking about a wxWidgets-based project, I can at least see a wxString structure like a raw tree using this same gdb from command line). So, if I refer to this old thread, chance the underlying script be broken. Is there a plan to update it ?
No, the only change I'll do about it in the future is to remove it. There is no point in wasting time, because it is slow, hard to extend and unreliable.

Quote
2) If I use a Python-enabled FSF gdb, it seems I fall in an incompatibility with the binaries produced by the Apple LLVM GCC 4.2 shipped with the Xcode tools (an info coming from the FSF gdb mailing-list where I've asked). So, is there another Python ebaled gdb which would be LLVM GCC 4.2 compliant and supported by Codeblocks ?
I'm no mac user, so I can't help much. Probably in the future someone will find the time to write a lldb debugger plugin for codeblocks, apple has abandoned the fsf toolchain, so I won't expect any improvements in gcc/gdb in the future.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline eranon

  • Almost regular
  • **
  • Posts: 180
Re: How to watch wxString under OSX from CodeBlocks and GDB ?
« Reply #11 on: February 07, 2014, 06:18:04 pm »
Well, it's what I was afraid about :-\ Thanks for this point, Obfuscated, but, then, the question is : How do the ones who are using Code::Blocks under OS X ? If there are some Mac-men around, I would be very interested to hear them (for sure).
[Independent dev. - wxWidgets 3.0.0 under "Win 7 Pro 64-bit, C::B SVN 9435 & wxSmith, TDM64-GCC 4.7 & MSVC9" + "OS X 10.8, FSF GCC 4.7 & C::B SVN 8909"]

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: How to watch wxString under OSX from CodeBlocks and GDB ?
« Reply #12 on: February 07, 2014, 08:06:40 pm »
We need someone using OSX and willing to invest time improving C::B on it. Until then the situation won't improve much. Sorry.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline eranon

  • Almost regular
  • **
  • Posts: 180
Re: How to watch wxString under OSX from CodeBlocks and GDB ?
« Reply #13 on: February 07, 2014, 10:47:17 pm »
I understand. I discover myself everyday the black-box that OSX is and frankly if I had the choice I would stay away.. Hoping you'll find a Mac dev soon ;)
« Last Edit: February 07, 2014, 10:49:53 pm by eranon »
[Independent dev. - wxWidgets 3.0.0 under "Win 7 Pro 64-bit, C::B SVN 9435 & wxSmith, TDM64-GCC 4.7 & MSVC9" + "OS X 10.8, FSF GCC 4.7 & C::B SVN 8909"]

Offline eranon

  • Almost regular
  • **
  • Posts: 180
Re: How to watch wxString under OSX from CodeBlocks and GDB ?
« Reply #14 on: February 12, 2014, 03:54:02 am »
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/12923873/how-to-print-wchar-t-string-in-lldb).

Of course, not to say that all of this is a solution awaiting a LLDB plugin for Code::Blocks ;D

--
EDIT : since I opened a similar thread on the wx forum, I duplicate this final post over there too.
« Last Edit: February 12, 2014, 03:57:00 am by eranon »
[Independent dev. - wxWidgets 3.0.0 under "Win 7 Pro 64-bit, C::B SVN 9435 & wxSmith, TDM64-GCC 4.7 & MSVC9" + "OS X 10.8, FSF GCC 4.7 & C::B SVN 8909"]