Use the debug version of the libraries and step down into the library code
to see where it actually fails.
D> OK I set a break point and got the debugger to stop on that line of
D> code. Now how do I step into the wxWidgets code?
What do you mean? There is nothing special about stepping into wxWidgets
code, you do it in exactly the same way as with any other code.
D> By the way, I looked at some documentation on debugging wxwidgets:
D> http://docs.wxwidgets.org/trunk/overview_debugging.html .. it does not
D> make much sense to me. Do I need to define __WXDEBUG__ ?
I don't know/remember which platform/version do you use but to debug wx
itself you need to build it in debug build, i.e. using --enable-debug when
using configure. You never need to define __WXDEBUG__ manually.
Regards,
VZ
--
TT-Solutions: wxWidgets consultancy and technical support
http://www.tt-solutions.com/
D> > I don't know/remember which platform/version do you use but to debug wx
D> > itself you need to build it in debug build, i.e. using --enable-debug when
D> > using configure. You never need to define __WXDEBUG__ manually.
D> >
D>
D> I must be doing something wrong:
D>
D> tux tb # make
D> g++ -Wall -g -o0 client.cpp login.cpp -o tbclient.exe `wx-config --
D> cxxflags` `wx-config --libs` `wx-config --enable-debug`
D> *** Error: Unrecognised option: '--enable-debug'
You need to specify it when building wx, not when building your
application. I.e. when you run wx configure you must pass --enable-debug to
it.
D> OK, I set debug on using `wx-config --debug`in my compilation.
D>
D> But if I set a break point at the Execute command and then do step it
D> simply calls Execute but does not step into it:
D>
D> Breakpoint 1, TBClientFrame::Login (this=0x1d9b150, login=@0x1e5d590,
D> passwd=@0x1e5d598) at client.cpp:82
D> 82 tmpptr->Execute((wxChar*) tmp.c_str());
D> (gdb) s
D>
D> Program received signal SIGSEGV, Segmentation fault.
D> 0x000000000040c273 in TBClientFrame::Login (this=0x1d9b150,
D> login=@0x1e5d590, passwd=@0x1e5d598) at client.cpp:82
D> 82 tmpptr->Execute((wxChar*) tmp.c_str());
D>
D>
D> How do I actually step into the Execute function?
It looks like you still don't have debug information for wx somehow, it
definitely should step inside otherwise. Doesn't gdb complain about it?
On an unrelated note, this casting to wxChar* is a really bad idea. It
might be harmless here but you will definitely regret it if you take a
habit of doing it. Just call Execute(tmp) unless you have some really good
reason to not do it.
I think you're misunderstanding what Vadim is saying.
You need to rebuild the entire wxWidgets libraries in debug mode,
not just your application. As in, go to your wxWidgets build directory,
invoke "configure" with the appropriate options (--enable-debug
among them), then "make".
Note that "configure" and "wx-config" are two very different scripts.
"configure" generates the makefiles for building wxWidgets; it is
something you call before building or re-building wxWidgets.
"wx-config" is something you call after wxWidgets is already built;
it simply tells you what flags you need to pass to your compiler
and linker to build your application.
Regards,
Nate.
_________________________________________________________________
Eligible CDN College & University students can upgrade to Windows 7 before Jan 3 for only $39.99. Upgrade now!
http://go.microsoft.com/?linkid=9691819