Watch, Follow, &
Connect with Us
Public Report
Report From: Delphi-BCB/Debugger/Local Variables View    [ Add a report in this area ]  
Report #:  2893   Status: Open
hide or mark inaccessible variables due to optimization
Project:  Delphi Build #:  7.0.4.453
Version:    7.0 Submitted By:   Petr Vones
Report Type:  Suggestion / Enhancement Request Date Reported:  11/11/2002 4:03:04 PM
Severity:    Commonly encountered problem Last Updated: 3/20/2012 2:24:39 AM
Platform:    All versions Internal Tracking #:   242548
Resolution: None (Resolution Comments) Resolved in Build: : None
Duplicate of:  None
Voting and Rating
Overall Rating: (6 Total Ratings)
3.00 out of 5
Total Votes: 1
Description
<sysop>
While debugging local variables of a procedure, some of them cannot be viewed because they are not "valid" on the current line.
Presently, their value is either "Inaccessible value" or "E2171 Variable 'Result' inaccessible here due to optimization" depending on the current line being executed.
Could the rendering be different for variables that are not accessible/valid?
</sysop>

Please add a setting to allow to hide inaccessible variables due to optimization in the view.
Steps to Reproduce:
Some tests in the following program shows the present behaviour:

Step into the test procedure and have a look at the local variable view.

{$APPTYPE CONSOLE}

uses
  SysUtils;

Function Test: Integer;
var
  A1: Integer;
  A2: Integer;
begin
  A1 := 5;
  Result := A1;
  A2 := 4;
  Result := Result * A2;
end;

begin
  try
    Test;
    { TODO -oUser -cConsole Main : Insert code here }
  except
    on E:Exception do
      Writeln(E.Classname, ': ', E.Message);
  end;
end.
Workarounds
None
Attachment
None
Comments

Peter Morris at 11/12/2002 3:07:52 PM -
Hide them from what?  Hide them in the source code?  I don't understand.

Florent Ouchet at 10/19/2006 12:01:40 PM -
Please look at the report area: "Delphi\Debugger\Local Variable View"

Jesse McGrew at 11/15/2002 5:40:41 PM -
Sounds like he wants them to be hidden in the local variables window.

I disagree with the suggestion, because different variables are accessible at different points in the code. They would be appearing and disappearing all the time, moving the others up and down in the list, making it hard to keep an eye on a single variable.

Ben Ziegler at 12/13/2002 8:21:33 AM -
Instead of hide maybe just gray them out?  Some kind of visual clue would be nice.

John Mulvey at 12/20/2006 8:27:32 AM -
I am having the same problem in BDS2006 - variable Values  are displaying 'E2171 Variable inaccessible due to optimization', in both Local Variables and Watch windows. There is no obvious (to me) reason why they can not be displayed.

Using the code in 'steps to reproduce' given above. If I break on the first line of 'Function' and step through line by line, then A1,A2 and Result (which are all perfecly valid and within scope) all toggle at some point between displaying the correct value and the error message.

As for the fix suggested - If the E2171 message is a result of some 'optimization' I also want to turn this off so I can see the Value of the variable

Server Response from: ETNACODE01