- Special commands in Immediate/Watch windows
- c# temp variables defined in Immediate Window
input “int tempVar = 0;” in the immediate window, then type $temp or @temp in Watch window, see what happens. Can be helpful combined with the usage of Conditional Breakpoints.
VS can even create an object in immediate window, like Something s = new Something();
- Time-measurement feature by conditional breakpoint
set a trace point, and change the statement as below:
on my 64-bit win7, time resolution is 10-6 second
see what happens
- control var’s display suffix
- var,h: in watch window shows hex value
- var,nq: show string without escaped quotes, helpful when showing “\””
- var,ac: force to evaluate the expression even if “implicit expression evaluation” is disabled in debug-general setting. May be helpful to watch some variables which has nasty side effect when auto evaluate expression, like properties
- watch objects out of scope: “Make Object Id”, then watch by “1#”, “2#”, etc. Even if the object is being GCed.
- pseudo-vars in watch windows:
- $exception
- $user
- Visualizer in watch window
- for c#:
- MyDocument\Visual Studio 2008\Visualizer\autoexp.cs and autoexp.dll
- write your own visualizer plug-in
- customize debugdisplay attribute in c# classes
- for native c++: c:\program files(x86)\visual studio 2008\common7\packages\debugger\autoexp.dat
- for c#:
- Execute SOS from immediate window
.load sos
note: only 32bit mixed debugging mode supports this
- Debugger Behavior
- Set Breakpoint at any system function
type “{,,user32.dll}_SendMessageA@16” in the New breakpoint window
some function has different symbol name, like: LockWindowUpdate
{,,user32.dll}_NtUserLockWindowUpdate@4 should be used.
- Why Edit&Continue not working for my project?
refer to below link:
http://msdn.microsoft.com/en-us/library/ms164927%28v=VS.80%29.aspx
some common cases when E&C not available are:
mixed debugging
64-bit CLR
attached by debugger and not started from debugger
- Why my VS cannot detach from the target
when attaching to the target, remember to choose Managed only mode, not mixed mode
- Misc
- Dump
- VS-generated minidump has no handle info, so not good for multiple thread deadlock troubleshooting
- Dump
No comments:
Post a Comment