mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-05-07 15:52:34 +02:00
updates to test/dwarfviewer (show line info)
git-svn-id: trunk@58202 -
This commit is contained in:
parent
3f6fa7cb90
commit
f5d955dd72
@ -1,14 +1,14 @@
|
|||||||
object Form1: TForm1
|
object Form1: TForm1
|
||||||
Left = 589
|
Left = 432
|
||||||
Height = 442
|
Height = 440
|
||||||
Top = 267
|
Top = 211
|
||||||
Width = 619
|
Width = 643
|
||||||
Caption = 'test fp'
|
Caption = 'test fp'
|
||||||
ClientHeight = 442
|
ClientHeight = 440
|
||||||
ClientWidth = 619
|
ClientWidth = 643
|
||||||
OnCreate = FormCreate
|
OnCreate = FormCreate
|
||||||
OnDestroy = FormDestroy
|
OnDestroy = FormDestroy
|
||||||
LCLVersion = '1.3'
|
LCLVersion = '1.9.0.0'
|
||||||
object FileNameEdit1: TFileNameEdit
|
object FileNameEdit1: TFileNameEdit
|
||||||
AnchorSideLeft.Control = Owner
|
AnchorSideLeft.Control = Owner
|
||||||
AnchorSideTop.Control = Owner
|
AnchorSideTop.Control = Owner
|
||||||
@ -16,7 +16,7 @@ object Form1: TForm1
|
|||||||
Left = 3
|
Left = 3
|
||||||
Height = 23
|
Height = 23
|
||||||
Top = 3
|
Top = 3
|
||||||
Width = 500
|
Width = 524
|
||||||
FilterIndex = 0
|
FilterIndex = 0
|
||||||
HideDirectories = False
|
HideDirectories = False
|
||||||
ButtonWidth = 23
|
ButtonWidth = 23
|
||||||
@ -33,7 +33,7 @@ object Form1: TForm1
|
|||||||
AnchorSideTop.Side = asrCenter
|
AnchorSideTop.Side = asrCenter
|
||||||
AnchorSideRight.Control = Owner
|
AnchorSideRight.Control = Owner
|
||||||
AnchorSideRight.Side = asrBottom
|
AnchorSideRight.Side = asrBottom
|
||||||
Left = 541
|
Left = 565
|
||||||
Height = 25
|
Height = 25
|
||||||
Top = 2
|
Top = 2
|
||||||
Width = 75
|
Width = 75
|
||||||
@ -47,13 +47,12 @@ object Form1: TForm1
|
|||||||
end
|
end
|
||||||
object CompUnitListBox: TListBox
|
object CompUnitListBox: TListBox
|
||||||
AnchorSideLeft.Control = Owner
|
AnchorSideLeft.Control = Owner
|
||||||
AnchorSideTop.Control = btnShowUnit
|
AnchorSideTop.Control = btnLines
|
||||||
AnchorSideTop.Side = asrBottom
|
AnchorSideTop.Side = asrBottom
|
||||||
AnchorSideBottom.Control = Owner
|
AnchorSideBottom.Control = StatusBar1
|
||||||
AnchorSideBottom.Side = asrBottom
|
|
||||||
Left = 3
|
Left = 3
|
||||||
Height = 375
|
Height = 322
|
||||||
Top = 64
|
Top = 92
|
||||||
Width = 244
|
Width = 244
|
||||||
Anchors = [akTop, akLeft, akBottom]
|
Anchors = [akTop, akLeft, akBottom]
|
||||||
BorderSpacing.Top = 3
|
BorderSpacing.Top = 3
|
||||||
@ -71,7 +70,7 @@ object Form1: TForm1
|
|||||||
Top = 33
|
Top = 33
|
||||||
Width = 79
|
Width = 79
|
||||||
BorderSpacing.Around = 3
|
BorderSpacing.Around = 3
|
||||||
Caption = 'Show unit'
|
Caption = 'Show Symbols'
|
||||||
OnClick = btnShowUnitClick
|
OnClick = btnShowUnitClick
|
||||||
TabOrder = 3
|
TabOrder = 3
|
||||||
end
|
end
|
||||||
@ -80,48 +79,67 @@ object Form1: TForm1
|
|||||||
AnchorSideLeft.Side = asrBottom
|
AnchorSideLeft.Side = asrBottom
|
||||||
AnchorSideTop.Control = btnShowUnit
|
AnchorSideTop.Control = btnShowUnit
|
||||||
AnchorSideTop.Side = asrCenter
|
AnchorSideTop.Side = asrCenter
|
||||||
Left = 94
|
AnchorSideRight.Control = CompUnitListBox
|
||||||
|
AnchorSideRight.Side = asrBottom
|
||||||
|
Left = 166
|
||||||
Height = 25
|
Height = 25
|
||||||
Top = 33
|
Top = 33
|
||||||
Width = 75
|
Width = 75
|
||||||
|
Anchors = [akTop, akRight]
|
||||||
BorderSpacing.Left = 6
|
BorderSpacing.Left = 6
|
||||||
BorderSpacing.Around = 6
|
BorderSpacing.Around = 6
|
||||||
Caption = 'Copy'
|
Caption = 'Copy'
|
||||||
OnClick = btnCopyOneClick
|
OnClick = btnCopyOneClick
|
||||||
TabOrder = 4
|
TabOrder = 4
|
||||||
end
|
end
|
||||||
object TreeView1: TTreeView
|
|
||||||
AnchorSideLeft.Control = CompUnitListBox
|
|
||||||
AnchorSideLeft.Side = asrBottom
|
|
||||||
AnchorSideTop.Control = btnLoad
|
|
||||||
AnchorSideTop.Side = asrBottom
|
|
||||||
AnchorSideRight.Control = Owner
|
|
||||||
AnchorSideRight.Side = asrBottom
|
|
||||||
AnchorSideBottom.Control = Owner
|
|
||||||
AnchorSideBottom.Side = asrBottom
|
|
||||||
Left = 253
|
|
||||||
Height = 406
|
|
||||||
Top = 33
|
|
||||||
Width = 363
|
|
||||||
Anchors = [akTop, akLeft, akRight, akBottom]
|
|
||||||
BorderSpacing.Left = 3
|
|
||||||
BorderSpacing.Top = 3
|
|
||||||
BorderSpacing.Around = 3
|
|
||||||
DefaultItemHeight = 18
|
|
||||||
TabOrder = 5
|
|
||||||
end
|
|
||||||
object btnCopyAll: TButton
|
object btnCopyAll: TButton
|
||||||
AnchorSideLeft.Control = btnCopyOne
|
AnchorSideLeft.Control = btnCopyOne
|
||||||
AnchorSideLeft.Side = asrBottom
|
AnchorSideLeft.Side = asrBottom
|
||||||
AnchorSideTop.Control = btnShowUnit
|
AnchorSideTop.Control = btnCopyOne
|
||||||
AnchorSideTop.Side = asrCenter
|
AnchorSideTop.Side = asrBottom
|
||||||
Left = 175
|
AnchorSideRight.Control = CompUnitListBox
|
||||||
|
AnchorSideRight.Side = asrBottom
|
||||||
|
Left = 166
|
||||||
Height = 25
|
Height = 25
|
||||||
Top = 33
|
Top = 64
|
||||||
Width = 75
|
Width = 75
|
||||||
|
Anchors = [akTop, akRight]
|
||||||
BorderSpacing.Around = 6
|
BorderSpacing.Around = 6
|
||||||
Caption = 'Copy Incl'
|
Caption = 'Copy Incl'
|
||||||
OnClick = btnCopyAllClick
|
OnClick = btnCopyAllClick
|
||||||
TabOrder = 6
|
TabOrder = 5
|
||||||
|
end
|
||||||
|
object StatusBar1: TStatusBar
|
||||||
|
Left = 0
|
||||||
|
Height = 23
|
||||||
|
Top = 417
|
||||||
|
Width = 643
|
||||||
|
Panels = <>
|
||||||
|
end
|
||||||
|
object TreeView1: TTreeView
|
||||||
|
AnchorSideLeft.Control = CompUnitListBox
|
||||||
|
AnchorSideLeft.Side = asrBottom
|
||||||
|
AnchorSideRight.Control = Owner
|
||||||
|
AnchorSideRight.Side = asrBottom
|
||||||
|
AnchorSideBottom.Control = StatusBar1
|
||||||
|
Left = 253
|
||||||
|
Height = 384
|
||||||
|
Top = 33
|
||||||
|
Width = 390
|
||||||
|
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||||
|
TabOrder = 7
|
||||||
|
end
|
||||||
|
object btnLines: TButton
|
||||||
|
AnchorSideLeft.Control = Owner
|
||||||
|
AnchorSideTop.Control = btnShowUnit
|
||||||
|
AnchorSideTop.Side = asrBottom
|
||||||
|
Left = 3
|
||||||
|
Height = 25
|
||||||
|
Top = 61
|
||||||
|
Width = 75
|
||||||
|
BorderSpacing.Around = 3
|
||||||
|
Caption = 'Show Lines'
|
||||||
|
OnClick = btnLinesClick
|
||||||
|
TabOrder = 8
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -19,13 +19,16 @@ type
|
|||||||
btnLoad: TButton;
|
btnLoad: TButton;
|
||||||
btnShowUnit: TButton;
|
btnShowUnit: TButton;
|
||||||
btnCopyOne: TButton;
|
btnCopyOne: TButton;
|
||||||
|
btnLines: TButton;
|
||||||
FileNameEdit1: TFileNameEdit;
|
FileNameEdit1: TFileNameEdit;
|
||||||
CompUnitListBox: TListBox;
|
CompUnitListBox: TListBox;
|
||||||
|
StatusBar1: TStatusBar;
|
||||||
TreeView1: TTreeView;
|
TreeView1: TTreeView;
|
||||||
procedure btnCopyAllClick(Sender: TObject);
|
procedure btnCopyAllClick(Sender: TObject);
|
||||||
procedure btnCopyOneClick(Sender: TObject);
|
procedure btnCopyOneClick(Sender: TObject);
|
||||||
procedure btnLoadClick(Sender: TObject);
|
procedure btnLoadClick(Sender: TObject);
|
||||||
procedure btnShowUnitClick(Sender: TObject);
|
procedure btnShowUnitClick(Sender: TObject);
|
||||||
|
procedure btnLinesClick(Sender: TObject);
|
||||||
procedure FormCreate(Sender: TObject);
|
procedure FormCreate(Sender: TObject);
|
||||||
procedure FormDestroy(Sender: TObject);
|
procedure FormDestroy(Sender: TObject);
|
||||||
private
|
private
|
||||||
@ -33,9 +36,10 @@ type
|
|||||||
NameList: TStringList;
|
NameList: TStringList;
|
||||||
FFileName: String;
|
FFileName: String;
|
||||||
FTestCaseTexts: TStringList;
|
FTestCaseTexts: TStringList;
|
||||||
FImageLoader: TDbgImageLoader;
|
FImageLoaderList: TDbgImageLoaderList;
|
||||||
FDwarfInfo: TDbgDwarf;
|
FDwarfInfo: TFpDwarfInfo;
|
||||||
FCUCount : Integer;
|
FCUCount : Integer;
|
||||||
|
FShowingUnit: Boolean;
|
||||||
public
|
public
|
||||||
{ public declarations }
|
{ public declarations }
|
||||||
procedure LoadDwarf;
|
procedure LoadDwarf;
|
||||||
@ -49,12 +53,21 @@ implementation
|
|||||||
|
|
||||||
{$R *.lfm}
|
{$R *.lfm}
|
||||||
|
|
||||||
|
type
|
||||||
|
TDwarfCompilationUnitHack = class(TDwarfCompilationUnit)
|
||||||
|
public
|
||||||
|
property FirstScope;
|
||||||
|
property AbbrevList;
|
||||||
|
end;
|
||||||
|
|
||||||
{ TForm1 }
|
{ TForm1 }
|
||||||
|
|
||||||
procedure TForm1.btnLoadClick(Sender: TObject);
|
procedure TForm1.btnLoadClick(Sender: TObject);
|
||||||
var
|
var
|
||||||
i: Integer;
|
i: Integer;
|
||||||
begin
|
begin
|
||||||
|
if FileNameEdit1.FileName = '' then
|
||||||
|
FileNameEdit1.RunDialog;
|
||||||
FFileName := FileNameEdit1.FileName;
|
FFileName := FileNameEdit1.FileName;
|
||||||
LoadDwarf;
|
LoadDwarf;
|
||||||
|
|
||||||
@ -81,6 +94,48 @@ debugln(['TForm1.MenuItem1Click ']);
|
|||||||
Clipboard.AsText := FTestCaseTexts[i];
|
Clipboard.AsText := FTestCaseTexts[i];
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TForm1.btnLinesClick(Sender: TObject);
|
||||||
|
const
|
||||||
|
B: Array [Boolean] of string = ('F', 'T');
|
||||||
|
var
|
||||||
|
i: Integer;
|
||||||
|
Node, ParentNode: TTreeNode;
|
||||||
|
CU: TDwarfCompilationUnitHack;
|
||||||
|
SM: TDwarfLineInfoStateMachine;
|
||||||
|
begin
|
||||||
|
TreeView1.BeginUpdate;
|
||||||
|
try
|
||||||
|
TreeView1.Items.Clear;
|
||||||
|
i := CompUnitListBox.ItemIndex;
|
||||||
|
if i < 0 then exit;
|
||||||
|
CU := TDwarfCompilationUnitHack(CompUnitListBox.Items.Objects[i]);
|
||||||
|
if CU = nil then exit;
|
||||||
|
|
||||||
|
SM := CU.FLineInfo.StateMachine;
|
||||||
|
SM.Reset;
|
||||||
|
ParentNode := nil;
|
||||||
|
|
||||||
|
while SM.NextLine do
|
||||||
|
begin
|
||||||
|
|
||||||
|
Node := TreeView1.Items.AddChild(ParentNode,
|
||||||
|
Format('Line: %2d, Col: %2d, Addr: %s, IsStmt: %s, Basic: %s, EndSeq: %s, Prol: %s, Epil: %s, ISA: %u, File: %s // Ended: %s',
|
||||||
|
[SM.Line, SM.Column, IntToHex(SM.Address,16), b[SM.IsStmt], b[SM.BasicBlock],
|
||||||
|
b[SM.EndSequence], b[SM.PrologueEnd], b[SM.EpilogueBegin], SM.Isa, sm.FileName, b[SM.Ended] ]));
|
||||||
|
|
||||||
|
if ParentNode = nil then ParentNode := Node;
|
||||||
|
if SM.EndSequence then begin
|
||||||
|
ParentNode := nil;
|
||||||
|
if not SM.NextLine then break;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
finally
|
||||||
|
TreeView1.EndUpdate;
|
||||||
|
end;
|
||||||
|
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TForm1.btnCopyAllClick(Sender: TObject);
|
procedure TForm1.btnCopyAllClick(Sender: TObject);
|
||||||
var
|
var
|
||||||
nm: TStringList;
|
nm: TStringList;
|
||||||
@ -139,28 +194,24 @@ debugln(['TForm1.MenuItem1Click ']);
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TForm1.LoadDwarf;
|
procedure TForm1.LoadDwarf;
|
||||||
|
var
|
||||||
|
ImageLoader: TDbgImageLoader;
|
||||||
begin
|
begin
|
||||||
UnLoadDwarf;
|
UnLoadDwarf;
|
||||||
FImageLoader := TDbgImageLoader.Create(FFileName);
|
ImageLoader := TDbgImageLoader.Create(FFileName);
|
||||||
FDwarfInfo := TDbgDwarf.Create(FImageLoader);
|
FImageLoaderList := TDbgImageLoaderList.Create(True);
|
||||||
|
FImageLoaderList.Add(ImageLoader);
|
||||||
|
FDwarfInfo := TFpDwarfInfo.Create(FImageLoaderList);
|
||||||
FCUCount := FDwarfInfo.LoadCompilationUnits;
|
FCUCount := FDwarfInfo.LoadCompilationUnits;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
type
|
|
||||||
TDwarfCompilationUnitHack = class(TDwarfCompilationUnit)
|
|
||||||
public
|
|
||||||
property FirstScope;
|
|
||||||
property AbbrevList;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TForm1.btnShowUnitClick(Sender: TObject);
|
procedure TForm1.btnShowUnitClick(Sender: TObject);
|
||||||
var
|
var
|
||||||
CU: TDwarfCompilationUnitHack;
|
CU: TDwarfCompilationUnitHack;
|
||||||
BaseScopeAddr: Pointer;
|
BaseScopeAddr: Pointer;
|
||||||
|
|
||||||
function ToHex(var p: pbyte; l : integer):String;
|
function ToHex(var p: pbyte; l : integer):String; inline;
|
||||||
begin
|
begin
|
||||||
Result := '';
|
Result := '';
|
||||||
while l > 0 do begin
|
while l > 0 do begin
|
||||||
@ -427,7 +478,7 @@ var
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
function AddAbbrev(AParent: TTreeNode; s: TDwarfScopeInfo; Def: TDwarfAbbrev;
|
function AddAbbrev(AParent: TTreeNode; s: TDwarfScopeInfo; Def: TDwarfAbbrev;
|
||||||
var PascalTestCAseCode: String): String;
|
var PascalTestCAseCode: String; namePreFix: String = ''): String;
|
||||||
var
|
var
|
||||||
p: Pointer;
|
p: Pointer;
|
||||||
Form: Cardinal;
|
Form: Cardinal;
|
||||||
@ -455,7 +506,7 @@ var
|
|||||||
DW_FORM_addr : begin
|
DW_FORM_addr : begin
|
||||||
s3 := ToHex(p, 4 {FCU.FAddressSize});
|
s3 := ToHex(p, 4 {FCU.FAddressSize});
|
||||||
PascalTestCAseCode := PascalTestCAseCode +
|
PascalTestCAseCode := PascalTestCAseCode +
|
||||||
Format('XX_X_CurInfo992X.AddAddr(%s, %s, $%s);%s', [s1, s2, s3, LineEnding]);
|
Format(namePreFix+'AddAddr(%s, %s, $%s);%s', [s1, s2, s3, LineEnding]);
|
||||||
end;
|
end;
|
||||||
DW_FORM_block : begin
|
DW_FORM_block : begin
|
||||||
p2 := p;
|
p2 := p;
|
||||||
@ -465,10 +516,10 @@ var
|
|||||||
s3 := IntToStr(ValueSize) + ': ' + ToHex(p, ValueSize);
|
s3 := IntToStr(ValueSize) + ': ' + ToHex(p, ValueSize);
|
||||||
if (Attribute = DW_AT_location) or (Attribute = DW_AT_data_member_location) then
|
if (Attribute = DW_AT_location) or (Attribute = DW_AT_data_member_location) then
|
||||||
PascalTestCAseCode := PascalTestCAseCode +
|
PascalTestCAseCode := PascalTestCAseCode +
|
||||||
Format('XX_X_CurInfo992X.Add(%s, %s, BytesLenU([%s])); // %s%s', [s1, s2, DecodeLocation(p2, ValueSize), stest, LineEnding])
|
Format(namePreFix+'Add(%s, %s, BytesLenU([%s])); // %s%s', [s1, s2, DecodeLocation(p2, ValueSize), stest, LineEnding])
|
||||||
else
|
else
|
||||||
PascalTestCAseCode := PascalTestCAseCode +
|
PascalTestCAseCode := PascalTestCAseCode +
|
||||||
Format('XX_X_CurInfo992X.Add(%s, %s, BytesLenU([%s]));%s', [s1, s2, stest, LineEnding]);
|
Format(namePreFix+'Add(%s, %s, BytesLenU([%s]));%s', [s1, s2, stest, LineEnding]);
|
||||||
end;
|
end;
|
||||||
DW_FORM_block1 : begin
|
DW_FORM_block1 : begin
|
||||||
ValueSize := PByte(p)^;
|
ValueSize := PByte(p)^;
|
||||||
@ -478,10 +529,10 @@ var
|
|||||||
s3 := IntToStr(ValueSize) + ': ' + ToHex(p, ValueSize);
|
s3 := IntToStr(ValueSize) + ': ' + ToHex(p, ValueSize);
|
||||||
if (Attribute = DW_AT_location) or (Attribute = DW_AT_data_member_location) then
|
if (Attribute = DW_AT_location) or (Attribute = DW_AT_data_member_location) then
|
||||||
PascalTestCAseCode := PascalTestCAseCode +
|
PascalTestCAseCode := PascalTestCAseCode +
|
||||||
Format('XX_X_CurInfo992X.Add(%s, %s, BytesLen1([%s])); // %s%s', [s1, s2, DecodeLocation(p2, ValueSize), stest, LineEnding])
|
Format(namePreFix+'Add(%s, %s, BytesLen1([%s])); // %s%s', [s1, s2, DecodeLocation(p2, ValueSize), stest, LineEnding])
|
||||||
else
|
else
|
||||||
PascalTestCAseCode := PascalTestCAseCode +
|
PascalTestCAseCode := PascalTestCAseCode +
|
||||||
Format('XX_X_CurInfo992X.Add(%s, %s, BytesLen1([%s]));%s', [s1, s2, stest, LineEnding]);
|
Format(namePreFix+'Add(%s, %s, BytesLen1([%s]));%s', [s1, s2, stest, LineEnding]);
|
||||||
end;
|
end;
|
||||||
DW_FORM_block2 : begin
|
DW_FORM_block2 : begin
|
||||||
ValueSize := PWord(p)^;
|
ValueSize := PWord(p)^;
|
||||||
@ -491,10 +542,10 @@ var
|
|||||||
s3 := IntToStr(ValueSize) + ': ' + ToHex(p, ValueSize);
|
s3 := IntToStr(ValueSize) + ': ' + ToHex(p, ValueSize);
|
||||||
if (Attribute = DW_AT_location) or (Attribute = DW_AT_data_member_location) then
|
if (Attribute = DW_AT_location) or (Attribute = DW_AT_data_member_location) then
|
||||||
PascalTestCAseCode := PascalTestCAseCode +
|
PascalTestCAseCode := PascalTestCAseCode +
|
||||||
Format('XX_X_CurInfo992X.Add(%s, %s, BytesLen2([%s])); // %s%s', [s1, s2, DecodeLocation(p2, ValueSize), stest, LineEnding])
|
Format(namePreFix+'Add(%s, %s, BytesLen2([%s])); // %s%s', [s1, s2, DecodeLocation(p2, ValueSize), stest, LineEnding])
|
||||||
else
|
else
|
||||||
PascalTestCAseCode := PascalTestCAseCode +
|
PascalTestCAseCode := PascalTestCAseCode +
|
||||||
Format('XX_X_CurInfo992X.Add(%s, %s, BytesLen2([%s]));%s', [s1, s2, stest, LineEnding]);
|
Format(namePreFix+'Add(%s, %s, BytesLen2([%s]));%s', [s1, s2, stest, LineEnding]);
|
||||||
end;
|
end;
|
||||||
DW_FORM_block4 : begin
|
DW_FORM_block4 : begin
|
||||||
ValueSize := PLongWord(p)^;
|
ValueSize := PLongWord(p)^;
|
||||||
@ -504,93 +555,93 @@ var
|
|||||||
s3 := IntToStr(ValueSize) + ': ' + ToHex(p, ValueSize);
|
s3 := IntToStr(ValueSize) + ': ' + ToHex(p, ValueSize);
|
||||||
if (Attribute = DW_AT_location) or (Attribute = DW_AT_data_member_location) then
|
if (Attribute = DW_AT_location) or (Attribute = DW_AT_data_member_location) then
|
||||||
PascalTestCAseCode := PascalTestCAseCode +
|
PascalTestCAseCode := PascalTestCAseCode +
|
||||||
Format('XX_X_CurInfo992X.Add(%s, %s, BytesLen4([%s])); // %s%s', [s1, s2, DecodeLocation(p2, ValueSize), stest, LineEnding])
|
Format(namePreFix+'Add(%s, %s, BytesLen4([%s])); // %s%s', [s1, s2, DecodeLocation(p2, ValueSize), stest, LineEnding])
|
||||||
else
|
else
|
||||||
PascalTestCAseCode := PascalTestCAseCode +
|
PascalTestCAseCode := PascalTestCAseCode +
|
||||||
Format('XX_X_CurInfo992X.Add(%s, %s, BytesLen4([%s]));%s', [s1, s2, stest, LineEnding]);
|
Format(namePreFix+'Add(%s, %s, BytesLen4([%s]));%s', [s1, s2, stest, LineEnding]);
|
||||||
end;
|
end;
|
||||||
DW_FORM_data1 : begin
|
DW_FORM_data1 : begin
|
||||||
stest := ToHexCommaList(p,1);
|
stest := ToHexCommaList(p,1);
|
||||||
s3 := ToHex(p, 1);
|
s3 := ToHex(p, 1);
|
||||||
PascalTestCAseCode := PascalTestCAseCode +
|
PascalTestCAseCode := PascalTestCAseCode +
|
||||||
Format('XX_X_CurInfo992X.Add(%s, %s, [%s]);%s', [s1, s2, stest, LineEnding]);
|
Format(namePreFix+'Add(%s, %s, [%s]);%s', [s1, s2, stest, LineEnding]);
|
||||||
end;
|
end;
|
||||||
DW_FORM_data2 : begin
|
DW_FORM_data2 : begin
|
||||||
stest := ToHexCommaList(p,2);
|
stest := ToHexCommaList(p,2);
|
||||||
s3 := ToHex(p, 2);
|
s3 := ToHex(p, 2);
|
||||||
PascalTestCAseCode := PascalTestCAseCode +
|
PascalTestCAseCode := PascalTestCAseCode +
|
||||||
Format('XX_X_CurInfo992X.Add(%s, %s, [%s]);%s', [s1, s2, stest, LineEnding]);
|
Format(namePreFix+'Add(%s, %s, [%s]);%s', [s1, s2, stest, LineEnding]);
|
||||||
end;
|
end;
|
||||||
DW_FORM_data4 : begin
|
DW_FORM_data4 : begin
|
||||||
stest := ToHexCommaList(p,4);
|
stest := ToHexCommaList(p,4);
|
||||||
s3 := ToHex(p, 4);
|
s3 := ToHex(p, 4);
|
||||||
PascalTestCAseCode := PascalTestCAseCode +
|
PascalTestCAseCode := PascalTestCAseCode +
|
||||||
Format('XX_X_CurInfo992X.Add(%s, %s, [%s]);%s', [s1, s2, stest, LineEnding]);
|
Format(namePreFix+'Add(%s, %s, [%s]);%s', [s1, s2, stest, LineEnding]);
|
||||||
end;
|
end;
|
||||||
DW_FORM_data8 : begin
|
DW_FORM_data8 : begin
|
||||||
stest := ToHexCommaList(p,8);
|
stest := ToHexCommaList(p,8);
|
||||||
s3 := ToHex(p, 8);
|
s3 := ToHex(p, 8);
|
||||||
PascalTestCAseCode := PascalTestCAseCode +
|
PascalTestCAseCode := PascalTestCAseCode +
|
||||||
Format('XX_X_CurInfo992X.Add(%s, %s, [%s]);%s', [s1, s2, stest, LineEnding]);
|
Format(namePreFix+'Add(%s, %s, [%s]);%s', [s1, s2, stest, LineEnding]);
|
||||||
end;
|
end;
|
||||||
DW_FORM_sdata : begin
|
DW_FORM_sdata : begin
|
||||||
SValue := SLEB128toOrdinal(p);
|
SValue := SLEB128toOrdinal(p);
|
||||||
s3 := IntToStr(SValue);
|
s3 := IntToStr(SValue);
|
||||||
PascalTestCAseCode := PascalTestCAseCode +
|
PascalTestCAseCode := PascalTestCAseCode +
|
||||||
Format('XX_X_CurInfo992X.AddSLEB(%s, %s, %d);%s', [s1, s2, SValue, LineEnding]);
|
Format(namePreFix+'AddSLEB(%s, %s, %d);%s', [s1, s2, SValue, LineEnding]);
|
||||||
end;
|
end;
|
||||||
DW_FORM_udata : begin
|
DW_FORM_udata : begin
|
||||||
Value := ULEB128toOrdinal(p);
|
Value := ULEB128toOrdinal(p);
|
||||||
s3 := IntToStr(Value);
|
s3 := IntToStr(Value);
|
||||||
PascalTestCAseCode := PascalTestCAseCode +
|
PascalTestCAseCode := PascalTestCAseCode +
|
||||||
Format('XX_X_CurInfo992X.AddULEB(%s, %s, %u);%s', [s1, s2, Value, LineEnding]);
|
Format(namePreFix+'AddULEB(%s, %s, %u);%s', [s1, s2, Value, LineEnding]);
|
||||||
end;
|
end;
|
||||||
DW_FORM_flag : begin
|
DW_FORM_flag : begin
|
||||||
stest := ToHexCommaList(p,1);
|
stest := ToHexCommaList(p,1);
|
||||||
s3 := ToHex(p, 1);
|
s3 := ToHex(p, 1);
|
||||||
PascalTestCAseCode := PascalTestCAseCode +
|
PascalTestCAseCode := PascalTestCAseCode +
|
||||||
Format('XX_X_CurInfo992X.Add(%s, %s, [%s]);%s', [s1, s2, stest, LineEnding]);
|
Format(namePreFix+'Add(%s, %s, [%s]);%s', [s1, s2, stest, LineEnding]);
|
||||||
end;
|
end;
|
||||||
DW_FORM_ref1 : begin
|
DW_FORM_ref1 : begin
|
||||||
stest := ToHexCommaList(p,1);
|
stest := ToHexCommaList(p,1);
|
||||||
s3 := ToHex(p, 1);
|
s3 := ToHex(p, 1);
|
||||||
PascalTestCAseCode := PascalTestCAseCode +
|
PascalTestCAseCode := PascalTestCAseCode +
|
||||||
Format('XX_X_CurInfo992X.AddRef(%s, %s, @Info__%s_); // %s %s', [s1, s2, IntToStr(PByte(p-1)^), stest, LineEnding]);
|
Format(namePreFix+'AddRef(%s, %s, @Info__%s_); // %s %s', [s1, s2, IntToStr(PByte(p-1)^), stest, LineEnding]);
|
||||||
//Format('XX_X_CurInfo992X.AddRef(%s, %s, FOO); // %s %s', [s1, s2, stest, LineEnding]);
|
//Format(namePreFix+'AddRef(%s, %s, FOO); // %s %s', [s1, s2, stest, LineEnding]);
|
||||||
end;
|
end;
|
||||||
DW_FORM_ref2 : begin
|
DW_FORM_ref2 : begin
|
||||||
stest := ToHexCommaList(p,3);
|
stest := ToHexCommaList(p,3);
|
||||||
s3 := ToHex(p, 2);
|
s3 := ToHex(p, 2);
|
||||||
PascalTestCAseCode := PascalTestCAseCode +
|
PascalTestCAseCode := PascalTestCAseCode +
|
||||||
Format('XX_X_CurInfo992X.AddRef(%s, %s, @Info__%s_); // %s %s', [s1, s2, IntToStr(PWord(p-2)^), stest, LineEnding]);
|
Format(namePreFix+'AddRef(%s, %s, @Info__%s_); // %s %s', [s1, s2, IntToStr(PWord(p-2)^), stest, LineEnding]);
|
||||||
//Format('XX_X_CurInfo992X.AddRef(%s, %s, FOO); // %s %s', [s1, s2, stest, LineEnding]);
|
//Format(namePreFix+'AddRef(%s, %s, FOO); // %s %s', [s1, s2, stest, LineEnding]);
|
||||||
end;
|
end;
|
||||||
DW_FORM_ref4 : begin
|
DW_FORM_ref4 : begin
|
||||||
stest := ToHexCommaList(p,4);
|
stest := ToHexCommaList(p,4);
|
||||||
s4 := IntToHex(PInteger(p)^ -11, 8);;
|
s4 := IntToHex(PInteger(p)^ -11, 8);;
|
||||||
s3 := ToHex(p, 4) + ' // '+ s4;
|
s3 := ToHex(p, 4) + ' // '+ s4;
|
||||||
PascalTestCAseCode := PascalTestCAseCode +
|
PascalTestCAseCode := PascalTestCAseCode +
|
||||||
Format('XX_X_CurInfo992X.AddRef(%s, %s, @Info__%s_); // %s %s', [s1, s2, IntToStr(PDWord(p-4)^), stest, LineEnding]);
|
Format(namePreFix+'AddRef(%s, %s, @Info__%s_); // %s %s', [s1, s2, IntToStr(PDWord(p-4)^), stest, LineEnding]);
|
||||||
//Format('XX_X_CurInfo992X.AddRef(%s, %s, FOO); // %s %s', [s1, s2, stest, LineEnding]);
|
//Format(namePreFix+'AddRef(%s, %s, FOO); // %s %s', [s1, s2, stest, LineEnding]);
|
||||||
end;
|
end;
|
||||||
DW_FORM_ref8 : begin
|
DW_FORM_ref8 : begin
|
||||||
stest := ToHexCommaList(p,8);
|
stest := ToHexCommaList(p,8);
|
||||||
s3 := ToHex(p, 8);
|
s3 := ToHex(p, 8);
|
||||||
PascalTestCAseCode := PascalTestCAseCode +
|
PascalTestCAseCode := PascalTestCAseCode +
|
||||||
Format('XX_X_CurInfo992X.AddRef(%s, %s, @Info__%s_); // %s %s', [s1, s2, IntToStr(PQWord(p-8)^), stest, LineEnding]);
|
Format(namePreFix+'AddRef(%s, %s, @Info__%s_); // %s %s', [s1, s2, IntToStr(PQWord(p-8)^), stest, LineEnding]);
|
||||||
//Format('XX_X_CurInfo992X.AddRef(%s, %s, FOO); // %s %s', [s1, s2, stest, LineEnding]);
|
//Format(namePreFix+'AddRef(%s, %s, FOO); // %s %s', [s1, s2, stest, LineEnding]);
|
||||||
end;
|
end;
|
||||||
DW_FORM_ref_udata: begin
|
DW_FORM_ref_udata: begin
|
||||||
Value := ULEB128toOrdinal(p);
|
Value := ULEB128toOrdinal(p);
|
||||||
s3 := IntToStr(Value);
|
s3 := IntToStr(Value);
|
||||||
PascalTestCAseCode := PascalTestCAseCode +
|
PascalTestCAseCode := PascalTestCAseCode +
|
||||||
Format('XX_X_CurInfo992X.AddRef(%s, %s, FOO); // %u // ULEB %s', [s1, s2, Value, LineEnding]);
|
Format(namePreFix+'AddRef(%s, %s, FOO); // %u // ULEB %s', [s1, s2, Value, LineEnding]);
|
||||||
end;
|
end;
|
||||||
DW_FORM_ref_addr : begin
|
DW_FORM_ref_addr : begin
|
||||||
stest := ToHexCommaList(p,4);
|
stest := ToHexCommaList(p,4);
|
||||||
s3 := ToHex(p, 4 {FCU.FAddressSize});
|
s3 := ToHex(p, 4 {FCU.FAddressSize});
|
||||||
PascalTestCAseCode := PascalTestCAseCode +
|
PascalTestCAseCode := PascalTestCAseCode +
|
||||||
Format('XX_X_CurInfo992X.AddRef(%s, %s, FOO); // %s // %s', [s1, s2, stest, LineEnding]);
|
Format(namePreFix+'AddRef(%s, %s, FOO); // %s // %s', [s1, s2, stest, LineEnding]);
|
||||||
end;
|
end;
|
||||||
DW_FORM_string : begin
|
DW_FORM_string : begin
|
||||||
s3 := copy(pchar(p),1,1000);
|
s3 := copy(pchar(p),1,1000);
|
||||||
@ -599,13 +650,13 @@ var
|
|||||||
end;
|
end;
|
||||||
inc(pbyte(p));
|
inc(pbyte(p));
|
||||||
PascalTestCAseCode := PascalTestCAseCode +
|
PascalTestCAseCode := PascalTestCAseCode +
|
||||||
Format('XX_X_CurInfo992X.Add(%s, %s, ''%s''+#0);%s', [s1, s2, s3, LineEnding]);
|
Format(namePreFix+'Add(%s, %s, ''%s''+#0);%s', [s1, s2, s3, LineEnding]);
|
||||||
end;
|
end;
|
||||||
DW_FORM_strp : begin
|
DW_FORM_strp : begin
|
||||||
stest := ToHexCommaList(p,4);
|
stest := ToHexCommaList(p,4);
|
||||||
s3 := ToHex(p, 4 {FCU.FAddressSize});
|
s3 := ToHex(p, 4 {FCU.FAddressSize});
|
||||||
PascalTestCAseCode := PascalTestCAseCode +
|
PascalTestCAseCode := PascalTestCAseCode +
|
||||||
Format('XX_X_CurInfo992X.Add(%s, %s, [%s]);%s', [s1, s2, stest, LineEnding]);
|
Format(namePreFix+'Add(%s, %s, [%s]);%s', [s1, s2, stest, LineEnding]);
|
||||||
end;
|
end;
|
||||||
DW_FORM_indirect : begin
|
DW_FORM_indirect : begin
|
||||||
Value := ULEB128toOrdinal(p);
|
Value := ULEB128toOrdinal(p);
|
||||||
@ -613,12 +664,12 @@ var
|
|||||||
//Form := ULEB128toOrdinal(p);
|
//Form := ULEB128toOrdinal(p);
|
||||||
//Continue;
|
//Continue;
|
||||||
PascalTestCAseCode := PascalTestCAseCode +
|
PascalTestCAseCode := PascalTestCAseCode +
|
||||||
Format('XX_X_CurInfo992X.AddULEB(%s, %s, %u);%s', [s1, s2, Value, LineEnding]);
|
Format(namePreFix+'AddULEB(%s, %s, %u);%s', [s1, s2, Value, LineEnding]);
|
||||||
end;
|
end;
|
||||||
else
|
else
|
||||||
s3 := '?????';
|
s3 := '?????';
|
||||||
PascalTestCAseCode := PascalTestCAseCode +
|
PascalTestCAseCode := PascalTestCAseCode +
|
||||||
Format('XX_X_CurInfo992X.Add(%s, %s, %s);%s', [s1, s2, '???????????', LineEnding]);
|
Format(namePreFix+'Add(%s, %s, %s);%s', [s1, s2, '???????????', LineEnding]);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
if Attribute = DW_AT_name then Result := s3;
|
if Attribute = DW_AT_name then Result := s3;
|
||||||
@ -645,7 +696,7 @@ var
|
|||||||
entryname: String;
|
entryname: String;
|
||||||
TestCaseText: String;
|
TestCaseText: String;
|
||||||
NMLIdx: Integer;
|
NMLIdx: Integer;
|
||||||
pre: String;
|
pre, sName: String;
|
||||||
begin
|
begin
|
||||||
p := s.Entry;
|
p := s.Entry;
|
||||||
Abbrev := ULEB128toOrdinal(p);
|
Abbrev := ULEB128toOrdinal(p);
|
||||||
@ -653,7 +704,8 @@ var
|
|||||||
CU.GetDefinition(p, Def);
|
CU.GetDefinition(p, Def);
|
||||||
Node := TreeView1.Items.AddChild(AParent, Format('Abr: %d Tag: %d %s ', [Abbrev, Def.tag, DwarfTagToString(Def.tag)]));
|
Node := TreeView1.Items.AddChild(AParent, Format('Abr: %d Tag: %d %s ', [Abbrev, Def.tag, DwarfTagToString(Def.tag)]));
|
||||||
|
|
||||||
entryname := AddAbbrev(Node, s, Def, TestCaseText);
|
sName := 'Info__'+IntToStr(s.Entry - BaseScopeAddr + 11)+'_.';
|
||||||
|
entryname := AddAbbrev(Node, s, Def, TestCaseText, sName);
|
||||||
|
|
||||||
pre := '';
|
pre := '';
|
||||||
Case def.tag of
|
Case def.tag of
|
||||||
@ -681,14 +733,10 @@ var
|
|||||||
i := 0;
|
i := 0;
|
||||||
if s.HasChild then i := 1;
|
if s.HasChild then i := 1;
|
||||||
TestCaseText :=
|
TestCaseText :=
|
||||||
Format('XX_X_CurInfo992X.Tag := %s;%s',
|
Format('%sTag := %s;%s',
|
||||||
[DwarfTagToString(Def.tag), LineEnding])
|
[sName, DwarfTagToString(Def.tag), LineEnding])
|
||||||
+ Format('XX_X_CurInfo992X.Children := %d;%s', [i, LineEnding])
|
+ Format('%sChildren := %d;%s', [sName, i, LineEnding])
|
||||||
+ TestCaseText;
|
+ TestCaseText;
|
||||||
TestCaseText := AnsiReplaceStr(TestCaseText, 'XX_X_CurInfo992X.',
|
|
||||||
'Info__'+IntToStr(s.Entry - BaseScopeAddr + 11)+'_.'
|
|
||||||
//'Info'+IntToStr(FTestCaseTexts.Count+1)+entryname+'.'
|
|
||||||
);
|
|
||||||
node.Data := pointer(ptruint(FTestCaseTexts.Add(TestCaseText)+1));
|
node.Data := pointer(ptruint(FTestCaseTexts.Add(TestCaseText)+1));
|
||||||
|
|
||||||
i := 0;
|
i := 0;
|
||||||
@ -699,6 +747,11 @@ var
|
|||||||
n := AddNode(Node,n,s2);
|
n := AddNode(Node,n,s2);
|
||||||
s2.GoNext;
|
s2.GoNext;
|
||||||
inc(i);
|
inc(i);
|
||||||
|
if (i and 31) = 0 then begin
|
||||||
|
StatusBar1.SimpleText := IntToHex(s2.Index,8) + ' / '+ IntToHex(CU.InfoDataLength,8);
|
||||||
|
Application.ProcessMessages;
|
||||||
|
if not FShowingUnit then break;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -711,6 +764,8 @@ var
|
|||||||
Node: TTreeNode;
|
Node: TTreeNode;
|
||||||
rs: TDwarfScopeInfo;
|
rs: TDwarfScopeInfo;
|
||||||
begin
|
begin
|
||||||
|
FShowingUnit := not FShowingUnit;//////////////////
|
||||||
|
if not FShowingUnit then exit;/////////////////
|
||||||
TreeView1.BeginUpdate;
|
TreeView1.BeginUpdate;
|
||||||
try
|
try
|
||||||
TreeView1.Items.Clear;
|
TreeView1.Items.Clear;
|
||||||
@ -729,6 +784,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
finally
|
finally
|
||||||
TreeView1.EndUpdate;
|
TreeView1.EndUpdate;
|
||||||
|
FShowingUnit := False; ////////////////////
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -748,7 +804,7 @@ end;
|
|||||||
procedure TForm1.UnLoadDwarf;
|
procedure TForm1.UnLoadDwarf;
|
||||||
begin
|
begin
|
||||||
FreeAndNil(FDwarfInfo);
|
FreeAndNil(FDwarfInfo);
|
||||||
FreeAndNil(FImageLoader);
|
FreeAndNil(FImageLoaderList);
|
||||||
FCUCount := 0;
|
FCUCount := 0;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user