{"id":94695,"date":"2016-11-11T07:00:00","date_gmt":"2016-11-11T22:00:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/oldnewthing\/?p=94695"},"modified":"2019-03-13T10:33:40","modified_gmt":"2019-03-13T17:33:40","slug":"20161111-00","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20161111-00\/?p=94695","title":{"rendered":"If you don&#8217;t blow up a debug session every so often, you&#8217;re not debugging hard enough"},"content":{"rendered":"<p>I was helping a customer live-debug an assertion failure in an automated test running in a lab. I messed up an attempt to unwind the stack to restart a call and ended up corrupting the process state. Undaunted, I realized that the issue at hand was that one specific API call was failing, so I said to myself, &#8220;That&#8217;s okay if I can&#8217;t restart the call. I can just <a HREF=\"https:\/\/blogs.msdn.microsoft.com\/oldnewthing\/20151016-00\/?p=91341\">simulate the call<\/a>!&#8221; so I patched registers and manually pushed data onto the stack and all that stuff. <\/p>\n<p>And then I stepped through the code, and it crashed because I messed up one detail: When virtually pushing the return address on the stack, I had a mental lapse and subtracted 4 from the stack pointer even though this was a 64-bit machine and I should have subtracted 8. Due to the stack misalignment, the code eventually crashed on a <code>movaps<\/code> instruction several stack frames deep into the function. <\/p>\n<p>I blew up the debug session not once but twice. <\/p>\n<p>If this happens to you, don&#8217;t beat yourself up. If you don&#8217;t blow up a debug session every so often, then you&#8217;re not debugging hard enough. <\/p>\n<p>(That punch line is a ripoff of something I heard the <a HREF=\"http:\/\/www.cartalk.com\/\">Car Talk<\/a> guys say: &#8220;If you don&#8217;t <a HREF=\"https:\/\/blogs.msdn.microsoft.com\/oldnewthing\/20070717-01\/?p=25973\">stall a manual transmission<\/a> every so often, then you&#8217;re not driving it right.&#8221;) <\/p>\n","protected":false},"excerpt":{"rendered":"<p>Life on the edge.<\/p>\n","protected":false},"author":1069,"featured_media":111744,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[26],"class_list":["post-94695","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-other"],"acf":[],"blog_post_summary":"<p>Life on the edge.<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/94695","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/users\/1069"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/comments?post=94695"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/94695\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media\/111744"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media?parent=94695"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=94695"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=94695"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}