We pay for user submitted tutorials and articles that we publish. Anyone can send in a contributionLearn More
We all know what breakpoints are, they tell the debugger that an application should break and pause execution, at a certain point. If we want to get certain information at this point, we need to copy it down to a paper or to the notepad. There are breakpoints which get hit hundred of times during the execution of a program, so it may be very exhausting to write down the breakpoint information each time it is hit. Well, last week, while I saw John Cunninghams session at PDC 2008 about Visual Studio Debugger Tips & Tricks, I learned something new. The Visual Studio debugger has another feature called tracepoints.
A tracepoint is a variation of a breakpoint, the difference between them is:
To set a tracepoint, we first have to set a breakpoint in code. Then right click on the breakpoint and select the “When Hit” context menu item:
The following screen appears, where we can add a log message for the breakpoint and tell it to continue with the program execution when it gets hit:
As can be seen in the image above, the log message can include the value of a variable or another expression like the current function name, call stack, thread ID… After pressing the OK button, the tracepoint will look like that:
This feature is very useful and can certainly save a lot of time. It came with Visual Studio 2005 but I am sure that, like me, some of you didn’t know about it, so enjoy.
Tags :breakpointDebugDebuggerdebugginghitpausetracepointVisual Studio
Copyright © 2012 Dev102.com
Breeze : Designed by Amit Raz and Nitzan Kupererd