Kuan
Kuan

Reputation: 11389

How to debug in Wxwidgets?

I am new to wxWidgets. So far, the most upsetting thing to me is that sometimes, after I pass compile, and try to run the GUI App, it does not behave as I designed it, and I have no idea what is wrong with it. Someone suggested I try GDB, but I cannot find a tutorial of GDB on how to debug wxWidgets.

I wonder can someone give me some links, or teach me how to do that (mostly about how to trigger a event and stop there to look in that and continue running).

Upvotes: 0

Views: 1457

Answers (1)

VZ.
VZ.

Reputation: 22678

The two most common problems with wxWidgets seem to be:

  1. Layout problems when using sizers.
  2. Event handling problems.

Trying to solve (1) with a debugger is a bad idea. You can trace the layout algorithm if you really want to, but it probably only works well if you already know how does the algorithm works -- and so are unlikely to have such problems in the first place. If you are just beginning to use sizers, it's better to just try to recreate your layout in some visual dialog editor tool.

For (2), the obvious advice is to put a breakpoint (see gdb break command) in your event handler. At the very least, this gives you a reliable way of checking whether your event handler is called at all.

Otherwise I really don't think there are any wxWidgets-specific debugging tricks. Using the pretty printers from misc/gdb/print.py file included in wxWidgets sources is convenient, but you need to have a Python-enabled gdb for this.

Upvotes: 1

Related Questions