View Issue Details
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0020710||Lazarus||Debugger||public||2011-11-19 20:19||2013-01-13 14:19|
|Reporter||Denis Kozlov||Assigned To||Martin Friebe|
|Status||closed||Resolution||no change required|
|Summary||0020710: Variable inspection uses wrong index for reading characters from string, showing S[I+1] instead of S[I]|
|Description||Debugger features use a wrong index when inspecting the character value of a string, e.g. S[I]. In fact, you are going to see S[I+1] instead of S[I].|
A simple demonstration is attached. This affect all of the debugger features, e.g. watch, inspect, mouse over in IDE.
Check the "Steps To Reproduce" for more info.
|Steps To Reproduce||1) Use the code below as a sample program.|
2) Set breakpoint on a first WriteLn.
3) Run the program and wait for the breakpoint to be triggered.
4) Once breakpoint is triggered, inspect values of I and S[I].
Upon the first breakpoint inspection, you will get:
>> S='12345'; I=1; S[I]='2'; S[I+1]='3';
In reality, it should be:
>> S='12345'; I=1; S[I]='1'; S[I+1]='2';
S: string = '12345';
A: array [1..5] of Char = ('1', '2', '3', '4', '5');
for I := 1 to Length(S) do
WriteLn(I, '=', S[I], S[I+1]);
for I := Low(A) to High(A) do
WriteLn(I, '=', A[I], A[I+1]);
P.S. I've included an array of chars in the example to double check and demonstrate that inspection of array values does not get affected by this issue.
|Additional Information||Lazarus 0.9.30.2|
|Tags||No tags attached.|
|Fixed in Revision|
Just a note:
You have filed this as "FPC IDE" issue, but you also mention Lazarus, which is a different IDE.
I do not know if the FPC IDE has this issue, but I do guess it does. As for Lazarus please see 0017619
I couldn't find where to specify the Lazarus bit, so I just added it to the additional information. I simply clicked on the "Report Issue" link. Now I see that I should have selected the Lazarus project first and then followed to the reporting.
Anyway, I'm guessing the debugger is the same for both IDE, so the issue would occur in both FPC IDE and Lazarus.
Indeed both use GDB as debugger. However please look at the related issue.
With current GDB it is not always possible to distinguish between pchar and string. Therefore both results are now shown.
This is fixed in Lazarus 0.9.31
Expressions with both pchar and string are not supported and will not be until GDB will handle dwarf 3.
please indicate if the issue can be closed?
Please read the comments here and on the related issue.
If you know a better solution, please reopen and specify.
||Thanks for the fix! I have just noticed debugger displaying both pchar and string values while using Lazarus 1.0.4 :)|
|2011-11-19 20:19||Denis Kozlov||New Issue|
|2011-11-19 20:39||Martin Friebe||Note Added: 0054267|
|2011-11-19 22:03||Marco van de Voort||Project||FPC => Lazarus|
|2011-11-19 22:23||Juha Manninen||Relationship added||related to 0017619|
|2011-11-19 22:37||Denis Kozlov||Note Added: 0054272|
|2011-11-19 23:05||Martin Friebe||Note Added: 0054274|
|2011-11-19 23:05||Martin Friebe||LazTarget||=> -|
|2011-11-19 23:05||Martin Friebe||Status||new => feedback|
|2011-11-19 23:09||Martin Friebe||Assigned To||=> Martin Friebe|
|2011-11-19 23:09||Martin Friebe||Category||IDE => Debugger|
|2011-11-19 23:09||Martin Friebe||Product Version||2.4.4 =>|
|2011-11-21 12:53||Martin Friebe||Status||feedback => resolved|
|2011-11-21 12:53||Martin Friebe||Resolution||open => no change required|
|2011-11-21 12:53||Martin Friebe||Note Added: 0054337|
|2013-01-10 18:00||Denis Kozlov||Note Added: 0064801|
|2013-01-13 14:19||Bart Broersma||Status||resolved => closed|