LeakView:

1) localized LeakView. Patch from Marcelo B Paula. Part of bug #16540.
  2) Added LeakView translations: Portuguese (from Marcelo B Paula) and Russian.
  3) Removed LRS file.

git-svn-id: trunk@25594 -
This commit is contained in:
maxim 2010-05-24 00:05:01 +00:00
parent 7871499e11
commit 3d74da12bf
12 changed files with 367 additions and 110 deletions

7
.gitattributes vendored
View File

@ -1543,8 +1543,13 @@ components/lazthread/threadoptionsdialog.lfm svneol=native#text/plain
components/lazthread/threadoptionsdialog.lrs svneol=native#text/pascal
components/lazthread/threadoptionsdialog.pas svneol=native#text/plain
components/leakview/heaptrcview.lfm svneol=native#text/plain
components/leakview/heaptrcview.lrs svneol=native#text/pascal
components/leakview/heaptrcview.pas svneol=native#text/plain
components/leakview/languages/heaptrcview.pb.po svneol=native#text/plain
components/leakview/languages/heaptrcview.po svneol=native#text/plain
components/leakview/languages/heaptrcview.ru.po svneol=native#text/plain
components/leakview/languages/leakinfo.pb.po svneol=native#text/plain
components/leakview/languages/leakinfo.po svneol=native#text/plain
components/leakview/languages/leakinfo.ru.po svneol=native#text/plain
components/leakview/leakinfo.pas svneol=native#text/plain
components/leakview/leakview.lpk svneol=native#text/plain
components/leakview/leakview.pas svneol=native#text/plain

View File

@ -1,55 +1,53 @@
object HeapTrcViewForm: THeapTrcViewForm
Left = 399
Height = 402
Top = 139
Width = 447
ActiveControl = btnBrowse
Left = 470
Height = 424
Top = 325
Width = 672
Caption = 'HeapTrcViewForm'
ClientHeight = 402
ClientWidth = 447
ClientHeight = 424
ClientWidth = 672
FormStyle = fsStayOnTop
OnCreate = FormCreate
OnDestroy = FormDestroy
LCLVersion = '0.9.29'
object lblTrcFile: TLabel
Left = 16
Height = 16
Height = 14
Top = 16
Width = 37
Width = 35
Caption = '.trc file'
ParentColor = False
end
object edtTrcFileName: TEdit
Left = 72
Height = 23
Left = 88
Height = 21
Top = 16
Width = 311
Width = 520
Anchors = [akTop, akLeft, akRight]
TabOrder = 0
end
object btnUpdate: TButton
Left = 16
Height = 25
Height = 23
Top = 54
Width = 64
Width = 61
AutoSize = True
Caption = 'Update'
OnClick = btnUpdateClick
TabOrder = 1
end
object chkStayOnTop: TCheckBox
Left = 347
Height = 19
Left = 534
Height = 17
Top = 56
Width = 80
Width = 74
Anchors = [akTop, akRight]
Caption = 'Stay on top'
OnChange = chkStayOnTopChange
OnClick = chkStayOnTopClick
TabOrder = 2
end
object btnBrowse: TButton
Left = 399
Left = 624
Height = 20
Top = 14
Width = 32
@ -59,10 +57,10 @@ object HeapTrcViewForm: THeapTrcViewForm
TabOrder = 3
end
object chkUseRaw: TCheckBox
Left = 240
Height = 19
Left = 264
Height = 17
Top = 56
Width = 92
Width = 86
Caption = 'Raw leak data'
Checked = True
OnChange = chkUseRawChange
@ -71,21 +69,21 @@ object HeapTrcViewForm: THeapTrcViewForm
end
object ctrlPanel: TPanel
Left = 16
Height = 283
Height = 305
Top = 96
Width = 415
Width = 640
Anchors = [akTop, akLeft, akRight, akBottom]
BevelOuter = bvNone
ClientHeight = 283
ClientWidth = 415
ClientHeight = 305
ClientWidth = 640
TabOrder = 5
object trvTraceInfo: TTreeView
Left = 0
Height = 197
Height = 219
Top = 0
Width = 415
Width = 640
Align = alClient
DefaultItemHeight = 17
DefaultItemHeight = 15
ReadOnly = True
TabOrder = 0
OnDblClick = trvTraceInfoDblClick
@ -94,8 +92,8 @@ object HeapTrcViewForm: THeapTrcViewForm
object memoSummary: TMemo
Left = 0
Height = 81
Top = 202
Width = 415
Top = 224
Width = 640
Align = alBottom
ReadOnly = True
ScrollBars = ssVertical
@ -105,17 +103,17 @@ object HeapTrcViewForm: THeapTrcViewForm
Cursor = crVSplit
Left = 0
Height = 5
Top = 197
Width = 415
Top = 219
Width = 640
Align = alBottom
ResizeAnchor = akBottom
end
end
object btnClipboard: TButton
Left = 104
Height = 25
Height = 23
Top = 54
Width = 109
Width = 101
AutoSize = True
Caption = 'Paste Clipboard'
OnClick = btnClipboardClick

View File

@ -1,38 +0,0 @@
{ This is an automatically generated lazarus resource file }
LazarusResources.Add('THeapTrcViewForm','FORMDATA',[
'TPF0'#16'THeapTrcViewForm'#15'HeapTrcViewForm'#4'Left'#3#143#1#6'Height'#3
+#146#1#3'Top'#3#139#0#5'Width'#3#191#1#13'ActiveControl'#7#9'btnBrowse'#7'Ca'
+'ption'#6#15'HeapTrcViewForm'#12'ClientHeight'#3#146#1#11'ClientWidth'#3#191
+#1#9'FormStyle'#7#11'fsStayOnTop'#8'OnCreate'#7#10'FormCreate'#9'OnDestroy'#7
+#11'FormDestroy'#10'LCLVersion'#6#6'0.9.29'#0#6'TLabel'#10'lblTrcFile'#4'Lef'
+'t'#2#16#6'Height'#2#16#3'Top'#2#16#5'Width'#2'%'#7'Caption'#6#9'.trc file'
+#11'ParentColor'#8#0#0#5'TEdit'#14'edtTrcFileName'#4'Left'#2'H'#6'Height'#2
+#23#3'Top'#2#16#5'Width'#3'7'#1#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#0
+#8'TabOrder'#2#0#0#0#7'TButton'#9'btnUpdate'#4'Left'#2#16#6'Height'#2#25#3'T'
+'op'#2'6'#5'Width'#2'@'#8'AutoSize'#9#7'Caption'#6#6'Update'#7'OnClick'#7#14
+'btnUpdateClick'#8'TabOrder'#2#1#0#0#9'TCheckBox'#12'chkStayOnTop'#4'Left'#3
+'['#1#6'Height'#2#19#3'Top'#2'8'#5'Width'#2'P'#7'Anchors'#11#5'akTop'#7'akRi'
+'ght'#0#7'Caption'#6#11'Stay on top'#8'OnChange'#7#18'chkStayOnTopChange'#7
+'OnClick'#7#17'chkStayOnTopClick'#8'TabOrder'#2#2#0#0#7'TButton'#9'btnBrowse'
+#4'Left'#3#143#1#6'Height'#2#20#3'Top'#2#14#5'Width'#2' '#7'Anchors'#11#5'ak'
+'Top'#7'akRight'#0#7'Caption'#6#3'...'#7'OnClick'#7#14'btnBrowseClick'#8'Tab'
+'Order'#2#3#0#0#9'TCheckBox'#9'chkUseRaw'#4'Left'#3#240#0#6'Height'#2#19#3'T'
+'op'#2'8'#5'Width'#2'\'#7'Caption'#6#13'Raw leak data'#7'Checked'#9#8'OnChan'
+'ge'#7#15'chkUseRawChange'#5'State'#7#9'cbChecked'#8'TabOrder'#2#4#0#0#6'TPa'
+'nel'#9'ctrlPanel'#4'Left'#2#16#6'Height'#3#27#1#3'Top'#2'`'#5'Width'#3#159#1
+#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#8'akBottom'#0#10'BevelOuter'#7#6
+'bvNone'#12'ClientHeight'#3#27#1#11'ClientWidth'#3#159#1#8'TabOrder'#2#5#0#9
+'TTreeView'#12'trvTraceInfo'#4'Left'#2#0#6'Height'#3#197#0#3'Top'#2#0#5'Widt'
+'h'#3#159#1#5'Align'#7#8'alClient'#17'DefaultItemHeight'#2#17#8'ReadOnly'#9#8
+'TabOrder'#2#0#10'OnDblClick'#7#20'trvTraceInfoDblClick'#7'Options'#11#17'tv'
+'oAutoItemHeight'#16'tvoHideSelection'#21'tvoKeepCollapsedNodes'#11'tvoReadO'
+'nly'#14'tvoShowButtons'#12'tvoShowLines'#11'tvoShowRoot'#11'tvoToolTips'#0#0
+#0#5'TMemo'#11'memoSummary'#4'Left'#2#0#6'Height'#2'Q'#3'Top'#3#202#0#5'Widt'
+'h'#3#159#1#5'Align'#7#8'alBottom'#8'ReadOnly'#9#10'ScrollBars'#7#10'ssVerti'
+'cal'#8'TabOrder'#2#1#0#0#9'TSplitter'#8'splitter'#6'Cursor'#7#8'crVSplit'#4
+'Left'#2#0#6'Height'#2#5#3'Top'#3#197#0#5'Width'#3#159#1#5'Align'#7#8'alBott'
+'om'#12'ResizeAnchor'#7#8'akBottom'#0#0#0#7'TButton'#12'btnClipboard'#4'Left'
+#2'h'#6'Height'#2#25#3'Top'#2'6'#5'Width'#2'm'#8'AutoSize'#9#7'Caption'#6#15
+'Paste Clipboard'#7'OnClick'#7#17'btnClipboardClick'#8'TabOrder'#2#6#0#0#0
]);

View File

@ -28,7 +28,6 @@ type
procedure btnUpdateClick(Sender: TObject);
procedure btnBrowseClick(Sender: TObject);
procedure chkStayOnTopChange(Sender: TObject);
procedure chkStayOnTopClick(Sender: TObject);
procedure chkUseRawChange(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
@ -57,6 +56,27 @@ type
end;
resourcestring
StackTraceFormat = 'Leak: %d bytes x %d times'; // number of bytes leaked, leaks count
StackTraceFormatSingle = 'Leak: %d bytes'; // number of bytes leaked
StackLineFormatWithFile = '%s file: %s : %d; '; // stack addr, filename (no path), line number
StackLineFormat = '%s'; // stack addr
strTotalMemAlloc = 'Total Mem alloced: %d';
strLeakingMemSize = 'Leaking Mem Size: %d';
strLeakingBlocksCount = 'Leaking Blocks Count: %d';
//
rsErrorParse = 'Error while parsing trace file';
rsDTimes = ' (%d times)';
rsLeakView = 'Leak View';
//
slblTrace = '.trc file';
sbtnUpdate = 'Update';
sbtnClipBrd = 'Paste Clipboard';
schkRaw = 'Raw leak data';
schkTop = 'Stay on top';
sfrmCap = 'HeapTrcViewForm';
var
HeapTrcViewForm: THeapTrcViewForm = nil;
@ -68,16 +88,7 @@ procedure Register;
implementation
const // resorucestring ?
StackTraceFormat = 'Leak: %d bytes x %d times'; // number of bytes leaked, leaks count
StackTraceFormatSingle = 'Leak: %d bytes'; // number of bytes leaked
StackLineFormatWithFile = '%s file: %s : %d; '; // stack addr, filename (no path), line number
StackLineFormat = '%s'; // stack addr
strTotalMemAlloc = 'Total Mem alloced: %d';
strLeakingMemSize = 'Leaking Mem Size: %d';
strLeakingBlocksCount = 'Leaking Blocks Count: %d';
{$R *.lfm}
procedure ShowHeapTrcViewForm(JumpProc: TJumpProc);
begin
@ -120,10 +131,6 @@ begin
else Self.formStyle := fsNormal;
end;
procedure THeapTrcViewForm.chkStayOnTopClick(Sender: TObject);
begin
end;
procedure THeapTrcViewForm.chkUseRawChange(Sender: TObject);
begin
ChangeTreeText;
@ -132,6 +139,14 @@ end;
procedure THeapTrcViewForm.FormCreate(Sender: TObject);
begin
//
Caption := sfrmCap;
lblTrcFile.Caption:= slblTrace;
btnUpdate.Caption:= sbtnUpdate;
btnClipboard.Caption:= sbtnClipBrd;
chkUseRaw.Caption:= schkRaw;
chkStayOnTop.Caption:= schkTop;
//
fItems := TList.Create;
chkStayOnTop.Checked := FormStyle = fsStayOnTop;
end;
@ -247,7 +262,7 @@ begin
try
if info.GetLeakInfo(data, fItems) then ItemsToTree
else trvTraceInfo.Items.Add(nil, 'Error while parsing trace file');
else trvTraceInfo.Items.Add(nil, rsErrorParse);
memoSummary.Clear;
with memoSummary.Lines do begin
@ -318,7 +333,8 @@ function THeapTrcViewForm.GetStackTraceText(trace: TStackTrace; useRaw: boolean)
begin
if useRaw then begin
Result := trace.RawStackData;
if (Result <> '') and (trace.LeakCount > 1) then Result := Result + Format(' (%d times)', [trace.LeakCount]);
if (Result <> '') and (trace.LeakCount > 1) then Result := Result + Format(
rsDTimes, [trace.LeakCount]);
end;
if not useRaw or (Result = '') then begin
@ -358,13 +374,10 @@ end;
procedure Register;
begin
RegisterIDEMenuCommand(itmSecondaryTools, 'mnuLeakView', 'Leak View', nil, @IDEMenuClicked);
RegisterIDEMenuCommand(itmSecondaryTools, 'mnuLeakView', rsLeakView, nil,
@IDEMenuClicked);
end;
initialization
{$I heaptrcview.lrs}
finalization
HeapTrcViewForm.Free;

View File

@ -0,0 +1,75 @@
msgid ""
msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Project-Id-Version: \n"
"POT-Creation-Date: \n"
"PO-Revision-Date: \n"
"Last-Translator: Marcelo Borges de Paula\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Transfer-Encoding: 8bit\n"
#: heaptrcview.rsdtimes
msgid " (%d times)"
msgstr " (%d vezes)"
#: heaptrcview.rserrorparse
msgid "Error while parsing trace file"
msgstr "Erro ao analisar arquivo de rastreamento"
#: heaptrcview.rsleakview
msgid "Leak View"
msgstr "Exibir Vazamentos de Memória"
#: heaptrcview.sbtnclipbrd
msgid "Paste Clipboard"
msgstr "Colar Área Transf."
#: heaptrcview.sbtnupdate
msgid "Update"
msgstr "Atualizar"
#: heaptrcview.schkraw
msgid "Raw leak data"
msgstr "Dados não preparados"
#: heaptrcview.schktop
msgid "Stay on top"
msgstr "Permanecer no topo"
#: heaptrcview.sfrmcap
msgid "HeapTrcViewForm"
msgstr "Exibição Rastreamento Pilha"
#: heaptrcview.slbltrace
msgid ".trc file"
msgstr "arquivo .trc"
#: heaptrcview.stacklineformat
msgid "%s"
msgstr "%s"
#: heaptrcview.stacklineformatwithfile
msgid "%s file: %s : %d; "
msgstr "%s arquivo: %s : %d; "
#: heaptrcview.stacktraceformat
msgid "Leak: %d bytes x %d times"
msgstr "Vazamento: %d bytes x %d vezes"
#: heaptrcview.stacktraceformatsingle
msgid "Leak: %d bytes"
msgstr "Vazamento: %d bytes"
#: heaptrcview.strleakingblockscount
msgid "Leaking Blocks Count: %d"
msgstr "Contagem Blocos Vazando: %d"
#: heaptrcview.strleakingmemsize
msgid "Leaking Mem Size: %d"
msgstr "Tamanho Mem Vazando: %d"
#: heaptrcview.strtotalmemalloc
msgid "Total Mem alloced: %d"
msgstr "Total Mem alocada: %d"

View File

@ -0,0 +1,67 @@
msgid ""
msgstr "Content-Type: text/plain; charset=UTF-8"
#: heaptrcview.rsdtimes
msgid " (%d times)"
msgstr ""
#: heaptrcview.rserrorparse
msgid "Error while parsing trace file"
msgstr ""
#: heaptrcview.rsleakview
msgid "Leak View"
msgstr ""
#: heaptrcview.sbtnclipbrd
msgid "Paste Clipboard"
msgstr ""
#: heaptrcview.sbtnupdate
msgid "Update"
msgstr ""
#: heaptrcview.schkraw
msgid "Raw leak data"
msgstr ""
#: heaptrcview.schktop
msgid "Stay on top"
msgstr ""
#: heaptrcview.sfrmcap
msgid "HeapTrcViewForm"
msgstr ""
#: heaptrcview.slbltrace
msgid ".trc file"
msgstr ""
#: heaptrcview.stacklineformat
msgid "%s"
msgstr ""
#: heaptrcview.stacklineformatwithfile
msgid "%s file: %s : %d; "
msgstr ""
#: heaptrcview.stacktraceformat
msgid "Leak: %d bytes x %d times"
msgstr ""
#: heaptrcview.stacktraceformatsingle
msgid "Leak: %d bytes"
msgstr ""
#: heaptrcview.strleakingblockscount
msgid "Leaking Blocks Count: %d"
msgstr ""
#: heaptrcview.strleakingmemsize
msgid "Leaking Mem Size: %d"
msgstr ""
#: heaptrcview.strtotalmemalloc
msgid "Total Mem alloced: %d"
msgstr ""

View File

@ -0,0 +1,75 @@
msgid ""
msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Project-Id-Version: \n"
"POT-Creation-Date: \n"
"PO-Revision-Date: \n"
"Last-Translator: Maxim Ganetsky <maxkill@mail.ru>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Transfer-Encoding: 8bit\n"
#: heaptrcview.rsdtimes
msgid " (%d times)"
msgstr " (%d раз)"
#: heaptrcview.rserrorparse
msgid "Error while parsing trace file"
msgstr "Ошибка разбора файла стека вызовов"
#: heaptrcview.rsleakview
msgid "Leak View"
msgstr "Просмотр утечек памяти"
#: heaptrcview.sbtnclipbrd
msgid "Paste Clipboard"
msgstr "Вставить из буфера обмена"
#: heaptrcview.sbtnupdate
msgid "Update"
msgstr "Обновить"
#: heaptrcview.schkraw
msgid "Raw leak data"
msgstr "Необработанные данные об утечках"
#: heaptrcview.schktop
msgid "Stay on top"
msgstr "Поверх других окон"
#: heaptrcview.sfrmcap
msgid "HeapTrcViewForm"
msgstr "HeapTrace - просмотр утечек памяти"
#: heaptrcview.slbltrace
msgid ".trc file"
msgstr "Файл .trc"
#: heaptrcview.stacklineformat
msgid "%s"
msgstr "%s"
#: heaptrcview.stacklineformatwithfile
msgid "%s file: %s : %d; "
msgstr "файл %s: %s : %d; "
#: heaptrcview.stacktraceformat
msgid "Leak: %d bytes x %d times"
msgstr "Утечка: %d байт x %d раз"
#: heaptrcview.stacktraceformatsingle
msgid "Leak: %d bytes"
msgstr "Утечка: %d байт"
#: heaptrcview.strleakingblockscount
msgid "Leaking Blocks Count: %d"
msgstr "Количество утерянных блоков памяти: %d"
#: heaptrcview.strleakingmemsize
msgid "Leaking Mem Size: %d"
msgstr "Размер утерянной памяти: %d"
#: heaptrcview.strtotalmemalloc
msgid "Total Mem alloced: %d"
msgstr "Размер выделенной памяти: %d"

View File

@ -0,0 +1,23 @@
msgid ""
msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Project-Id-Version: \n"
"POT-Creation-Date: \n"
"PO-Revision-Date: \n"
"Last-Translator: Marcelo Borges de Paula\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Transfer-Encoding: 8bit\n"
#: leakinfo.calltraceprefix
msgid "Call trace for block "
msgstr "Chamar rastreamento para bloco"
#: leakinfo.rawtraceprefix
msgid "Stack trace:"
msgstr "Rastreamento da pilha:"
#: leakinfo.rsstacktrace
msgid "Stack trace"
msgstr "Rastreamento da pilha"

View File

@ -0,0 +1,15 @@
msgid ""
msgstr "Content-Type: text/plain; charset=UTF-8"
#: leakinfo.calltraceprefix
msgid "Call trace for block "
msgstr ""
#: leakinfo.rawtraceprefix
msgid "Stack trace:"
msgstr ""
#: leakinfo.rsstacktrace
msgid "Stack trace"
msgstr ""

View File

@ -0,0 +1,23 @@
msgid ""
msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Project-Id-Version: \n"
"POT-Creation-Date: \n"
"PO-Revision-Date: \n"
"Last-Translator: Maxim Ganetsky <maxkill@mail.ru>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Transfer-Encoding: 8bit\n"
#: leakinfo.calltraceprefix
msgid "Call trace for block "
msgstr "Стек вызовов для блока "
#: leakinfo.rawtraceprefix
msgid "Stack trace:"
msgstr "Стек вызовов:"
#: leakinfo.rsstacktrace
msgid "Stack trace"
msgstr "Стек вызовов"

View File

@ -98,6 +98,11 @@ type
function AllocHeapTraceInfo(const TrcFile: string): TLeakInfo;
function AllocHeapTraceInfoFromText(const TrcText: string): TLeakInfo;
resourcestring
CallTracePrefix = 'Call trace for block ';
RawTracePrefix = 'Stack trace:';
rsStackTrace = 'Stack trace';
implementation
function AllocHeapTraceInfo(const TrcFile: string): TLeakInfo;
@ -112,11 +117,6 @@ end;
// heap trace parsing implementation
const
CallTracePrefix = 'Call trace for block ';
RawTracePrefix = 'Stack trace:';
procedure ClearTraceInfo(var TraceInfo: THeapTraceInfo);
begin
with TraceInfo do begin
@ -365,7 +365,7 @@ begin
Val(hex, trace.Addr, err);
GetNumberAfter(Trc[TrcIndex], trace.BlockSize, 'size ');
end else begin
trace.RawStackData := 'Stack trace';
trace.RawStackData := rsStackTrace;
trace.Addr := 0;
trace.BlockSize := 0;
end;

View File

@ -23,24 +23,25 @@
</CompilerOptions>
<Description Value="Leak View. allows fast navigation trough HeapTrc (and other?) leaks."/>
<Version Major="1"/>
<Files Count="4">
<Files Count="3">
<Item1>
<Filename Value="heaptrcview.lfm"/>
<Type Value="LFM"/>
</Item1>
<Item2>
<Filename Value="heaptrcview.lrs"/>
<Type Value="LRS"/>
</Item2>
<Item3>
<Filename Value="heaptrcview.pas"/>
<HasRegisterProc Value="True"/>
<UnitName Value="HeapTrcView"/>
</Item3>
<Item4>
</Item2>
<Item3>
<Filename Value="leakinfo.pas"/>
</Item4>
<UnitName Value="leakinfo"/>
</Item3>
</Files>
<i18n>
<EnableI18N Value="True"/>
<OutDir Value="languages"/>
</i18n>
<Type Value="RunAndDesignTime"/>
<RequiredPkgs Count="3">
<Item1>