[Lazarus] Debugging the unicode RTL

Michael Van Canneyt michael at freepascal.org
Thu Jan 12 11:26:59 CET 2023

On Thu, 12 Jan 2023, Sven Barth via lazarus wrote:

> Michael Van Canneyt via lazarus <lazarus at lists.lazarus-ide.org> schrieb am
> Do., 12. Jan. 2023, 10:42:
>> 1/ Should the compiler provide some symbol in - say - the system unit to
>> deterine
>> whether the RTL is compiled in unicode mode, or is another mechanism
>> preferred to do this ?
> "Char" already is such a symbol that the debugger can and must use to
> determine this. And if no debug information for aliases is created then
> *that* needs to be fixed instead.

In earlier discussions I was told

   Char = UnicodeChar;

   C : Char;

means 'replace char with unicodechar'.

So in the final binary only the effect of the declaration

   C : unicodechar ;

will be seen. Which is IMO the only correct behaviour.

If you want a different type you need to do

   Char = Type Unicodechar;

which creates 2 distinct types which are assignment compatible. This will
lead to other problems.

I also don't think the debugger needs to be able to determine the definition
of "char".

It needs to determine the definition of "string" which will be an array of
unicodechar or ansichar. Once it knows that, the rest will follow, since 
the definition of unicodechar or ansichar will have the correct size.

> But the debugger also needs to be able to determine Unicode vs. ANSI if no
> debug information for the System unit is available thus it needs to rely on
> CodeTools then and what *that* provides for Char.

I don't think this is a very reliable method. In moderately difficult code,
half of the time the codetools don't work properly, so relying on them to 
provide this info is a recipe for disaster. Hence my question...


More information about the lazarus mailing list