<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[This thread holds tips and tricks that we&#x27;ve collected.]]></title><description><![CDATA[<p>------- Expand Pointers To Arrays -------</p>
<p>To show the elements of an array given a pointer in the watch window, just add a<br />
comma followed by the number of elements to display:</p>
<p>pArray,25</p>
<p>------- Function Evaluation -------</p>
<p>Call program code from debugger<br />
Use quickwatch window, not watch window. e.g. DumpInfo (pFoo)<br />
Great for debug data<br />
Use OutputDebugString or printf<br />
Limitations 20 seconds max.<br />
Terminate on exception.<br />
Only one thread</p>
<p>You can do debug output using OutputDebugString (through our DebugOutStraight call).<br />
You can also use this to write strings into memory locations by calling sprintf( someString, &quot;a b c d&quot; ).</p>
<p>------- Casting In The Debugger -------</p>
<p>When in the debugger, you can display a symbol even if it's not in the current module<br />
or if it's a static in another file.</p>
<p>The base syntax is {functionName, cppFilename, dllFilename}, but you can usually leave out the first<br />
two elements like this:</p>
<p>{,,foo.dll}(CMyClass*)pObject or {,,foo.dll}symbolName</p>
<p>If that doesn't work, add the filename:<br />
{,physics_environment.cpp,vphysics.dll}(CSleepObjects*)pObject</p>
<p>so using an expression like this inside the engine works:</p>
<p>{,,client.dll}(C_BaseEntity*){*}pEntity<br />
{,,client.dll}engine</p>
<p>Note: You can use this to watch the values of local variables in functions up the stack.<br />
If there's a function like Host_Frame that calls a lot of other functions, and you want to<br />
watch one of its variables while in other functions, you can do:</p>
<p>{Host_Frame,,engine.dll}someVar</p>
<p>------- Display GetLastError's value and message -------</p>
<p>You can display the value GetLastError() will return by putting &quot;@err&quot; in your watch window.<br />
You can see the error message associated with that value by putting &quot;@err,hr&quot; in your watch window.<br />
If you've placed an HRESULT in a variable, adding &quot;,hr&quot; to the variable name in the watch window will<br />
display the associated text.</p>
<p>------- Formatting data in the watch window -------</p>
<p>Most of this was lifted from &quot;Debugging Applications for Microsoft .NET and Microsoft Windows&quot;<br />
by John Robbins.</p>
<p>To specify the formatting for an expression in the watch window, add a comma, then the format<br />
specifier. So &quot;someValue,d&quot; would tell it you want to view the variable called someValue<br />
as a signed decimal integer.</p>
<p>Symbol Format Description<br />
------ ------------------</p>
<p>d or i Signed decimal integer<br />
u Unsigned decimal integer<br />
o Unsigned octal integer<br />
x or X Hexadecimal integer<br />
f Floating point<br />
e Scientific notation<br />
g Floating point OR scientific, whichever is shorter<br />
c Single character<br />
s ANSI string<br />
su Unicode string<br />
hr HRESULT or Win32 error code<br />
wc Windows class flag<br />
wm Windows message number</p>
<p>You can also put a pointer in the watch window and have it show a memory dump in a specific format.<br />
For example, &quot;0xabcdef,ma&quot; would show 64 ASCII characters at 0xabcdef.</p>
<p>Symbol Format Description<br />
------ ------------------</p>
<p>ma 64 ASCII characters<br />
m 16 bytes in hex format followed by 16 ASCII characters<br />
mw 8 words<br />
md 4 doublewords<br />
mq 4 quadwords<br />
mu 2-byte characters (Unicode)<br />
# Expand an array to the specified number of values (pArray,10)</p>
<p>Note: There is a way to add your own custom expansions for types into the debugger by making<br />
a DLL that converts the type's data into a string. They're called &quot;Expression Evaluator Add-Ins&quot;.<br />
This may only be supported in .NET.</p>
<p>------- Avoiding Stepping Into Things -------</p>
<p>It's often useful to avoid stepping into some common code like constructors or overloaded<br />
operators. autoexp.dat provides this capability. Add a section called &quot;[ExecutionControl]&quot;.<br />
Add keys where the key is the function name and the value is &quot;NoStepInto&quot;. You can specify<br />
an asterisk (*) as a wildcard as the first set of colons for a namespace or class.</p>
<p>autoexp.dat is only read on Visual Studio's start up.</p>
<p>To ignore the function myfunctionname, and all calls to the class CFoo:<br />
[ExecutionControl]<br />
myfunctionname=NoStepInto CFoo::*=NoStepInto</p>
<p>To ignore construction and assignment of MFC CStrings: (Notice the extra = in CString::operator=.)<br />
[ExecutionControl]<br />
CString::CString=NoStepInto CString::operator==NoStepInto</p>
<p>To ignore all ATL calls:<br />
[ExecutionControl]<br />
ATL::*=NoStepInto</p>
<p>------- Syntax Highlighting For New File Extensions -------</p>
<p>To get syntax highlighting for new file extensions, open RegEdit and go to<br />
HKEY_CURRENT_USER\Software\Microsoft\Devstudio\6.0\Text Editor\Tabs/Language Settings.<br />
Pick the closest language under there and add your extension to its FileExtensions key.<br />
For example, you would add PHP files to HTML/FileExtensions since they are essentially<br />
HTML files.</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/50940/this-thread-holds-tips-and-tricks-that-we-ve-collected</link><generator>RSS for Node</generator><lastBuildDate>Sun, 31 May 2026 09:06:49 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/50940.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 05 Oct 2003 14:37:27 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to This thread holds tips and tricks that we&#x27;ve collected. on Sun, 05 Oct 2003 14:37:27 GMT]]></title><description><![CDATA[<p>------- Expand Pointers To Arrays -------</p>
<p>To show the elements of an array given a pointer in the watch window, just add a<br />
comma followed by the number of elements to display:</p>
<p>pArray,25</p>
<p>------- Function Evaluation -------</p>
<p>Call program code from debugger<br />
Use quickwatch window, not watch window. e.g. DumpInfo (pFoo)<br />
Great for debug data<br />
Use OutputDebugString or printf<br />
Limitations 20 seconds max.<br />
Terminate on exception.<br />
Only one thread</p>
<p>You can do debug output using OutputDebugString (through our DebugOutStraight call).<br />
You can also use this to write strings into memory locations by calling sprintf( someString, &quot;a b c d&quot; ).</p>
<p>------- Casting In The Debugger -------</p>
<p>When in the debugger, you can display a symbol even if it's not in the current module<br />
or if it's a static in another file.</p>
<p>The base syntax is {functionName, cppFilename, dllFilename}, but you can usually leave out the first<br />
two elements like this:</p>
<p>{,,foo.dll}(CMyClass*)pObject or {,,foo.dll}symbolName</p>
<p>If that doesn't work, add the filename:<br />
{,physics_environment.cpp,vphysics.dll}(CSleepObjects*)pObject</p>
<p>so using an expression like this inside the engine works:</p>
<p>{,,client.dll}(C_BaseEntity*){*}pEntity<br />
{,,client.dll}engine</p>
<p>Note: You can use this to watch the values of local variables in functions up the stack.<br />
If there's a function like Host_Frame that calls a lot of other functions, and you want to<br />
watch one of its variables while in other functions, you can do:</p>
<p>{Host_Frame,,engine.dll}someVar</p>
<p>------- Display GetLastError's value and message -------</p>
<p>You can display the value GetLastError() will return by putting &quot;@err&quot; in your watch window.<br />
You can see the error message associated with that value by putting &quot;@err,hr&quot; in your watch window.<br />
If you've placed an HRESULT in a variable, adding &quot;,hr&quot; to the variable name in the watch window will<br />
display the associated text.</p>
<p>------- Formatting data in the watch window -------</p>
<p>Most of this was lifted from &quot;Debugging Applications for Microsoft .NET and Microsoft Windows&quot;<br />
by John Robbins.</p>
<p>To specify the formatting for an expression in the watch window, add a comma, then the format<br />
specifier. So &quot;someValue,d&quot; would tell it you want to view the variable called someValue<br />
as a signed decimal integer.</p>
<p>Symbol Format Description<br />
------ ------------------</p>
<p>d or i Signed decimal integer<br />
u Unsigned decimal integer<br />
o Unsigned octal integer<br />
x or X Hexadecimal integer<br />
f Floating point<br />
e Scientific notation<br />
g Floating point OR scientific, whichever is shorter<br />
c Single character<br />
s ANSI string<br />
su Unicode string<br />
hr HRESULT or Win32 error code<br />
wc Windows class flag<br />
wm Windows message number</p>
<p>You can also put a pointer in the watch window and have it show a memory dump in a specific format.<br />
For example, &quot;0xabcdef,ma&quot; would show 64 ASCII characters at 0xabcdef.</p>
<p>Symbol Format Description<br />
------ ------------------</p>
<p>ma 64 ASCII characters<br />
m 16 bytes in hex format followed by 16 ASCII characters<br />
mw 8 words<br />
md 4 doublewords<br />
mq 4 quadwords<br />
mu 2-byte characters (Unicode)<br />
# Expand an array to the specified number of values (pArray,10)</p>
<p>Note: There is a way to add your own custom expansions for types into the debugger by making<br />
a DLL that converts the type's data into a string. They're called &quot;Expression Evaluator Add-Ins&quot;.<br />
This may only be supported in .NET.</p>
<p>------- Avoiding Stepping Into Things -------</p>
<p>It's often useful to avoid stepping into some common code like constructors or overloaded<br />
operators. autoexp.dat provides this capability. Add a section called &quot;[ExecutionControl]&quot;.<br />
Add keys where the key is the function name and the value is &quot;NoStepInto&quot;. You can specify<br />
an asterisk (*) as a wildcard as the first set of colons for a namespace or class.</p>
<p>autoexp.dat is only read on Visual Studio's start up.</p>
<p>To ignore the function myfunctionname, and all calls to the class CFoo:<br />
[ExecutionControl]<br />
myfunctionname=NoStepInto CFoo::*=NoStepInto</p>
<p>To ignore construction and assignment of MFC CStrings: (Notice the extra = in CString::operator=.)<br />
[ExecutionControl]<br />
CString::CString=NoStepInto CString::operator==NoStepInto</p>
<p>To ignore all ATL calls:<br />
[ExecutionControl]<br />
ATL::*=NoStepInto</p>
<p>------- Syntax Highlighting For New File Extensions -------</p>
<p>To get syntax highlighting for new file extensions, open RegEdit and go to<br />
HKEY_CURRENT_USER\Software\Microsoft\Devstudio\6.0\Text Editor\Tabs/Language Settings.<br />
Pick the closest language under there and add your extension to its FileExtensions key.<br />
For example, you would add PHP files to HTML/FileExtensions since they are essentially<br />
HTML files.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/366276</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/366276</guid><dc:creator><![CDATA[tipp]]></dc:creator><pubDate>Sun, 05 Oct 2003 14:37:27 GMT</pubDate></item><item><title><![CDATA[Reply to This thread holds tips and tricks that we&#x27;ve collected. on Sun, 05 Oct 2003 14:38:26 GMT]]></title><description><![CDATA[<p>was soll das sein`?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/366277</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/366277</guid><dc:creator><![CDATA[dEUs]]></dc:creator><pubDate>Sun, 05 Oct 2003 14:38:26 GMT</pubDate></item><item><title><![CDATA[Reply to This thread holds tips and tricks that we&#x27;ve collected. on Sun, 05 Oct 2003 14:56:08 GMT]]></title><description><![CDATA[<p>Sieht mir nach Tipps aus, den Debugger von VC++ etwas zu erweitern <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /> Den Trick mit pArray,123 im Überwachungsfenster kannte ich schon, aber einiges kannte ich auch noch nicht <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f603.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--grinning_face_with_big_eyes"
      title=":D"
      alt="😃"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/366284</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/366284</guid><dc:creator><![CDATA[tag]]></dc:creator><pubDate>Sun, 05 Oct 2003 14:56:08 GMT</pubDate></item></channel></rss>