Martin Frb wroteAfter writing the below, I found the locals window may have some limit
(not sure why/how).
But watches should be fine.
Maybe we're talking about different things.
I went to watches, and selected 'Copy raw value':
$000000000071A430^: 'with leerlingen as ('#$0A' select distinct'#$0A' LL_ID, IS_ID'#$0A' from'#$0A' leerling'#$0A' (I cut the length, in this window it is indeed full length)
When I choose 'Copy raw value' from the context menu in the grid with values:
- I don't want the #$0A, I want the actual character.
- I also don't want the quotes
- and definitely not the pointer to memory
Maybe I have a complete misunderstanding of what 'raw value' means. For a string, to me that means the actual data of the string, unprocessed.
I expect to be able to copy & paste it and use the value as-is. Similar for pchar/pansichar/pwidechar.
In the above example, copy & paste to a program where I can execute the SQL.
With what I get today, I need to resort to printing it to screen/file to be able to use the value.
Show quoted text 11 lines
On 29/11/2025 17:10, Michael Van Canneyt via lazarus wrote:
>
> Hi
>
> How can I get the actual value of an ansistring from the lazarus
> debugger ?
>
> - Every value I get is limited to 255 characters
That is odd / unexpected. (unless its shortstring, but I guess you
wouldn't ask then..)
It is not shortstring.
Are you using FpDebug? Win or Linux?
linux, fpdebug
Which compiler version?
3.2.2
Are you using Dwarf-2 or Dwarf-3?
Dwarf 3.
And, if on Linux, are you sure all your code (including packages/rtl)
uses the same (or no debug info)?
RTL/Packages use the default.
Show quoted text 11 lines
Those settings usually only affect if the debugger can distinguish
between ansistring and pchar. It shouldn't impact the length.
If FpDebug thinks its a PChar then it will print it with address (by
default / can configured)
$12345678^: 'abcd'
versus a string would just print
'abcd'
But even a pchar prints full length for me
It seems to think that it is a pchar then ?
If FpDebug, what does
? :length(foo)
report?
'Error: argument not supported at 2: "length("
(and yes, intrinsicprefix is set to colon)
A feature request: Please add a button (maybe a dropdown button) next to the watch expression edit control which shows the available intrinsics: When one is chosen, it inserts it in the watch edit box with the expected number of arguments.
for example
:length()
:pos(,,)
...and position the cursor after the initial (
This way,
a) the user sees what is available. I had no idea that this is available.
b) avoids typing it and making mistakes.
For you, this is likely all 'very obvious', but for average jane or joe, it is not. I'm sure there are many more hidden gems available, but they're not obvious or easily detectable.
Another suggestion:
A 'help' button in the "watch list" screen that shows the below would not go amiss:
https://wiki.freepascal.org/IDE_Window:_Watch_list
It may be a good idea to also add some 'quick links' to the top of that page.
A link to the page you refer to is buried halfway the page, it deserves a more prominent place to make the hidden gems more visible...
Show quoted text 5 lines
Can you access chars / substrings further up?
foo[500..900]
?
The display (string vs array) may depend on it being seen as string or
pchar.
I can, and it prints PChar: len=X (array of characters)...
There is a setting, in "Debugger Backends" property grid: Mem limits.
There the max read len can be restricted.
So if your variable contains trash, the debugger doesn't try to allocate
100GB for a string that doesn't exist.
I checked, the limits are way above 255.
Show quoted text 7 lines
> - I can't seem to get rid of the #$0A for embedded newlines etc.
Context menu, copy raw value.
As for watching while debugging, that is currently all assuming single
line display (like the watches window / even though there are some
multiline, like evaluate, but they don't do that).
So while watching, there isn't a display that shows the string as plain text
Well, I don't need the full length while watching (although that would be useful). I need to be able to copy it to another program and use it there.
To be clear: I think the lazarus debugger is very powerful (definitely more powerful than Delphi's), but at the same time I feel it needs some polishing to be more easily accessible for the non-expert.
...and I believe I belong in the latter category where debugging is concerned.
Michael.