mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-05-02 10:23:41 +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
|
||||
Left = 589
|
||||
Height = 442
|
||||
Top = 267
|
||||
Width = 619
|
||||
Left = 432
|
||||
Height = 440
|
||||
Top = 211
|
||||
Width = 643
|
||||
Caption = 'test fp'
|
||||
ClientHeight = 442
|
||||
ClientWidth = 619
|
||||
ClientHeight = 440
|
||||
ClientWidth = 643
|
||||
OnCreate = FormCreate
|
||||
OnDestroy = FormDestroy
|
||||
LCLVersion = '1.3'
|
||||
LCLVersion = '1.9.0.0'
|
||||
object FileNameEdit1: TFileNameEdit
|
||||
AnchorSideLeft.Control = Owner
|
||||
AnchorSideTop.Control = Owner
|
||||
@ -16,7 +16,7 @@ object Form1: TForm1
|
||||
Left = 3
|
||||
Height = 23
|
||||
Top = 3
|
||||
Width = 500
|
||||
Width = 524
|
||||
FilterIndex = 0
|
||||
HideDirectories = False
|
||||
ButtonWidth = 23
|
||||
@ -33,7 +33,7 @@ object Form1: TForm1
|
||||
AnchorSideTop.Side = asrCenter
|
||||
AnchorSideRight.Control = Owner
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 541
|
||||
Left = 565
|
||||
Height = 25
|
||||
Top = 2
|
||||
Width = 75
|
||||
@ -47,13 +47,12 @@ object Form1: TForm1
|
||||
end
|
||||
object CompUnitListBox: TListBox
|
||||
AnchorSideLeft.Control = Owner
|
||||
AnchorSideTop.Control = btnShowUnit
|
||||
AnchorSideTop.Control = btnLines
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideBottom.Control = Owner
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
AnchorSideBottom.Control = StatusBar1
|
||||
Left = 3
|
||||
Height = 375
|
||||
Top = 64
|
||||
Height = 322
|
||||
Top = 92
|
||||
Width = 244
|
||||
Anchors = [akTop, akLeft, akBottom]
|
||||
BorderSpacing.Top = 3
|
||||
@ -71,7 +70,7 @@ object Form1: TForm1
|
||||
Top = 33
|
||||
Width = 79
|
||||
BorderSpacing.Around = 3
|
||||
Caption = 'Show unit'
|
||||
Caption = 'Show Symbols'
|
||||
OnClick = btnShowUnitClick
|
||||
TabOrder = 3
|
||||
end
|
||||
@ -80,48 +79,67 @@ object Form1: TForm1
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = btnShowUnit
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 94
|
||||
AnchorSideRight.Control = CompUnitListBox
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 166
|
||||
Height = 25
|
||||
Top = 33
|
||||
Width = 75
|
||||
Anchors = [akTop, akRight]
|
||||
BorderSpacing.Left = 6
|
||||
BorderSpacing.Around = 6
|
||||
Caption = 'Copy'
|
||||
OnClick = btnCopyOneClick
|
||||
TabOrder = 4
|
||||
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
|
||||
AnchorSideLeft.Control = btnCopyOne
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = btnShowUnit
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 175
|
||||
AnchorSideTop.Control = btnCopyOne
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = CompUnitListBox
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 166
|
||||
Height = 25
|
||||
Top = 33
|
||||
Top = 64
|
||||
Width = 75
|
||||
Anchors = [akTop, akRight]
|
||||
BorderSpacing.Around = 6
|
||||
Caption = 'Copy Incl'
|
||||
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
|
||||
|
@ -19,13 +19,16 @@ type
|
||||
btnLoad: TButton;
|
||||
btnShowUnit: TButton;
|
||||
btnCopyOne: TButton;
|
||||
btnLines: TButton;
|
||||
FileNameEdit1: TFileNameEdit;
|
||||
CompUnitListBox: TListBox;
|
||||
StatusBar1: TStatusBar;
|
||||
TreeView1: TTreeView;
|
||||
procedure btnCopyAllClick(Sender: TObject);
|
||||
procedure btnCopyOneClick(Sender: TObject);
|
||||
procedure btnLoadClick(Sender: TObject);
|
||||
procedure btnShowUnitClick(Sender: TObject);
|
||||
procedure btnLinesClick(Sender: TObject);
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure FormDestroy(Sender: TObject);
|
||||
private
|
||||
@ -33,9 +36,10 @@ type
|
||||
NameList: TStringList;
|
||||
FFileName: String;
|
||||
FTestCaseTexts: TStringList;
|
||||
FImageLoader: TDbgImageLoader;
|
||||
FDwarfInfo: TDbgDwarf;
|
||||
FImageLoaderList: TDbgImageLoaderList;
|
||||
FDwarfInfo: TFpDwarfInfo;
|
||||
FCUCount : Integer;
|
||||
FShowingUnit: Boolean;
|
||||
public
|
||||
{ public declarations }
|
||||
procedure LoadDwarf;
|
||||
@ -49,12 +53,21 @@ implementation
|
||||
|
||||
{$R *.lfm}
|
||||
|
||||
type
|
||||
TDwarfCompilationUnitHack = class(TDwarfCompilationUnit)
|
||||
public
|
||||
property FirstScope;
|
||||
property AbbrevList;
|
||||
end;
|
||||
|
||||
{ TForm1 }
|
||||
|
||||
procedure TForm1.btnLoadClick(Sender: TObject);
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
if FileNameEdit1.FileName = '' then
|
||||
FileNameEdit1.RunDialog;
|
||||
FFileName := FileNameEdit1.FileName;
|
||||
LoadDwarf;
|
||||
|
||||
@ -81,6 +94,48 @@ debugln(['TForm1.MenuItem1Click ']);
|
||||
Clipboard.AsText := FTestCaseTexts[i];
|
||||
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);
|
||||
var
|
||||
nm: TStringList;
|
||||
@ -139,28 +194,24 @@ debugln(['TForm1.MenuItem1Click ']);
|
||||
end;
|
||||
|
||||
procedure TForm1.LoadDwarf;
|
||||
var
|
||||
ImageLoader: TDbgImageLoader;
|
||||
begin
|
||||
UnLoadDwarf;
|
||||
FImageLoader := TDbgImageLoader.Create(FFileName);
|
||||
FDwarfInfo := TDbgDwarf.Create(FImageLoader);
|
||||
ImageLoader := TDbgImageLoader.Create(FFileName);
|
||||
FImageLoaderList := TDbgImageLoaderList.Create(True);
|
||||
FImageLoaderList.Add(ImageLoader);
|
||||
FDwarfInfo := TFpDwarfInfo.Create(FImageLoaderList);
|
||||
FCUCount := FDwarfInfo.LoadCompilationUnits;
|
||||
end;
|
||||
|
||||
|
||||
|
||||
type
|
||||
TDwarfCompilationUnitHack = class(TDwarfCompilationUnit)
|
||||
public
|
||||
property FirstScope;
|
||||
property AbbrevList;
|
||||
end;
|
||||
|
||||
procedure TForm1.btnShowUnitClick(Sender: TObject);
|
||||
var
|
||||
CU: TDwarfCompilationUnitHack;
|
||||
BaseScopeAddr: Pointer;
|
||||
|
||||
function ToHex(var p: pbyte; l : integer):String;
|
||||
function ToHex(var p: pbyte; l : integer):String; inline;
|
||||
begin
|
||||
Result := '';
|
||||
while l > 0 do begin
|
||||
@ -427,7 +478,7 @@ var
|
||||
end;
|
||||
|
||||
function AddAbbrev(AParent: TTreeNode; s: TDwarfScopeInfo; Def: TDwarfAbbrev;
|
||||
var PascalTestCAseCode: String): String;
|
||||
var PascalTestCAseCode: String; namePreFix: String = ''): String;
|
||||
var
|
||||
p: Pointer;
|
||||
Form: Cardinal;
|
||||
@ -455,7 +506,7 @@ var
|
||||
DW_FORM_addr : begin
|
||||
s3 := ToHex(p, 4 {FCU.FAddressSize});
|
||||
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;
|
||||
DW_FORM_block : begin
|
||||
p2 := p;
|
||||
@ -465,10 +516,10 @@ var
|
||||
s3 := IntToStr(ValueSize) + ': ' + ToHex(p, ValueSize);
|
||||
if (Attribute = DW_AT_location) or (Attribute = DW_AT_data_member_location) then
|
||||
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
|
||||
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;
|
||||
DW_FORM_block1 : begin
|
||||
ValueSize := PByte(p)^;
|
||||
@ -478,10 +529,10 @@ var
|
||||
s3 := IntToStr(ValueSize) + ': ' + ToHex(p, ValueSize);
|
||||
if (Attribute = DW_AT_location) or (Attribute = DW_AT_data_member_location) then
|
||||
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
|
||||
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;
|
||||
DW_FORM_block2 : begin
|
||||
ValueSize := PWord(p)^;
|
||||
@ -491,10 +542,10 @@ var
|
||||
s3 := IntToStr(ValueSize) + ': ' + ToHex(p, ValueSize);
|
||||
if (Attribute = DW_AT_location) or (Attribute = DW_AT_data_member_location) then
|
||||
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
|
||||
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;
|
||||
DW_FORM_block4 : begin
|
||||
ValueSize := PLongWord(p)^;
|
||||
@ -504,93 +555,93 @@ var
|
||||
s3 := IntToStr(ValueSize) + ': ' + ToHex(p, ValueSize);
|
||||
if (Attribute = DW_AT_location) or (Attribute = DW_AT_data_member_location) then
|
||||
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
|
||||
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;
|
||||
DW_FORM_data1 : begin
|
||||
stest := ToHexCommaList(p,1);
|
||||
s3 := ToHex(p, 1);
|
||||
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;
|
||||
DW_FORM_data2 : begin
|
||||
stest := ToHexCommaList(p,2);
|
||||
s3 := ToHex(p, 2);
|
||||
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;
|
||||
DW_FORM_data4 : begin
|
||||
stest := ToHexCommaList(p,4);
|
||||
s3 := ToHex(p, 4);
|
||||
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;
|
||||
DW_FORM_data8 : begin
|
||||
stest := ToHexCommaList(p,8);
|
||||
s3 := ToHex(p, 8);
|
||||
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;
|
||||
DW_FORM_sdata : begin
|
||||
SValue := SLEB128toOrdinal(p);
|
||||
s3 := IntToStr(SValue);
|
||||
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;
|
||||
DW_FORM_udata : begin
|
||||
Value := ULEB128toOrdinal(p);
|
||||
s3 := IntToStr(Value);
|
||||
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;
|
||||
DW_FORM_flag : begin
|
||||
stest := ToHexCommaList(p,1);
|
||||
s3 := ToHex(p, 1);
|
||||
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;
|
||||
DW_FORM_ref1 : begin
|
||||
stest := ToHexCommaList(p,1);
|
||||
s3 := ToHex(p, 1);
|
||||
PascalTestCAseCode := PascalTestCAseCode +
|
||||
Format('XX_X_CurInfo992X.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, @Info__%s_); // %s %s', [s1, s2, IntToStr(PByte(p-1)^), stest, LineEnding]);
|
||||
//Format(namePreFix+'AddRef(%s, %s, FOO); // %s %s', [s1, s2, stest, LineEnding]);
|
||||
end;
|
||||
DW_FORM_ref2 : begin
|
||||
stest := ToHexCommaList(p,3);
|
||||
s3 := ToHex(p, 2);
|
||||
PascalTestCAseCode := PascalTestCAseCode +
|
||||
Format('XX_X_CurInfo992X.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, @Info__%s_); // %s %s', [s1, s2, IntToStr(PWord(p-2)^), stest, LineEnding]);
|
||||
//Format(namePreFix+'AddRef(%s, %s, FOO); // %s %s', [s1, s2, stest, LineEnding]);
|
||||
end;
|
||||
DW_FORM_ref4 : begin
|
||||
stest := ToHexCommaList(p,4);
|
||||
s4 := IntToHex(PInteger(p)^ -11, 8);;
|
||||
s3 := ToHex(p, 4) + ' // '+ s4;
|
||||
PascalTestCAseCode := PascalTestCAseCode +
|
||||
Format('XX_X_CurInfo992X.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, @Info__%s_); // %s %s', [s1, s2, IntToStr(PDWord(p-4)^), stest, LineEnding]);
|
||||
//Format(namePreFix+'AddRef(%s, %s, FOO); // %s %s', [s1, s2, stest, LineEnding]);
|
||||
end;
|
||||
DW_FORM_ref8 : begin
|
||||
stest := ToHexCommaList(p,8);
|
||||
s3 := ToHex(p, 8);
|
||||
PascalTestCAseCode := PascalTestCAseCode +
|
||||
Format('XX_X_CurInfo992X.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, @Info__%s_); // %s %s', [s1, s2, IntToStr(PQWord(p-8)^), stest, LineEnding]);
|
||||
//Format(namePreFix+'AddRef(%s, %s, FOO); // %s %s', [s1, s2, stest, LineEnding]);
|
||||
end;
|
||||
DW_FORM_ref_udata: begin
|
||||
Value := ULEB128toOrdinal(p);
|
||||
s3 := IntToStr(Value);
|
||||
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;
|
||||
DW_FORM_ref_addr : begin
|
||||
stest := ToHexCommaList(p,4);
|
||||
s3 := ToHex(p, 4 {FCU.FAddressSize});
|
||||
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;
|
||||
DW_FORM_string : begin
|
||||
s3 := copy(pchar(p),1,1000);
|
||||
@ -599,13 +650,13 @@ var
|
||||
end;
|
||||
inc(pbyte(p));
|
||||
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;
|
||||
DW_FORM_strp : begin
|
||||
stest := ToHexCommaList(p,4);
|
||||
s3 := ToHex(p, 4 {FCU.FAddressSize});
|
||||
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;
|
||||
DW_FORM_indirect : begin
|
||||
Value := ULEB128toOrdinal(p);
|
||||
@ -613,12 +664,12 @@ var
|
||||
//Form := ULEB128toOrdinal(p);
|
||||
//Continue;
|
||||
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;
|
||||
else
|
||||
s3 := '?????';
|
||||
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;
|
||||
|
||||
if Attribute = DW_AT_name then Result := s3;
|
||||
@ -645,7 +696,7 @@ var
|
||||
entryname: String;
|
||||
TestCaseText: String;
|
||||
NMLIdx: Integer;
|
||||
pre: String;
|
||||
pre, sName: String;
|
||||
begin
|
||||
p := s.Entry;
|
||||
Abbrev := ULEB128toOrdinal(p);
|
||||
@ -653,7 +704,8 @@ var
|
||||
CU.GetDefinition(p, Def);
|
||||
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 := '';
|
||||
Case def.tag of
|
||||
@ -681,14 +733,10 @@ var
|
||||
i := 0;
|
||||
if s.HasChild then i := 1;
|
||||
TestCaseText :=
|
||||
Format('XX_X_CurInfo992X.Tag := %s;%s',
|
||||
[DwarfTagToString(Def.tag), LineEnding])
|
||||
+ Format('XX_X_CurInfo992X.Children := %d;%s', [i, LineEnding])
|
||||
Format('%sTag := %s;%s',
|
||||
[sName, DwarfTagToString(Def.tag), LineEnding])
|
||||
+ Format('%sChildren := %d;%s', [sName, i, LineEnding])
|
||||
+ 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));
|
||||
|
||||
i := 0;
|
||||
@ -699,6 +747,11 @@ var
|
||||
n := AddNode(Node,n,s2);
|
||||
s2.GoNext;
|
||||
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;
|
||||
|
||||
@ -711,6 +764,8 @@ var
|
||||
Node: TTreeNode;
|
||||
rs: TDwarfScopeInfo;
|
||||
begin
|
||||
FShowingUnit := not FShowingUnit;//////////////////
|
||||
if not FShowingUnit then exit;/////////////////
|
||||
TreeView1.BeginUpdate;
|
||||
try
|
||||
TreeView1.Items.Clear;
|
||||
@ -729,6 +784,7 @@ begin
|
||||
end;
|
||||
finally
|
||||
TreeView1.EndUpdate;
|
||||
FShowingUnit := False; ////////////////////
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -748,7 +804,7 @@ end;
|
||||
procedure TForm1.UnLoadDwarf;
|
||||
begin
|
||||
FreeAndNil(FDwarfInfo);
|
||||
FreeAndNil(FImageLoader);
|
||||
FreeAndNil(FImageLoaderList);
|
||||
FCUCount := 0;
|
||||
end;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user