Jump to content
  • Advertisement
Sign in to follow this  
skyfire360

Unity Visual Studio Debugging Tricks

This topic is 3902 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Advertisement
I wouldn't call that a "trick", so much as "how you use the debugger". Regardless, among the most useful and most overlooked features of the debugger are conditional breakpoints and data breakpoints.

Share this post


Link to post
Share on other sites
True, but conditional breakpoints and data breakpoints are present in most modern debuggers (VS, gdb, etc). I was under the assumption (and I could very well be wrong) that this was exclusive to the Visual Studio debugging environment (akin to toying around with autoexp.dat).

Share this post


Link to post
Share on other sites
Here's one:

OutputDebugString("testing");

This will print a message out into the debug area when it hits the code during runtime.

There's also

( #pragma message which you can use to output a message at compile time)

I also find it useful to do


#pragma warning (push)
#pragma warning (disable : 4996 )

//deprecated code here

#pragma warning (pop)


to avoid obscuring the debug window with warnings..

Share this post


Link to post
Share on other sites
Quote:
Original post by skyfire360
True, but conditional breakpoints and data breakpoints are present in most modern debuggers (VS, gdb, etc). I was under the assumption (and I could very well be wrong) that this was exclusive to the Visual Studio debugging environment (akin to toying around with autoexp.dat).
The syntax might be, but I've never used a debugger without this feature. Under GDB, you use an at-sign instead of a comma. Actually, data breakpoints are probably the least common debugger feature, because of the hardware support required.

Share this post


Link to post
Share on other sites
I find tracepoints invaluable, especially when debugging UI code where breaking into the debugger interferes with the scenario. Typically I set tracepoints on interesting functions to log calls, parameters, and other state.

Share this post


Link to post
Share on other sites
Quote:
Original post by yahastu
OutputDebugString("testing");

Minor warning on this one: If you don't have a debugger attached to listen to the string, Windows will set the error flag on GetLastError(). I believe it set it to ERROR_FILE_NOT_FOUND.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!