13

Could anyone explain this screen:

enter image description here

As you can see I have simple array - debugger shows values of its elements when I use A[0], A1... but I cannot get elements with local variable A[i] (but value of "i" is shown correctly).

Project settings:
Debug info: ON
Local Symbols: ON
Optimization: OFF.

Project (one PAS file) is BUILD so DCU is fresh. You can see on that screen almost full code of this test project so there is no chance that array A or "i" is declared in some other unit etc...

Now I checked - the same code in Delphi XE3 works perfectly - debugger shows all values. It seems that XE4 has a serious bug in basic feature :-((

RRUZ
  • 134,889
  • 20
  • 356
  • 483
rafal chlopek
  • 558
  • 5
  • 12
  • 1
    check properties for A[i] watch and try to setting "allow function call" there. Just shooting into the skies. – Arioch 'The May 29 '13 at 06:36
  • 1
    try adding `j:integer` variable, adding `j := i` into the loop body and watching `A[j]` instead. It is exotic tome (XE2 user) to see i grayed out and i cannot see any other reason, than it being loop-variable. BTW, turning optimizations ON, would it help ? – Arioch 'The May 29 '13 at 06:38
  • 1
    Please post your "Project Options" window selecting the "Compiler" item so that we could see the full configuration. – gustavogbc Jun 05 '13 at 22:33
  • What does `High(A)` return? I'm not sure how `High` works with associative arrays, but is it possible `High(A)` is returning the highest value, not highest key? If that's the case, it may be trying to access `A[2]`, and that is inaccessable – dKen Jun 07 '13 at 11:51
  • I tried to reproduce in an older version of Delphi and had some likely behavior... ALthough, in my context, Optimization was ON. I would like to compare your full configuration (your "Project Options" window selecting the "Compiler") with mine, @rafal-chlopek. – gustavogbc Jun 07 '13 at 22:06
  • @dKen: `A` is not an "associative array". It is an ordinary static array. `High(A)` is `1`. – Andreas Rejbrand Dec 18 '19 at 13:07

2 Answers2

0

It doesn't work because 'val' is a function and not a variable. Double click on the watched item and check the property 'allow function calls'.

  • 2
    It's clearly visible from the code the OP posted, that 'val' is an integer child element (that is: variable indeed) of the record named 'TSome', and A is an array of that record. Therefore, A[i].val is pointing to an integer variable and not a function indeed... – That Marc Apr 29 '16 at 22:01
0

i is a var and this var need an amount for instance change i to 1 and check it;

A[1].val;