LLDB Debugger: mem leaks

git-svn-id: trunk@58353 -
This commit is contained in:
martin 2018-06-20 15:28:04 +00:00
parent 4295b09fdb
commit 35c480e02e
2 changed files with 43 additions and 9 deletions

View File

@ -348,6 +348,7 @@ var
CurThr: Boolean;
Arguments: TStringList;
addr: TDBGPtr;
te: TThreadEntry;
begin
CurrentThreads.Clear;
for i := 0 to Length(Instr.Res) - 1 do begin
@ -356,16 +357,16 @@ begin
if CurThr then
CurThrId := TId;
CurrentThreads.Add(
CurrentThreads.CreateEntry(
addr,
Arguments,
func,
filename, '',
line,
TId, name, ''
)
te := CurrentThreads.CreateEntry(
addr,
Arguments,
func,
filename, '',
line,
TId, name, ''
);
CurrentThreads.Add(te);
te.Free;
Arguments.Free;
end;
@ -455,6 +456,7 @@ begin
e := TCallStackEntry(It.DataPtr^);
e.Init(addr, Arguments, func, filename, '', line);
end;
Arguments.Free;
end;
It.Free;
@ -1057,6 +1059,7 @@ begin
if ParseFrameLocation(ALine, AnId, AnIsCurrent, AnAddr, AFuncName, AnArgs,
AFile, SrcLine, AReminder)
then begin
AnArgs.Free;
FCurrentLocation.Address := AnAddr;
FCurrentLocation.FuncName := AFuncName;
FCurrentLocation.SrcFile := AFile;

View File

@ -173,6 +173,7 @@ type
procedure SendCommandDataToDbg(); override;
public
constructor Create(AnAddress: TDBGPtr; ALen: Cardinal);
destructor Destroy; override;
property Res: TArrayOfByte read FRes;
end;
@ -188,6 +189,7 @@ type
procedure SendCommandDataToDbg(); override;
public
constructor Create(AThread, AFrame: Integer);
destructor Destroy; override;
property Res: TStringList read FRes;
end;
@ -202,6 +204,7 @@ type
function ProcessInputFromDbg(const AData: String): Boolean; override;
public
constructor Create();
destructor Destroy; override;
property Res: TStringArray read FRes;
end;
@ -216,6 +219,7 @@ type
function ProcessInputFromDbg(const AData: String): Boolean; override;
public
constructor Create(FrameCount: Integer; AThread: Integer);
destructor Destroy; override;
property Res: TStringArray read FRes;
end;
@ -477,6 +481,9 @@ begin
if not Result then // if Result=true then self is destroyed;
MarkAsSuccess;
Result := true;
//TODO: "error: No breakpoints exist to be deleted."
// prevent from failing other instruction
end;
constructor TLldbInstructionBreakDelete.Create(AnId: Integer);
@ -644,6 +651,12 @@ begin
inherited Create(Format('memory read --force --size 1 --format x --count %u %u', [ALen, AnAddress]));
end;
destructor TLldbInstructionMemory.Destroy;
begin
inherited Destroy;
FRes := nil;
end;
{ TLldbInstructionRegister }
procedure TLldbInstructionRegister.DoFree;
@ -722,6 +735,12 @@ begin
inherited Create('register read --all', AThread, AFrame);
end;
destructor TLldbInstructionRegister.Destroy;
begin
inherited Destroy;
FRes.Free;
end;
{ TLldbInstructionThreadList }
procedure TLldbInstructionThreadList.SendCommandDataToDbg();
@ -773,6 +792,12 @@ begin
inherited Create('thread list');
end;
destructor TLldbInstructionThreadList.Destroy;
begin
inherited Destroy;
FRes := nil;
end;
{ TLldbInstructionStackTrace }
procedure TLldbInstructionStackTrace.SendCommandDataToDbg();
@ -824,5 +849,11 @@ begin
inherited Create(Format('bt %d', [FrameCount]), AThread);
end;
destructor TLldbInstructionStackTrace.Destroy;
begin
inherited Destroy;
FRes := nil;
end;
end.