From 20fc451aa1917e2960b2106c0cbf856fa54ad984 Mon Sep 17 00:00:00 2001 From: Sergey Larin Date: Fri, 27 Aug 2021 21:24:07 +0300 Subject: [PATCH] FpDebug takes into account that FPC 3.3.1 changed offset of the CodePage field in TAnsiRec. When reading strings, FpDebug sets the required CodePage to the received AnsiString, the value of which is read from the memory of the process being debugged. --- components/fpdebug/fpdbgdwarffreepascal.pas | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/components/fpdebug/fpdbgdwarffreepascal.pas b/components/fpdebug/fpdbgdwarffreepascal.pas index 46b9b14e0f..dfae3244a2 100644 --- a/components/fpdebug/fpdbgdwarffreepascal.pas +++ b/components/fpdebug/fpdbgdwarffreepascal.pas @@ -1431,7 +1431,10 @@ begin // use these hardcoded information, and hope that FPC does not change and // we never reach this point for a compilationunit that is not compiled by // fpc. - CodepageOffset := AddressSize * 3; + if TFpDwarfFreePascalSymbolClassMapDwarf3(TypeInfo.CompilationUnit.DwarfSymbolClassMap).FCompilerVersion >= $030300{$030301} then + CodepageOffset := AddressSize + SizeOf(Longint) + SizeOf(Word) + SizeOf(Word) + else + CodepageOffset := AddressSize * 3; Addr.Address := Addr.Address - CodepageOffset; if Context.ReadMemory(Addr, SizeVal(2), @Codepage) then Result := CodePageToCodePageName(Codepage) <> '';