Hi

Hi,

I have a problem while debugging: the IDE does not recognizes all local variables...
Some similar code:

procedure MyStuff;
const
  CMyConst = 'Foo';
  CHelloWorld = 'Hello World';
var
  i: Integer;
  LMyVariable: TObject;
  LOffset: Double;
  LMyClass: TMyClass;
begin
  if LMyVariable <> nil then;
  for LMyVariable in FMyList do
    [..]
    DoSomething(LMyVariable);
  end;
end;

When I put a breakpoint to the if condition and want inspect the content of LMyVariable, the IDE answers with "undeclared identifier 'LMyVariable'". Even on the line "DoSomething" i cant see the content of LMyVariable, it is still unknown to the IDE...
But LOffset and LMyClass can be viewed while debugging :(
My project is build without optimization.

What can I do?

Comments

  1. David Heffernan Yes, and it's usually only one or two variables out of however many there are that can't be evaluated.
    Nicholas Ring I see it in new code sometimes. I'm not sure how many variables, but not too many :)

    ReplyDelete
  2. Yeah... the Delphi Debugger... ohh... the Debugger... it has become almost useless in later releases. Now honestly I am happy when I can see the variable in it. Usually you can trick it by modifying the code for debugging purposes and assigning to a temporary variable in the most inner scope of the anonymous method you debug, but that requires recompiling the entire solution and sometimes dynamically loaded packages to debug. Hardly very pleasant experience, but good Zen practice I guess... Use the compile time to Meditate, and watch your emotional health improve... or not...

    ReplyDelete

Post a Comment