[Lazarus] Debugging the unicode RTL

Michael Van Canneyt michael at freepascal.org
Thu Jan 12 10:42:08 CET 2023


Hello,

As written in other mails, I'm currently working on the Unicode RTL of FPC.

Debugging programs using the unicode RTL is possible, but not comfortable:

I have currently identified 2 problems in Lazarus which make debugging such
programs difficult:

- The IDE does now know the -tSUBTARGET option.
   This means that it does not correctly identify the IFDEF paths in source
   code, as it didn't correctly parse all config files.

- Debugging programs works in general quite OK, except for displaying of
   some strings. Most notable, the exception message is affected:
   only the first character of the exception message is shown.

It seems to me obvious that the IDE needs to be aware of the -t option. 
But for debugging this is not enough: I think the IDE debugger needs 
another mechanism to determine using whether a program uses a unicode RTL or not. 
The way this happens in code is 
{$IF SIZEOF(CHAR)=2}
// unicode RTL code.
{$ELSE}
// Ansi rtl code.
{$ENDIF}
Obviously, this is of no use in the debugger.  The subtarget name is also
not usable, since any subtarget definition can specify that the RTL should 
be unicode.

Questions:

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 ?

2/ Where can I find the code that extracts the message from an exception
object ? So I can have a shot at trying to fix the display.

Michael.


More information about the lazarus mailing list