Add optional OnWriteLine2. Can be used to support Step Out debugging.

This commit is contained in:
Martijn Laan 2020-08-31 07:03:54 +02:00
parent ab01a58610
commit e42274928a
No known key found for this signature in database
GPG Key ID: 9F8C8C5DDA579626

View File

@ -907,8 +907,10 @@ type
{$IFNDEF PS_USESSUPPORT}
TPSOnWriteLineEvent = function (Sender: TPSPascalCompiler; Position: Cardinal): Boolean;
TPSOnWriteLine2Event = function (Sender: TPSPascalCompiler; Position: Cardinal; IsProcExit: Boolean): Boolean;
{$ELSE}
TPSOnWriteLineEvent = function (Sender: TPSPascalCompiler; FileName: tbtString; Position: Cardinal): Boolean;
TPSOnWriteLine2Event = function (Sender: TPSPascalCompiler; FileName: tbtString; Position: Cardinal; IsProcExit: Boolean): Boolean;
{$ENDIF}
TPSOnExternalProc = function (Sender: TPSPascalCompiler; Decl: TPSParametersDecl; const Name, FExternal: tbtString): TPSRegProc;
@ -952,6 +954,7 @@ type
FOnBeforeOutput: TPSOnNotify;
FOnBeforeCleanup: TPSOnNotify;
FOnWriteLine: TPSOnWriteLineEvent;
FOnWriteLine2: TPSOnWriteLine2Event;
FContinueOffsets, FBreakOffsets: TPSList;
FOnTranslateLineInfo: TPSOnTranslateLineInfoProc;
FAutoFreeList: TPSList;
@ -1037,7 +1040,7 @@ type
procedure Debug_WriteParams(ProcNo: Cardinal; Proc: TPSInternalProcedure);
procedure Debug_WriteLine(BlockInfo: TPSBlockInfo);
procedure Debug_WriteLine2(BlockInfo: TPSBlockInfo; IsProcExit: Boolean);
function IsCompatibleType(p1, p2: TPSType; Cast: Boolean): Boolean;
@ -1179,6 +1182,8 @@ type
property OnWriteLine: TPSOnWriteLineEvent read FOnWriteLine write FOnWriteLine;
property OnWriteLine2: TPSOnWriteLine2Event read FOnWriteLine2 write FOnWriteLine2;
property OnExternalProc: TPSOnExternalProc read FOnExternalProc write FOnExternalProc;
property OnUseVariable: TPSOnUseVariable read FOnUseVariable write FOnUseVariable;
@ -5354,10 +5359,21 @@ begin
end;
procedure TPSPascalCompiler.Debug_WriteLine(BlockInfo: TPSBlockInfo);
begin
Debug_WriteLine2(BlockInfo, False);
end;
procedure TPSPascalCompiler.Debug_WriteLine2(BlockInfo: TPSBlockInfo; IsProcExit: Boolean);
var
b: Boolean;
begin
if @FOnWriteLine <> nil then begin
if @FOnWriteLine2 <> nil then begin
{$IFNDEF PS_USESSUPPORT}
b := FOnWriteLine2(Self, FParser.CurrTokenPos, IsProcExit);
{$ELSE}
b := FOnWriteLine2(Self, FModule, FParser.CurrTokenPos, IsProcExit);
{$ENDIF}
end else if @FOnWriteLine <> nil then begin
{$IFNDEF PS_USESSUPPORT}
b := FOnWriteLine(Self, FParser.CurrTokenPos);
{$ELSE}
@ -10966,7 +10982,7 @@ begin
end;
CSTII_Exit:
begin
Debug_WriteLine(BlockInfo);
Debug_WriteLine2(BlockInfo, BlockInfo.SubType = tProcBegin);
BlockWriteByte(BlockInfo, Cm_R);
FParser.Next;
if (BlockInfo.SubType = tifOneliner) or (BlockInfo.SubType = TOneLiner) then
@ -11108,7 +11124,7 @@ begin
if (BlockInfo.SubType = tMainBegin) or (BlockInfo.SubType = tProcBegin)
{$IFDEF PS_USESSUPPORT} or (BlockInfo.SubType = tUnitInit) or (BlockInfo.SubType = tUnitFinish) {$endif} then //nvds
begin
Debug_WriteLine(BlockInfo);
Debug_WriteLine2(BlockInfo, BlockInfo.SubType = tProcBegin);
BlockWriteByte(BlockInfo, Cm_R);
{$IFDEF PS_USESSUPPORT}
if FParser.CurrTokenId = CSTII_End then //nvds