Watch, Follow, &
Connect with Us
Public Report
Report From: Delphi-BCB/Debugger/Stepping    [ Add a report in this area ]  
Report #:  4086   Status: Closed
Step skips code in except/finally blocks on exception, Exit etc.
Project:  Delphi Build #:
Version:    7.0 Submitted By:   Kjell Rilbe
Report Type:  Basic functionality failure Date Reported:  4/10/2003 8:39:45 AM
Severity:    Commonly encountered problem Last Updated: 3/20/2012 2:24:39 AM
Platform:    All platforms Internal Tracking #:   188789
Resolution: Retest (Resolution Comments) Resolved in Build: :
Duplicate of:  None
Voting and Rating
Overall Rating: (5 Total Ratings)
4.20 out of 5
Total Votes: None

01: begin
02:   try
03:     DoSomeWork;
04:     if Done then Exit;
05:     DoSomeMoreWork:
06:   finally
07:     ReleaseResources;
08:   end;
09:   DoSomMoreStuff;
10: end;

When stepping through this code with F8, the debugger will pause at lines 1, 2, 3, 4 and 10. It will not pause at line 7, but it should!

The same problem occurs if the code inside try...finally raises an exception. The same problem occurs for try..except as well - the debugger will not pause inside the except block. The problem occurs both with and without compiler optimizations.

This problem was originally reported in report 4041, but that report was misunderstood and closed by Dave Nottage.

This report has been marked as a duplicate of QC report 3681. I'm not sure that is correct. 3681 says that the generated code is actually incorrect when optimizations are on. This report only concerns incorrect IDE behavior during stepping.

Feel free to reclassify as a feature request if the current behavior is as designed and not a bug.
Steps to Reproduce:
Open the attached project.

Rodrigo Laurindo at 4/11/2003 4:36:13 AM -
Duplicate of #3681 (already open)

Kjell Rilbe at 4/14/2003 7:07:23 AM -
Read 3681. Maybe the symptoms described in 3681 are caused by the same underlying fault, but it's definately not the same symptoms as I've described in this report.

3681 is more severe - it will cause incorrect results.
4086 (this report) only causes debugging to be less straightforward that it could be.

Btw, as far as I've observed, the code between finally and end is correctly executed. it's just that the debugger doesn't pause there, which you would expect.

Kjell Rilbe at 4/12/2003 3:30:26 AM -
OK. I did search for similar reports but didn't find it. Cannot withdraw this one though, is it because it's "open"? Can you do something so that I can withdraw this report?

Server Response from: ETNACODE01