The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

    • RT @JohnKaster: Anyone else wonder if SCOTUS did this to prevent tribes from offering reproductive rights clinics in fascist states? https:… 2 hours ago
    • @daanwesterink Dat zeker. 2 hours ago
    • RT @pmleenhouts: Herhaal het pleidooi van Dirk de Wachter: "trek af en toe de gordijnen dicht". Letterlijk en figuurlijk. Kom tot rust, nee… 2 hours ago
    • RT @Walrathis: Het kabinet wil verder geen financiële hulp bieden. Dat zei de @MinPres en heeft het kabinet blijkbaar besloten. Kan er dan… 2 hours ago
    • RT @HenkWillemSmits: Volgens de politie is het "rustig" bij de gijzeling van een bedrijf van een kamerlid. Echt te bizar dat de politie dit… 2 hours ago
  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 2,803 other followers

Archive for July 21st, 2010

Delphi: great post by Malcolm Groves about Debugging Initialization and Finalization sections

Posted by jpluimers on 2010/07/21

Long time Delphi user Malcom Groves just posted an interesting video on Debugging Initialization and Finalization sections.

What I especially like is that he performs this trick using the DUnit unit testing framework for Delphi.
+1 for using unit testing!

The trick he uses is an old one, but I didn’t realize that few people know it, so it is good to put it in writing.

Note that the trick does not work in all cases (see further on an alternative), but for most cases it does work well:

  1. Open your .dpr (From the Delphi menu, choose “Project” followed by “View source”
  2. Put a breakpoint on the begin and end of your program code (see listing below)
  3. Run your project
    (note: for some Delphi versions: you have to F7 into your project)
  4. At the begin of your program Press F7 (“Run” – “Trace into”) in stead of F8 (“Run” – “Step over”)
  5. At the end of each initialization section, press F7 again (not F8!) to step into the next initialization section
  6. At the end of your program press F7 (not F8!) to step into the finalization section
  7. At the end of each finalization section, press F7 again (not F8!) to step into the next finalization

Easy, when you know, difficult to find out yourself (I found out by accident eras ago <g>).

Sometimes (I have not found out why yet) some Delphi versions refuse to work this way.
So you need an alternative, which is this one: Read the rest of this entry »

Posted in Delphi, Development, Software Development | 9 Comments »

 
%d bloggers like this: