{"id":606,"date":"2009-10-18T11:01:07","date_gmt":"2009-10-17T23:01:07","guid":{"rendered":"https:\/\/www.deltics.co.nz\/blog\/?p=606"},"modified":"2009-10-18T20:07:05","modified_gmt":"2009-10-18T08:07:05","slug":"learning-experiences","status":"publish","type":"post","link":"https:\/\/www.deltics.co.nz\/blog\/posts\/606\/","title":{"rendered":"Learning Experiences &#8211; Moving The Execution Point Pre-Delphi 2010"},"content":{"rendered":"<span class=\"rt-reading-time\" style=\"display: block;\"><span class=\"rt-label rt-prefix\">[Estimated Reading Time: <\/span> <span class=\"rt-time\">3<\/span> <span class=\"rt-label rt-postfix\">minutes]<\/span><\/span><p>Thanks to commenters I have already learned two useful things as a result of yesterday&#8217;s post, both things which I cannot fathom how I did not already know. \u00a0But here&#8217;s something I learned for myself as a result of a comment made by Malcolm Groves at the Auckland Delphi 2010 launch day recently.<\/p>\n<p><!--more-->As mentioned in yesterdays post, a new feature in Delphi 2010 is the ability to drag and drop the execution point when stopped in debug mode.<\/p>\n<p>However, Malcolm mentioned that this could be achieved &#8211; rather more awkwardly &#8211; in previous versions of Delphi via the CPU window, although the precise details escaped his memory at the time, other than that it involved modifying the contents of a particular register.<\/p>\n<p>I found myself last night in exactly the situation I described in my speculative &#8220;when this might be useful&#8221; discussion of moving execution points. \u00a0I happened to be in an older version of Delphi at the time and it was a relatively small project so a &#8220;halt, modify, recompile and retest&#8221; cycle wouldn&#8217;t have been too arduous, but I decided instead to reach for the CPU window to see if I couldn&#8217;t figure out how to achieve it and see just how awkward it might be.<\/p>\n<p>It didn&#8217;t take long, and actually, it wasn&#8217;t too awkward at all.<\/p>\n<p>Here&#8217;s the CPU view, with an additional bit of highlighting to draw attention to the useful areas (click to embiggen):<\/p>\n<figure id=\"attachment_608\" aria-describedby=\"caption-attachment-608\" style=\"width: 300px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.deltics.co.nz\/blog\/wp-content\/uploads\/registers.jpg?ssl=1\"><img decoding=\"async\" loading=\"lazy\" class=\"size-medium wp-image-608 \" title=\"CPU View\" src=\"https:\/\/i0.wp.com\/www.deltics.co.nz\/blog\/wp-content\/uploads\/registers.jpg?resize=300%2C104&#038;ssl=1\" alt=\"CPU View (with highlighting)\" width=\"300\" height=\"104\" srcset=\"https:\/\/i0.wp.com\/www.deltics.co.nz\/blog\/wp-content\/uploads\/registers.jpg?resize=300%2C104&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.deltics.co.nz\/blog\/wp-content\/uploads\/registers.jpg?w=678&amp;ssl=1 678w\" sizes=\"(max-width: 300px) 100vw, 300px\" data-recalc-dims=\"1\" \/><\/a><figcaption id=\"caption-attachment-608\" class=\"wp-caption-text\">CPU View (with highlighting)<\/figcaption><\/figure>\n<p>The two connected box highlights show that the EIP register contains the current execution point address. \u00a0So this is the register that Malcolm was referring to.<\/p>\n<p>Now, there are actually TWO ways we can use this information to change the execution point in older Delphi versions&#8230;<\/p>\n<p>You can either position the highlight in the CPU disassembly view on the desired execution point and invoke the &#8220;New EIP&#8221; item on the disassembly context menu:<\/p>\n<figure id=\"attachment_609\" aria-describedby=\"caption-attachment-609\" style=\"width: 300px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.deltics.co.nz\/blog\/wp-content\/uploads\/New-EIP.jpg?ssl=1\"><img decoding=\"async\" loading=\"lazy\" class=\"size-medium wp-image-609 \" title=\"New EIP\" src=\"https:\/\/i0.wp.com\/www.deltics.co.nz\/blog\/wp-content\/uploads\/New-EIP-300x286.jpg?resize=300%2C286&#038;ssl=1\" alt=\"Move EIP to Selected Line\" width=\"300\" height=\"286\" srcset=\"https:\/\/i0.wp.com\/www.deltics.co.nz\/blog\/wp-content\/uploads\/New-EIP.jpg?resize=300%2C286&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.deltics.co.nz\/blog\/wp-content\/uploads\/New-EIP.jpg?w=488&amp;ssl=1 488w\" sizes=\"(max-width: 300px) 100vw, 300px\" data-recalc-dims=\"1\" \/><\/a><figcaption id=\"caption-attachment-609\" class=\"wp-caption-text\">Move EIP to Selected Line<\/figcaption><\/figure>\n<p>Or you can directly increment or decrement the EIP register using the register view context menu:<\/p>\n<figure id=\"attachment_610\" aria-describedby=\"caption-attachment-610\" style=\"width: 300px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.deltics.co.nz\/blog\/wp-content\/uploads\/Increment-EIP.jpg?ssl=1\"><img decoding=\"async\" loading=\"lazy\" class=\"size-medium wp-image-610 \" title=\"Increment EIP\" src=\"https:\/\/i0.wp.com\/www.deltics.co.nz\/blog\/wp-content\/uploads\/Increment-EIP-300x117.jpg?resize=300%2C117&#038;ssl=1\" alt=\"Increment or Decrement EIP Register\" width=\"300\" height=\"117\" srcset=\"https:\/\/i0.wp.com\/www.deltics.co.nz\/blog\/wp-content\/uploads\/Increment-EIP.jpg?resize=300%2C117&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.deltics.co.nz\/blog\/wp-content\/uploads\/Increment-EIP.jpg?w=711&amp;ssl=1 711w\" sizes=\"(max-width: 300px) 100vw, 300px\" data-recalc-dims=\"1\" \/><\/a><figcaption id=\"caption-attachment-610\" class=\"wp-caption-text\">Increment or Decrement EIP Register<\/figcaption><\/figure>\n<p>In this capture I&#8217;ve also highlighted the address of the next executable point corresponding to a line of source in my code &#8211; you will notice that the addresses in that list are non-contiguous, and when incrementing or decrementing the EIP value I think you need to be careful that you set the value to an address that corresponds to one of the addresses in this list.<\/p>\n<p>When you increment\/decrement the EIP register, the value is incremented as a simple value, without respect to this list of addresses. \u00a0i.e. &#8220;Increment&#8221; add&#8217;s 1 (one) to the value, it doesn&#8217;t advance it to the &#8220;next valid address&#8221;.<\/p>\n<p>I&#8217;m not sure what would happen if you tried to resume execution from an address that is not in that CPU disassembly list, but I&#8217;m pretty confident it wouldn&#8217;t be &#8220;good things&#8221;.<\/p>\n<p>So grateful thanks to the commenters to my previous post and to Malcolm for furthering my awareness of things already at my disposal.<\/p>\n","protected":false},"excerpt":{"rendered":"<p><span class=\"rt-reading-time\" style=\"display: block;\"><span class=\"rt-label rt-prefix\">[Estimated Reading Time: <\/span> <span class=\"rt-time\">3<\/span> <span class=\"rt-label rt-postfix\">minutes]<\/span><\/span> Thanks to commenters I have already learned two useful things as a result of yesterday&#8217;s post, both things which I cannot fathom how I did not already know. \u00a0But here&#8217;s something I learned for myself as a result of a comment made by Malcolm Groves at the Auckland Delphi 2010 launch day recently.<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"jetpack_publicize_message":"","jetpack_is_tweetstorm":false,"jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":[]},"categories":[4],"tags":[95,292],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p1TKYv-9M","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":371,"url":"https:\/\/www.deltics.co.nz\/blog\/posts\/371\/","url_meta":{"origin":606,"position":0},"title":"Delphi 2009 &#8211; CompilerVersion","date":"19 Sep 2008","format":false,"excerpt":"Just a short post this one. Somebody else may already have mentioned this, but I only just figured it out for myself - the CompilerVersion for the Delphi 2009 compiler is not what you might expect (and is not what the documentation says it is!). Both CompilerVersion and RTLVersion have\u2026","rel":"","context":"In &quot;Delphi&quot;","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":349,"url":"https:\/\/www.deltics.co.nz\/blog\/posts\/349\/","url_meta":{"origin":606,"position":1},"title":"Delphi 2009 &#8211; String Performance","date":"18 Sep 2008","format":false,"excerpt":"NOTE: Downloads are now fixed! Andreas Hausladen generously took the time to make some detailed comments on my previous post, one of which prompted me to throw together some further performance test cases for String types specifically.\u00a0 The results were something of a mixed bag and contained some surprises. The\u2026","rel":"","context":"In &quot;Delphi&quot;","img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.deltics.co.nz\/blog\/wp-content\/uploads\/delphi2009-stringperformance-resultscapture.jpg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":2337,"url":"https:\/\/www.deltics.co.nz\/blog\/posts\/2337\/","url_meta":{"origin":606,"position":2},"title":"A Silent Danger&#8230;","date":"07 Jun 2015","format":false,"excerpt":"A brief post on a long standing omission in type checking in Pascal and the limitations of Range Checking as applied to the problem. Consider this contrived example of a simple function: This very simple function accepts an explicitly 32-bit Integer parameter and simply returns TRUE if the value passed\u2026","rel":"","context":"In &quot;Delphi&quot;","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":2006,"url":"https:\/\/www.deltics.co.nz\/blog\/posts\/2006\/","url_meta":{"origin":606,"position":3},"title":"Blowing Smoke&#8230;","date":"01 Nov 2013","format":false,"excerpt":"To alleviate the grind of polishing and sanitising my code (and, let's be honest, just plain 'fixing' it in some cases) ready for release, I have re-kindled my participation on Stack Overflow. In a happy confluence yesterday a question came up which allowed me to exercise one of the libraries\u2026","rel":"","context":"In &quot;Delphi&quot;","img":{"alt_text":"Ready to Run","src":"https:\/\/i0.wp.com\/www.deltics.co.nz\/blog\/wp-content\/uploads\/Screen-Shot-2013-11-01-at-09.00.33.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":579,"url":"https:\/\/www.deltics.co.nz\/blog\/posts\/579\/","url_meta":{"origin":606,"position":4},"title":"Let&#8217;s do the Time Warp again&#8230;","date":"13 Oct 2009","format":false,"excerpt":"Approximately 2 years ago I was present at a Delphi launch event here in Auckland. \u00a0At that time the hot news was the release of Delphi 2007. \u00a0But more significant than that (great) release was the recent publication after much SOX hoo-ing and haa-ing of a Delphi RoadMap. On that\u2026","rel":"","context":"In &quot;Delphi&quot;","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1508,"url":"https:\/\/www.deltics.co.nz\/blog\/posts\/1508\/","url_meta":{"origin":606,"position":5},"title":"An Exclusive Club and Reassuringly Expensive","date":"22 Aug 2013","format":false,"excerpt":"In the comments to a previous post there cropped up the complaint that people asking for a realistic Starter Edition are just looking for a cheaper edition of Delphi for themselves. Maybe some of us are, but even so we are - or at least I am - not primarily\u2026","rel":"","context":"In &quot;Delphi&quot;","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"https:\/\/www.deltics.co.nz\/blog\/wp-json\/wp\/v2\/posts\/606"}],"collection":[{"href":"https:\/\/www.deltics.co.nz\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.deltics.co.nz\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.deltics.co.nz\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.deltics.co.nz\/blog\/wp-json\/wp\/v2\/comments?post=606"}],"version-history":[{"count":5,"href":"https:\/\/www.deltics.co.nz\/blog\/wp-json\/wp\/v2\/posts\/606\/revisions"}],"predecessor-version":[{"id":612,"href":"https:\/\/www.deltics.co.nz\/blog\/wp-json\/wp\/v2\/posts\/606\/revisions\/612"}],"wp:attachment":[{"href":"https:\/\/www.deltics.co.nz\/blog\/wp-json\/wp\/v2\/media?parent=606"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.deltics.co.nz\/blog\/wp-json\/wp\/v2\/categories?post=606"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.deltics.co.nz\/blog\/wp-json\/wp\/v2\/tags?post=606"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}