mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-11-20 22:19:35 +01:00
LazDebuggerFp: debugln for function calling (watch-eval)
This commit is contained in:
parent
9fb4edfbe5
commit
0429c822c1
@ -93,6 +93,9 @@ type
|
|||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
|
var
|
||||||
|
FPDBG_FUNCCALL: PLazLoggerLogGroup;
|
||||||
|
|
||||||
{ TFpValueCallParamStringByRef }
|
{ TFpValueCallParamStringByRef }
|
||||||
|
|
||||||
function TFpValueCallParamStringByRef.GetDwarfDataAddress(out
|
function TFpValueCallParamStringByRef.GetDwarfDataAddress(out
|
||||||
@ -377,6 +380,7 @@ begin
|
|||||||
|
|
||||||
if FOrigStackPtr <> 0 then
|
if FOrigStackPtr <> 0 then
|
||||||
FDbgThread.SetStackPointerRegisterValue(FOrigStackPtr);
|
FDbgThread.SetStackPointerRegisterValue(FOrigStackPtr);
|
||||||
|
debugln(FPDBG_FUNCCALL, ['CallRoutine END (CTX DESTROY)']);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TFpDbgInfoCallContext.WriteStack: Boolean;
|
function TFpDbgInfoCallContext.WriteStack: Boolean;
|
||||||
@ -578,5 +582,7 @@ begin
|
|||||||
AVal := TFpValueConstString.Create(s);
|
AVal := TFpValueConstString.Create(s);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
initialization
|
||||||
|
FPDBG_FUNCCALL := DebugLogger.FindOrRegisterLogGroup('FPDBG_FUNCCALL' {$IFDEF FPDBG_FUNCCALL} , True {$ENDIF} );
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
|||||||
@ -421,7 +421,7 @@ uses
|
|||||||
FpImgReaderBase, FpDbgCommon;
|
FpImgReaderBase, FpDbgCommon;
|
||||||
|
|
||||||
var
|
var
|
||||||
DBG_VERBOSE, DBG_WARNINGS, FPDBG_COMMANDS: PLazLoggerLogGroup;
|
DBG_VERBOSE, DBG_WARNINGS, FPDBG_COMMANDS, FPDBG_FUNCCALL: PLazLoggerLogGroup;
|
||||||
|
|
||||||
{ TDbgControllerCallRoutineCmd }
|
{ TDbgControllerCallRoutineCmd }
|
||||||
|
|
||||||
@ -451,6 +451,7 @@ end;
|
|||||||
|
|
||||||
procedure TDbgControllerCallRoutineCmd.Init;
|
procedure TDbgControllerCallRoutineCmd.Init;
|
||||||
begin
|
begin
|
||||||
|
debugln(FPDBG_FUNCCALL, ['CallRoutine INIT - Cmd.Init - ProcessLoop starts']);
|
||||||
inherited Init;
|
inherited Init;
|
||||||
|
|
||||||
FCallContext.WriteStack;
|
FCallContext.WriteStack;
|
||||||
@ -569,6 +570,7 @@ end;
|
|||||||
|
|
||||||
procedure TDbgControllerCallRoutineCmd.RestoreOriginalCode;
|
procedure TDbgControllerCallRoutineCmd.RestoreOriginalCode;
|
||||||
begin
|
begin
|
||||||
|
debugln(FPDBG_FUNCCALL, ['CallRoutine -- << Restore orig Code']);
|
||||||
if not FProcess.WriteInstructionCode(FOriginalInstructionPointer, Length(FOriginalCode), FOriginalCode[0]) then
|
if not FProcess.WriteInstructionCode(FOriginalInstructionPointer, Length(FOriginalCode), FOriginalCode[0]) then
|
||||||
raise Exception.Create('Failed to restore the original code at the instruction-pointer');
|
raise Exception.Create('Failed to restore the original code at the instruction-pointer');
|
||||||
end;
|
end;
|
||||||
@ -582,11 +584,13 @@ end;
|
|||||||
|
|
||||||
procedure TDbgControllerCallRoutineCmd.StoreInstructionPointer;
|
procedure TDbgControllerCallRoutineCmd.StoreInstructionPointer;
|
||||||
begin
|
begin
|
||||||
|
debugln(FPDBG_FUNCCALL, ['CallRoutine -- >> Store IP']);
|
||||||
FOriginalInstructionPointer := FController.CurrentThread.GetInstructionPointerRegisterValue;
|
FOriginalInstructionPointer := FController.CurrentThread.GetInstructionPointerRegisterValue;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TDbgControllerCallRoutineCmd.RestoreInstructionPointer;
|
procedure TDbgControllerCallRoutineCmd.RestoreInstructionPointer;
|
||||||
begin
|
begin
|
||||||
|
debugln(FPDBG_FUNCCALL, ['CallRoutine -- << Restore IP']);
|
||||||
{$ifdef cpui386}
|
{$ifdef cpui386}
|
||||||
FController.CurrentThread.SetRegisterValue('eip', FOriginalInstructionPointer);
|
FController.CurrentThread.SetRegisterValue('eip', FOriginalInstructionPointer);
|
||||||
{$else}
|
{$else}
|
||||||
@ -604,6 +608,7 @@ end;
|
|||||||
|
|
||||||
procedure TDbgControllerCallRoutineCmd.RestoreRegisters;
|
procedure TDbgControllerCallRoutineCmd.RestoreRegisters;
|
||||||
begin
|
begin
|
||||||
|
debugln(FPDBG_FUNCCALL, ['CallRoutine -- << RestoreRegisters']);
|
||||||
FController.CurrentThread.RestoreRegisters;
|
FController.CurrentThread.RestoreRegisters;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -614,6 +619,7 @@ end;
|
|||||||
|
|
||||||
procedure TDbgControllerCallRoutineCmd.StoreRegisters;
|
procedure TDbgControllerCallRoutineCmd.StoreRegisters;
|
||||||
begin
|
begin
|
||||||
|
debugln(FPDBG_FUNCCALL, ['CallRoutine -- >> StoreRegisters']);
|
||||||
FController.CurrentThread.StoreRegisters;
|
FController.CurrentThread.StoreRegisters;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -1937,6 +1943,7 @@ function TDbgController.Call(const FunctionAddress: TFpDbgMemLocation;
|
|||||||
var
|
var
|
||||||
Context: TFpDbgInfoCallContext;
|
Context: TFpDbgInfoCallContext;
|
||||||
begin
|
begin
|
||||||
|
debugln(FPDBG_FUNCCALL, ['CallRoutine BEGIN']);
|
||||||
Context := TFpDbgInfoCallContext.Create(ABaseContext, AMemReader, AMemConverter, FCurrentProcess, FCurrentThread);
|
Context := TFpDbgInfoCallContext.Create(ABaseContext, AMemReader, AMemConverter, FCurrentProcess, FCurrentThread);
|
||||||
Context.AddReference;
|
Context.AddReference;
|
||||||
InitializeCommand(TDbgControllerCallRoutineCmd.Create(self, FunctionAddress, Context));
|
InitializeCommand(TDbgControllerCallRoutineCmd.Create(self, FunctionAddress, Context));
|
||||||
@ -1947,6 +1954,7 @@ initialization
|
|||||||
DBG_VERBOSE := DebugLogger.FindOrRegisterLogGroup('DBG_VERBOSE' {$IFDEF DBG_VERBOSE} , True {$ENDIF} );
|
DBG_VERBOSE := DebugLogger.FindOrRegisterLogGroup('DBG_VERBOSE' {$IFDEF DBG_VERBOSE} , True {$ENDIF} );
|
||||||
DBG_WARNINGS := DebugLogger.FindOrRegisterLogGroup('DBG_WARNINGS' {$IFDEF DBG_WARNINGS} , True {$ENDIF} );
|
DBG_WARNINGS := DebugLogger.FindOrRegisterLogGroup('DBG_WARNINGS' {$IFDEF DBG_WARNINGS} , True {$ENDIF} );
|
||||||
FPDBG_COMMANDS := DebugLogger.FindOrRegisterLogGroup('FPDBG_COMMANDS' {$IFDEF FPDBG_COMMANDS} , True {$ENDIF} );
|
FPDBG_COMMANDS := DebugLogger.FindOrRegisterLogGroup('FPDBG_COMMANDS' {$IFDEF FPDBG_COMMANDS} , True {$ENDIF} );
|
||||||
|
FPDBG_FUNCCALL := DebugLogger.FindOrRegisterLogGroup('FPDBG_FUNCCALL' {$IFDEF FPDBG_FUNCCALL} , True {$ENDIF} );
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
|||||||
@ -632,6 +632,9 @@ function dbgs(ADbgSymbolKind: TDbgSymbolKind): String; overload;
|
|||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
|
var
|
||||||
|
FPDBG_FUNCCALL: PLazLoggerLogGroup;
|
||||||
|
|
||||||
function dbgs(ADbgSymbolKind: TDbgSymbolKind): String;
|
function dbgs(ADbgSymbolKind: TDbgSymbolKind): String;
|
||||||
begin
|
begin
|
||||||
Result := '';
|
Result := '';
|
||||||
@ -751,6 +754,7 @@ end;
|
|||||||
|
|
||||||
procedure TFpDbgAbstractCallContext.SetError(const Message: string);
|
procedure TFpDbgAbstractCallContext.SetError(const Message: string);
|
||||||
begin
|
begin
|
||||||
|
debugln(FPDBG_FUNCCALL, ['CallRoutine -- !!! Ctx.SetError: ', Message]);
|
||||||
FIsValid := False;
|
FIsValid := False;
|
||||||
FMessage := Message;
|
FMessage := Message;
|
||||||
end;
|
end;
|
||||||
@ -1859,5 +1863,7 @@ begin
|
|||||||
FHasInfo := True;
|
FHasInfo := True;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
initialization
|
||||||
|
FPDBG_FUNCCALL := DebugLogger.FindOrRegisterLogGroup('FPDBG_FUNCCALL' {$IFDEF FPDBG_FUNCCALL} , True {$ENDIF} );
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user