<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>How to break in at the call site that invokes the break point</title><link>http://blogs.msdn.com/doronh/archive/2006/05/08/592735.aspx</link><description>I think everyone at some point in time wants to embed a break point in there code, whether it be for debugging purposes, path tracing, or detecting edge conditions that have not yet been tested. When I hit a break point, I would prefer that the debugger</description><dc:language>en</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>re: How to break in at the call site that invokes the break point</title><link>http://blogs.msdn.com/doronh/archive/2006/05/08/592735.aspx#593423</link><pubDate>Tue, 09 May 2006 10:06:05 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:593423</guid><dc:creator>strik</dc:creator><description>I hope it is not only __debugbreak() which you do not call in production code, but also your macro TRAP() and DebugBreak(), which do not belong in production code.&lt;br&gt;&lt;br&gt;Or are there legitimate reasons to add them in production code?</description></item><item><title>re: How to break in at the call site that invokes the break point</title><link>http://blogs.msdn.com/doronh/archive/2006/05/08/592735.aspx#593764</link><pubDate>Tue, 09 May 2006 20:19:29 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:593764</guid><dc:creator>doronh</dc:creator><description>look at how TRAP() is defined. &amp;nbsp;It only does something if DBG is defined (e.g. a chk build). &amp;nbsp;If DBG is not defined or is zero, TRAP() evaluates to a no-op, so it still exists in the code .c(pp) file, but does not exist in the generated binary.&lt;br&gt;&lt;br&gt;Embedding an int3 or DbgBreakPoint in a release driver can have disastrous affects. &amp;nbsp;If that code is executed and a kernel debugger is not attached, the machine bug checks due to an unhandled exception.</description></item><item><title>Interesting Finds</title><link>http://blogs.msdn.com/doronh/archive/2006/05/08/592735.aspx#593856</link><pubDate>Tue, 09 May 2006 22:13:19 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:593856</guid><dc:creator>Jason Haley</dc:creator><description /></item><item><title>re: How to break in at the call site that invokes the break point</title><link>http://blogs.msdn.com/doronh/archive/2006/05/08/592735.aspx#593859</link><pubDate>Tue, 09 May 2006 22:19:30 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:593859</guid><dc:creator>Skywing</dc:creator><description>__debugbreak was added in CL 13 (VC7), IIRC.</description></item><item><title>re: How to break in at the call site that invokes the break point</title><link>http://blogs.msdn.com/doronh/archive/2006/05/08/592735.aspx#594877</link><pubDate>Thu, 11 May 2006 00:39:51 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:594877</guid><dc:creator>doronh</dc:creator><description>thx skywing, that is good info to have&lt;br&gt;&lt;br&gt;d</description></item><item><title>re: How to break in at the call site that invokes the break point</title><link>http://blogs.msdn.com/doronh/archive/2006/05/08/592735.aspx#595435</link><pubDate>Thu, 11 May 2006 18:41:35 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:595435</guid><dc:creator>Ishai</dc:creator><description>Since __debugbreak() &amp;nbsp;is a compiler intrinsic it does not prevent optimizations like inline __asm {int 3} does. &amp;nbsp;As a result, if you have two instances of &amp;nbsp;if (something failed) { TRAP(); return STATUS_SOME_ERROR; } the compiler tends to generate a single breakpoint for both calls which is probably not what you wanted (at least not what I wanted when I moved to __debugbreak())&lt;br&gt;&lt;br&gt;</description></item><item><title>re: How to break in at the call site that invokes the break point</title><link>http://blogs.msdn.com/doronh/archive/2006/05/08/592735.aspx#595470</link><pubDate>Thu, 11 May 2006 19:41:08 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:595470</guid><dc:creator>doronh</dc:creator><description>Ishai, I don't see this as a problem. &amp;nbsp;Why? &amp;nbsp;Because &amp;nbsp;my TRAP()s are not on in an optimized free build. &amp;nbsp;My debug builds, where TRAP() is turned on, are not optimized so the problem does not show up. &amp;nbsp; &amp;nbsp;A chk optimized build is possible, but I rarely find them useful. &lt;BR&gt;&lt;BR&gt;If you really wanted the TRAP()s to not be folded, I think you could do something like this (I haven't tested this on an optimized build to see if it really works though) 

&lt;p&gt;
&lt;pre&gt;
#define TRAP()             \ 
__pragma optimize("", off) \ 
__debugbreak()             \
__pragma optimize("", on)
&lt;/pre&gt;

&lt;p&gt;d</description></item><item><title> A Hole In My Head How to break in at the call site that invokes the |  Portable Greenhouse</title><link>http://blogs.msdn.com/doronh/archive/2006/05/08/592735.aspx#9676554</link><pubDate>Mon, 01 Jun 2009 14:15:59 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9676554</guid><dc:creator> A Hole In My Head How to break in at the call site that invokes the |  Portable Greenhouse</dc:creator><description>&lt;p&gt;PingBack from &lt;a rel="nofollow" target="_new" href="http://portablegreenhousesite.info/story.php?id=14481"&gt;http://portablegreenhousesite.info/story.php?id=14481&lt;/a&gt;&lt;/p&gt;
</description></item></channel></rss>