In latest lazarus, i have a issue with debugger not really working on any variables - i've attached a picture, this is stock install: Lazarus 2.0.0RC3 r59877 FPC 3.0.4 i386-win32-win32/win64
Compared to the same app of yours under
- a previous 2.0rc
- 1.8.6
In either case, since this looks like a gdb issue: gdb has not changed. (And neither has fpc, in case it is the generated debug info)
I can not reproduce this. Do you have an example how to reproduce?
Also to gather the details, I am not clear from your description what you use?
- I assume you have a 64bit windows /64bit cpu ?
- You are using the 64 or 32bit IDE? You did / didn't install and use the cross compiler for the other bitness?
Are you using "Dwarf2 with sets" ? "Dwarf 3" may cause errors like the one you describe, and that may happen seemingly at random.
What are your optimization settings? (O0 or O1 ?). And double-check smart-linking is off.
Out of interest does it happen to:
- local var
- parameters (without const, constref, var or out)
- parameters with const, constref, var or out (the 0x40 may be because of "const")
("const" may happen at random, since fpc may encode it different, depending on type)
- class fields
- globals
?
If it is the const modifier, adding a watch ^widechar(Text)^ may help.
Note, that if it worked, widestring is known to the debugger as ^widechar (that is what fpc writes into the debuginfo). That means that de-ref Text^ will/should show you ONE char. That is a known issue, and unless gdb changes something, that may be hard to fix. But that is widestring related.
On Win64 with 64 bit target apps, it is known that there is an issue (either in fpc or gdb) where changes at one bit of code (in any unit) can cause issues with single stepping in another unit. But so far this only affected single stepping. (And this happens with all versions of GDB, and according to latest reports maybe with lldb too)
https://bugs.freepascal.org/view.php?id=34159
You may want to try with alternate versions of GDB (It's a matter of finding some time, and then they will be added to the default install, but not 2.0 anymore)
It does not matter if you cross compile or not. It only matters if you app (the target) is 32 or 64 bit. (And according to that place the gdb.exe in the mingw/i386-win32/bin or mingw/x86_64-win64/bin folder in your lazarus install dir)
64 bit:
https://sourceforge.net/projects/lazarus/files/Lazarus%20Windows%2064%20bits/Alternative%20GDB/32 bit:
https://sourceforge.net/projects/lazarus/files/Lazarus%20Windows%2032%20bits/Alternative%20GDB/Start with the 8.2 version.
But keep in mind, that sometimes earlier versions work better than the latest.