mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-10 14:16:25 +02:00
Cleaned up breakpoint creation.
This commit is contained in:
parent
eade19d2bd
commit
f11d2744db
@ -214,10 +214,6 @@ var
|
|||||||
e, Id: Integer;
|
e, Id: Integer;
|
||||||
Line: Cardinal;
|
Line: Cardinal;
|
||||||
bp: TFpInternalBreakpoint;
|
bp: TFpInternalBreakpoint;
|
||||||
|
|
||||||
AContext: TFpDbgSymbolScope;
|
|
||||||
AValue: TFpValue;
|
|
||||||
|
|
||||||
begin
|
begin
|
||||||
CallProcessLoop:=false;
|
CallProcessLoop:=false;
|
||||||
if GController.MainProcess = nil
|
if GController.MainProcess = nil
|
||||||
@ -250,6 +246,7 @@ begin
|
|||||||
// current addr
|
// current addr
|
||||||
P := '';
|
P := '';
|
||||||
Address := GController.CurrentThread.GetInstructionPointerRegisterValue;
|
Address := GController.CurrentThread.GetInstructionPointerRegisterValue;
|
||||||
|
bp := GController.CurrentProcess.AddBreak(Address);
|
||||||
end
|
end
|
||||||
else begin
|
else begin
|
||||||
P := GetPart([], [':'], S);
|
P := GetPart([], [':'], S);
|
||||||
@ -259,43 +256,13 @@ begin
|
|||||||
then begin
|
then begin
|
||||||
if P <> ''
|
if P <> ''
|
||||||
then begin
|
then begin
|
||||||
// address given
|
// Try to convert parameter to address
|
||||||
Val(P, Address, e);
|
Val(P, Address, e);
|
||||||
if e <> 0
|
if e = 0 then
|
||||||
then begin
|
bp := GController.CurrentProcess.AddBreak(Address)
|
||||||
AContext := GController.CurrentProcess.SymbolTableInfo.FindSymbolScope(
|
else // Assume it is a proc/func name
|
||||||
GController.DefaultContext,
|
bp := GController.CurrentProcess.AddBreak(P);
|
||||||
GController.CurrentThread.GetInstructionPointerRegisterValue
|
|
||||||
);
|
|
||||||
if AContext = nil then begin
|
|
||||||
Writeln('Invalid context');
|
|
||||||
exit;
|
|
||||||
end;
|
|
||||||
AValue := AContext.FindSymbol(P);
|
|
||||||
if not assigned(AValue) then begin
|
|
||||||
WriteLN('Illegal address/unknown symbol: ', P);
|
|
||||||
Exit;
|
|
||||||
end;
|
|
||||||
Address:=AValue.Address.Address;
|
|
||||||
AValue.ReleaseReference;
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
//if Remove
|
|
||||||
//then begin
|
|
||||||
// if GController.CurrentProcess.RemoveBreak(Address)
|
|
||||||
// then WriteLn(format(sRemoveBreakpoint,[FormatAddress(Address)]))
|
|
||||||
// else WriteLn(Format(sRemoveBreakpointFailed, [FormatAddress(Address)]));
|
|
||||||
//end
|
|
||||||
//else begin
|
|
||||||
bp := GController.CurrentProcess.AddBreak(Address);
|
|
||||||
if bp <> nil then begin
|
|
||||||
inc(CurBreakId);
|
|
||||||
BreakPointIdMap.Add(CurBreakId, bp);
|
|
||||||
WriteLn(format(sAddBreakpoint, [CurBreakId, FormatAddress(Address)]));
|
|
||||||
end
|
|
||||||
else
|
|
||||||
WriteLn(Format(sAddBreakpointFailed, [FormatAddress(Address)]));
|
|
||||||
//end;
|
|
||||||
end
|
end
|
||||||
else begin
|
else begin
|
||||||
S := GetPart([':'], [], S);
|
S := GetPart([':'], [], S);
|
||||||
@ -305,25 +272,19 @@ begin
|
|||||||
WriteLN('Illegal line: ', S);
|
WriteLN('Illegal line: ', S);
|
||||||
Exit;
|
Exit;
|
||||||
end;
|
end;
|
||||||
//if Remove
|
|
||||||
//then begin
|
|
||||||
// if TDbgInstance(GController.CurrentProcess).RemoveBreak(P, Line)
|
|
||||||
// then WriteLn('breakpoint removed')
|
|
||||||
// else WriteLn('remove breakpoint failed');
|
|
||||||
// Exit;
|
|
||||||
//end;
|
|
||||||
|
|
||||||
bp := TDbgInstance(GController.CurrentProcess).AddBreak(P, Line);
|
bp := GController.CurrentProcess.AddBreak(P, Line);
|
||||||
if bp = nil
|
end;
|
||||||
then begin
|
|
||||||
WriteLn(Format(sAddBreakpointFailed, [S]));
|
if bp = nil
|
||||||
Exit;
|
then begin
|
||||||
end;
|
WriteLn(Format(sAddBreakpointFailed, [S]));
|
||||||
|
Exit;
|
||||||
inc(CurBreakId);
|
end;
|
||||||
BreakPointIdMap.Add(CurBreakId, bp);
|
|
||||||
WriteLn(format(sAddBreakpoint, [CurBreakId, ''])); // FormatAddress(bp.Location)]))
|
inc(CurBreakId);
|
||||||
end;
|
BreakPointIdMap.Add(CurBreakId, bp);
|
||||||
|
WriteLn(format(sAddBreakpoint, [CurBreakId, ''])); // FormatAddress(bp.Location)]))
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure HandleContinue(AParams: String; out CallProcessLoop: boolean);
|
procedure HandleContinue(AParams: String; out CallProcessLoop: boolean);
|
||||||
|
Loading…
Reference in New Issue
Block a user