Debugging graphical applications in C ++

Reference Information. I am currently debugging an application written based on the C ++ user interface GUI. I managed to identify most of the errors, but the errors that I encountered most often have a common theme. All of them seem to be related to screen refresh, redraw or refresh to match the provided data. It hurts to debug, because I cannot break with every update, and most of this material is time sensitive, so breakpoints sometimes "fix" the error.

Q: Does anyone have any tips on debugging Windows-based GUIs, especially regarding updating individual components?

+4
source share
4 answers

I agree with two monitors, or even remote debugging, to reduce the clutter of messages.

I also highly recommend spyware utilities. They allow you to see which messages are sent to the system. One such program is the Winspector. http://www.windows-spy.com/

+6
source

This may not help, but I found using two monitors useful in this scenario. I have a debugger on one screen, and an application on another. Then I can go through the code and see how the application updates or does what is on another screen. There are still problems with the focus while doing this, but at least I can see when it is repainted.

+3
source

Registration is almost the only answer. Not knowing your infrastructure, I can’t give an exact answer, but basically I open the file and add messages to various procedures that interest you. Finally close it.

The message contains the values ​​of the variable you are interested in.

Also, using the message box window, it is useful to find out if you are in the correct branch or procedure. This has a minimal effect on the entire stream.

Finally, try downloading one of the express versions of .NET and use Winforms to try to test especially problematic areas. Although Winform is its own structure, there is a high degree of correspondence between this control and those provided by Windows.

I support the modeling of Project Mercury Capsule as an add-on for Space Simulator for orbitals. It is written in C ++ and should use Win32 directly for some panels and dialogs. There were times when I ran VB6 (later VB.NET) to develop complex interactions, and then converted it to the Win32 equivalent in C ++.

However, this is a last resort.

+3
source

Having a double screen really helps in debugging update / redraw issues for Windows controls and the user interface.

Having the application on the second screen will not cause the debugger to generate "invalidate" on the main screens of the user interface when it breaks into a debugging checkpoint.

If you don’t have a second screen, try using both applications side by side so that the application and the debugger do not interfere.

0
source

All Articles