mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-12 04:36:31 +02:00
+ added testproject for disassembler
git-svn-id: trunk@9239 -
This commit is contained in:
parent
6aae9024cc
commit
d1664cbba8
5
.gitattributes
vendored
5
.gitattributes
vendored
@ -573,6 +573,11 @@ debugger/windebug/fpwd/fpwdglobal.pas svneol=native#text/pascal
|
||||
debugger/windebug/fpwd/fpwdloop.pas svneol=native#text/pascal
|
||||
debugger/windebug/fpwd/fpwdpeimage.pas svneol=native#text/pascal
|
||||
debugger/windebug/fpwd/fpwdtype.pas svneol=native#text/pascal
|
||||
debugger/windebug/test/asmtest.lpi svneol=native#text/plain
|
||||
debugger/windebug/test/asmtest.lpr svneol=native#text/pascal
|
||||
debugger/windebug/test/asmtestunit.lfm svneol=native#text/plain
|
||||
debugger/windebug/test/asmtestunit.lrs svneol=native#text/plain
|
||||
debugger/windebug/test/asmtestunit.pas svneol=native#text/pascal
|
||||
debugger/windebug/windebugger.pp svneol=native#text/pascal
|
||||
debugger/windebug/windextra.pp svneol=native#text/pascal
|
||||
debugger/windebug/windisas.pp svneol=native#text/plain
|
||||
|
77
debugger/windebug/test/asmtest.lpi
Normal file
77
debugger/windebug/test/asmtest.lpi
Normal file
@ -0,0 +1,77 @@
|
||||
<?xml version="1.0"?>
|
||||
<CONFIG>
|
||||
<ProjectOptions>
|
||||
<PathDelim Value="\"/>
|
||||
<Version Value="5"/>
|
||||
<General>
|
||||
<MainUnit Value="0"/>
|
||||
<IconPath Value="./"/>
|
||||
<TargetFileExt Value=".exe"/>
|
||||
<ActiveEditorIndexAtStart Value="0"/>
|
||||
</General>
|
||||
<LazDoc Paths=""/>
|
||||
<PublishOptions>
|
||||
<Version Value="2"/>
|
||||
<IgnoreBinaries Value="False"/>
|
||||
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
|
||||
<ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/>
|
||||
</PublishOptions>
|
||||
<RunParams>
|
||||
<local>
|
||||
<FormatVersion Value="1"/>
|
||||
<LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
|
||||
</local>
|
||||
</RunParams>
|
||||
<RequiredPackages Count="1">
|
||||
<Item1>
|
||||
<PackageName Value="LCL"/>
|
||||
</Item1>
|
||||
</RequiredPackages>
|
||||
<Units Count="2">
|
||||
<Unit0>
|
||||
<Filename Value="asmtest.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="asmtest"/>
|
||||
<CursorPos X="70" Y="18"/>
|
||||
<TopLine Value="1"/>
|
||||
<EditorIndex Value="2"/>
|
||||
<UsageCount Value="20"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit0>
|
||||
<Unit1>
|
||||
<Filename Value="asmtestunit.pas"/>
|
||||
<ComponentName Value="Form1"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<ResourceFilename Value="asmtestunit.lrs"/>
|
||||
<UnitName Value="AsmTestUnit"/>
|
||||
<CursorPos X="34" Y="53"/>
|
||||
<TopLine Value="43"/>
|
||||
<EditorIndex Value="0"/>
|
||||
<UsageCount Value="20"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit1>
|
||||
</Units>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
<Version Value="5"/>
|
||||
<PathDelim Value="\"/>
|
||||
<SearchPaths>
|
||||
<OtherUnitFiles Value="..\"/>
|
||||
<SrcPath Value="$(LazarusDir)\lcl\;$(LazarusDir)\lcl\interfaces\$(LCLWidgetType)\"/>
|
||||
</SearchPaths>
|
||||
<CodeGeneration>
|
||||
<Generate Value="Faster"/>
|
||||
</CodeGeneration>
|
||||
<Linking>
|
||||
<Options>
|
||||
<Win32>
|
||||
<GraphicApplication Value="True"/>
|
||||
</Win32>
|
||||
</Options>
|
||||
</Linking>
|
||||
<Other>
|
||||
<CompilerPath Value="$(CompPath)"/>
|
||||
</Other>
|
||||
<CompileReasons Run="False"/>
|
||||
</CompilerOptions>
|
||||
</CONFIG>
|
18
debugger/windebug/test/asmtest.lpr
Normal file
18
debugger/windebug/test/asmtest.lpr
Normal file
@ -0,0 +1,18 @@
|
||||
program asmtest;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
uses
|
||||
{$IFDEF UNIX}{$IFDEF UseCThreads}
|
||||
cthreads,
|
||||
{$ENDIF}{$ENDIF}
|
||||
Interfaces, // this includes the LCL widgetset
|
||||
Forms
|
||||
{ add your units here }, AsmTestUnit;
|
||||
|
||||
begin
|
||||
Application.Initialize;
|
||||
Application.CreateForm(TForm1, Form1);
|
||||
Application.Run;
|
||||
end.
|
||||
|
73
debugger/windebug/test/asmtestunit.lfm
Normal file
73
debugger/windebug/test/asmtestunit.lfm
Normal file
@ -0,0 +1,73 @@
|
||||
object Form1: TForm1
|
||||
Caption = 'AsmTest'
|
||||
ClientHeight = 224
|
||||
ClientWidth = 400
|
||||
PixelsPerInch = 120
|
||||
HorzScrollBar.Page = 399
|
||||
VertScrollBar.Page = 223
|
||||
Left = 435
|
||||
Height = 224
|
||||
Top = 232
|
||||
Width = 400
|
||||
object Label1: TLabel
|
||||
Caption = 'Enter hex values separated by spaces here'
|
||||
Color = clNone
|
||||
ParentColor = False
|
||||
Left = 8
|
||||
Height = 18
|
||||
Top = 8
|
||||
Width = 263
|
||||
end
|
||||
object Label2: TLabel
|
||||
Anchors = [akLeft, akBottom]
|
||||
Caption = 'Output'
|
||||
Color = clNone
|
||||
ParentColor = False
|
||||
Left = 8
|
||||
Height = 17
|
||||
Top = 171
|
||||
Width = 45
|
||||
end
|
||||
object txtCode: TMemo
|
||||
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||
Lines.Strings = (
|
||||
'90'
|
||||
'41'
|
||||
'E8 12345678'
|
||||
'C3'
|
||||
'AA'
|
||||
'0F0F A4 B6 12345678 A6'
|
||||
'65 0F 01 92 12345678'
|
||||
'43 DB 9C B1 55667788'
|
||||
''
|
||||
)
|
||||
ScrollBars = ssVertical
|
||||
TabOrder = 0
|
||||
Left = 8
|
||||
Height = 135
|
||||
Top = 32
|
||||
Width = 384
|
||||
end
|
||||
object txtOutput: TEdit
|
||||
Anchors = [akLeft, akRight, akBottom]
|
||||
ReadOnly = True
|
||||
TabOrder = 1
|
||||
Left = 8
|
||||
Height = 23
|
||||
Top = 191
|
||||
Width = 384
|
||||
end
|
||||
object chk64Bit: TCheckBox
|
||||
Caption = '64 bit'
|
||||
TabOrder = 2
|
||||
Left = 304
|
||||
Height = 17
|
||||
Top = 9
|
||||
Width = 55
|
||||
end
|
||||
object Timer1: TTimer
|
||||
Interval = 250
|
||||
OnTimer = Timer1Timer
|
||||
top = 184
|
||||
end
|
||||
end
|
22
debugger/windebug/test/asmtestunit.lrs
Normal file
22
debugger/windebug/test/asmtestunit.lrs
Normal file
@ -0,0 +1,22 @@
|
||||
{ This is an automatically generated lazarus resource file }
|
||||
|
||||
LazarusResources.Add('TForm1','FORMDATA',[
|
||||
'TPF0'#6'TForm1'#5'Form1'#7'Caption'#6#7'AsmTest'#12'ClientHeight'#3#224#0#11
|
||||
+'ClientWidth'#3#144#1#13'PixelsPerInch'#2'x'#18'HorzScrollBar.Page'#3#143#1
|
||||
+#18'VertScrollBar.Page'#3#223#0#4'Left'#3#179#1#6'Height'#3#224#0#3'Top'#3
|
||||
+#232#0#5'Width'#3#144#1#0#6'TLabel'#6'Label1'#7'Caption'#6')Enter hex values'
|
||||
+' separated by spaces here'#5'Color'#7#6'clNone'#11'ParentColor'#8#4'Left'#2
|
||||
+#8#6'Height'#2#18#3'Top'#2#8#5'Width'#3#7#1#0#0#6'TLabel'#6'Label2'#7'Anchor'
|
||||
+'s'#11#6'akLeft'#8'akBottom'#0#7'Caption'#6#6'Output'#5'Color'#7#6'clNone'#11
|
||||
+'ParentColor'#8#4'Left'#2#8#6'Height'#2#17#3'Top'#3#171#0#5'Width'#2'-'#0#0#5
|
||||
+'TMemo'#7'txtCode'#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#8'akBottom'#0
|
||||
+#13'Lines.Strings'#1#6#2'90'#6#2'41'#6#11'E8 12345678'#6#2'C3'#6#2'AA'#6#22
|
||||
+'0F0F A4 B6 12345678 A6'#6#20'65 0F 01 92 12345678'#6#20'43 DB 9C B1 5566778'
|
||||
+'8'#6#0#0#10'ScrollBars'#7#10'ssVertical'#8'TabOrder'#2#0#4'Left'#2#8#6'Heig'
|
||||
+'ht'#3#135#0#3'Top'#2' '#5'Width'#3#128#1#0#0#5'TEdit'#9'txtOutput'#7'Anchor'
|
||||
+'s'#11#6'akLeft'#7'akRight'#8'akBottom'#0#8'ReadOnly'#9#8'TabOrder'#2#1#4'Le'
|
||||
+'ft'#2#8#6'Height'#2#23#3'Top'#3#191#0#5'Width'#3#128#1#0#0#9'TCheckBox'#8'c'
|
||||
+'hk64Bit'#7'Caption'#6#6'64 bit'#8'TabOrder'#2#2#4'Left'#3'0'#1#6'Height'#2
|
||||
+#17#3'Top'#2#9#5'Width'#2'7'#0#0#6'TTimer'#6'Timer1'#8'Interval'#3#250#0#7'O'
|
||||
+'nTimer'#7#11'Timer1Timer'#3'top'#3#184#0#0#0#0
|
||||
]);
|
80
debugger/windebug/test/asmtestunit.pas
Normal file
80
debugger/windebug/test/asmtestunit.pas
Normal file
@ -0,0 +1,80 @@
|
||||
unit AsmTestUnit;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, StdCtrls, windisas,
|
||||
ExtCtrls, LCLProc, Math;
|
||||
|
||||
type
|
||||
|
||||
{ TForm1 }
|
||||
|
||||
TForm1 = class(TForm)
|
||||
chk64Bit: TCheckBox;
|
||||
Timer1: TTimer;
|
||||
txtOutput: TEdit;
|
||||
Label1: TLabel;
|
||||
Label2: TLabel;
|
||||
txtCode: TMemo;
|
||||
procedure Timer1Timer(Sender: TObject);
|
||||
private
|
||||
{ private declarations }
|
||||
public
|
||||
{ public declarations }
|
||||
end;
|
||||
|
||||
var
|
||||
Form1: TForm1;
|
||||
|
||||
implementation
|
||||
|
||||
{ TForm1 }
|
||||
|
||||
procedure TForm1.Timer1Timer(Sender: TObject);
|
||||
var
|
||||
idx, n: Integer;
|
||||
Line, S: String;
|
||||
Code: array[0..28] of Byte;
|
||||
CodeIdx, B: Byte;
|
||||
Value: Int64;
|
||||
e: Integer;
|
||||
p: Pointer;
|
||||
begin
|
||||
n := txtCode.SelStart;
|
||||
if n < 0 then Exit;
|
||||
S := Copy(txtCode.Text, 1, n);
|
||||
idx := 0;
|
||||
for n := 1 to Length(S) do
|
||||
begin
|
||||
if S[n] = #10 then Inc(idx);
|
||||
end;
|
||||
Line := txtCode.Lines[idx];
|
||||
CodeIdx := 0;
|
||||
while (Line <> '') and (CodeIdx < 20) do
|
||||
begin
|
||||
S := GetPart([], [' ', #9], Line);
|
||||
Delete(Line, 1, 1); // strip end ' ' or #9
|
||||
if S = '' then Continue;
|
||||
B := Min(16, Length(S));
|
||||
Val('$' + S, Value, e);
|
||||
if e <> 0 then Continue;
|
||||
Move(Value, Code[CodeIdx], B div 2);
|
||||
Inc(CodeIdx, B div 2);
|
||||
end;
|
||||
if CodeIdx > 0
|
||||
then begin
|
||||
p := @Code;
|
||||
Disassemble(p, chk64Bit.Checked, S, Line);
|
||||
txtOutput.Text := S + ' '+ Line;
|
||||
end
|
||||
// else txtOutput.Text :='';
|
||||
end;
|
||||
|
||||
initialization
|
||||
{$I asmtestunit.lrs}
|
||||
|
||||
end.
|
||||
|
Loading…
Reference in New Issue
Block a user