ifdef mode

git-svn-id: trunk@9150 -
This commit is contained in:
marc 2006-04-20 21:53:03 +00:00
parent 662141d40e
commit b248d3622e
6 changed files with 209 additions and 246 deletions

View File

@ -7,7 +7,7 @@
<MainUnit Value="0"/> <MainUnit Value="0"/>
<IconPath Value="./"/> <IconPath Value="./"/>
<TargetFileExt Value=".exe"/> <TargetFileExt Value=".exe"/>
<ActiveEditorIndexAtStart Value="3"/> <ActiveEditorIndexAtStart Value="10"/>
</General> </General>
<LazDoc Paths=""/> <LazDoc Paths=""/>
<PublishOptions> <PublishOptions>
@ -27,45 +27,45 @@
<PackageName Value="LCL"/> <PackageName Value="LCL"/>
</Item1> </Item1>
</RequiredPackages> </RequiredPackages>
<Units Count="18"> <Units Count="21">
<Unit0> <Unit0>
<Filename Value="fpwd.lpr"/> <Filename Value="fpwd.lpr"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<UnitName Value="fpwd"/> <UnitName Value="fpwd"/>
<CursorPos X="3" Y="47"/> <CursorPos X="3" Y="47"/>
<TopLine Value="25"/> <TopLine Value="25"/>
<EditorIndex Value="3"/> <EditorIndex Value="6"/>
<UsageCount Value="25"/> <UsageCount Value="26"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit0> </Unit0>
<Unit1> <Unit1>
<Filename Value="fpwdcommand.pas"/> <Filename Value="fpwdcommand.pas"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<UnitName Value="FPWDCommand"/> <UnitName Value="FPWDCommand"/>
<CursorPos X="1" Y="7"/> <CursorPos X="31" Y="418"/>
<TopLine Value="1"/> <TopLine Value="414"/>
<EditorIndex Value="7"/> <EditorIndex Value="10"/>
<UsageCount Value="25"/> <UsageCount Value="26"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit1> </Unit1>
<Unit2> <Unit2>
<Filename Value="..\windebugger.pp"/> <Filename Value="..\windebugger.pp"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<UnitName Value="WinDebugger"/> <UnitName Value="WinDebugger"/>
<CursorPos X="1" Y="34"/> <CursorPos X="16" Y="656"/>
<TopLine Value="34"/> <TopLine Value="630"/>
<EditorIndex Value="0"/> <EditorIndex Value="0"/>
<UsageCount Value="24"/> <UsageCount Value="25"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit2> </Unit2>
<Unit3> <Unit3>
<Filename Value="fpwdtype.pas"/> <Filename Value="fpwdtype.pas"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<UnitName Value="FPWDType"/> <UnitName Value="FPWDType"/>
<CursorPos X="2" Y="1"/> <CursorPos X="3" Y="416"/>
<TopLine Value="1"/> <TopLine Value="394"/>
<EditorIndex Value="4"/> <EditorIndex Value="7"/>
<UsageCount Value="25"/> <UsageCount Value="26"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit3> </Unit3>
<Unit4> <Unit4>
@ -74,16 +74,16 @@
<UnitName Value="FPWDUtil"/> <UnitName Value="FPWDUtil"/>
<CursorPos X="26" Y="4"/> <CursorPos X="26" Y="4"/>
<TopLine Value="1"/> <TopLine Value="1"/>
<UsageCount Value="25"/> <UsageCount Value="26"/>
</Unit4> </Unit4>
<Unit5> <Unit5>
<Filename Value="fpwdglobal.pas"/> <Filename Value="fpwdglobal.pas"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<UnitName Value="FPWDGlobal"/> <UnitName Value="FPWDGlobal"/>
<CursorPos X="1" Y="34"/> <CursorPos X="45" Y="48"/>
<TopLine Value="14"/> <TopLine Value="36"/>
<EditorIndex Value="2"/> <EditorIndex Value="4"/>
<UsageCount Value="25"/> <UsageCount Value="26"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit5> </Unit5>
<Unit6> <Unit6>
@ -113,8 +113,8 @@
<UnitName Value="WindExtra"/> <UnitName Value="WindExtra"/>
<CursorPos X="25" Y="19"/> <CursorPos X="25" Y="19"/>
<TopLine Value="31"/> <TopLine Value="31"/>
<EditorIndex Value="1"/> <EditorIndex Value="3"/>
<UsageCount Value="24"/> <UsageCount Value="25"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit9> </Unit9>
<Unit10> <Unit10>
@ -122,9 +122,7 @@
<UnitName Value="FPWDBreak"/> <UnitName Value="FPWDBreak"/>
<CursorPos X="1" Y="2"/> <CursorPos X="1" Y="2"/>
<TopLine Value="1"/> <TopLine Value="1"/>
<EditorIndex Value="8"/>
<UsageCount Value="11"/> <UsageCount Value="11"/>
<Loaded Value="True"/>
</Unit10> </Unit10>
<Unit11> <Unit11>
<Filename Value="..\..\..\..\fpc\fpc.2.0.2\rtl\objpas\types.pp"/> <Filename Value="..\..\..\..\fpc\fpc.2.0.2\rtl\objpas\types.pp"/>
@ -154,10 +152,10 @@
<Unit15> <Unit15>
<Filename Value="fpwdloop.pas"/> <Filename Value="fpwdloop.pas"/>
<UnitName Value="FPWDLoop"/> <UnitName Value="FPWDLoop"/>
<CursorPos X="1" Y="9"/> <CursorPos X="1" Y="361"/>
<TopLine Value="1"/> <TopLine Value="343"/>
<EditorIndex Value="5"/> <EditorIndex Value="8"/>
<UsageCount Value="11"/> <UsageCount Value="12"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit15> </Unit15>
<Unit16> <Unit16>
@ -165,8 +163,8 @@
<UnitName Value="FPWDPEImage"/> <UnitName Value="FPWDPEImage"/>
<CursorPos X="1" Y="1"/> <CursorPos X="1" Y="1"/>
<TopLine Value="1"/> <TopLine Value="1"/>
<EditorIndex Value="6"/> <EditorIndex Value="9"/>
<UsageCount Value="11"/> <UsageCount Value="12"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit16> </Unit16>
<Unit17> <Unit17>
@ -174,132 +172,89 @@
<UnitName Value="LCLProc"/> <UnitName Value="LCLProc"/>
<CursorPos X="57" Y="32"/> <CursorPos X="57" Y="32"/>
<TopLine Value="14"/> <TopLine Value="14"/>
<EditorIndex Value="9"/> <EditorIndex Value="11"/>
<UsageCount Value="11"/> <UsageCount Value="12"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit17> </Unit17>
<Unit18>
<Filename Value="..\..\..\..\fpc\rtl\win\wininc\defines.inc"/>
<CursorPos X="1" Y="5316"/>
<TopLine Value="5304"/>
<EditorIndex Value="1"/>
<UsageCount Value="11"/>
<Loaded Value="True"/>
</Unit18>
<Unit19>
<Filename Value="..\..\..\..\fpc\rtl\win\wininc\struct.inc"/>
<CursorPos X="21" Y="1080"/>
<TopLine Value="1067"/>
<EditorIndex Value="2"/>
<UsageCount Value="11"/>
<Loaded Value="True"/>
</Unit19>
<Unit20>
<Filename Value="..\..\..\..\fpc\rtl\win32\windows.pp"/>
<UnitName Value="windows"/>
<CursorPos X="5" Y="30"/>
<TopLine Value="16"/>
<EditorIndex Value="5"/>
<UsageCount Value="11"/>
<Loaded Value="True"/>
</Unit20>
</Units> </Units>
<JumpHistory Count="30" HistoryIndex="29"> <JumpHistory Count="13" HistoryIndex="12">
<Position1> <Position1>
<Filename Value="..\windebugger.pp"/> <Filename Value="..\..\..\..\fpc\rtl\win\wininc\defines.inc"/>
<Caret Line="6" Column="32" TopLine="3"/> <Caret Line="1" Column="1" TopLine="1"/>
</Position1> </Position1>
<Position2> <Position2>
<Filename Value="..\windebugger.pp"/> <Filename Value="..\..\..\..\fpc\rtl\win\wininc\struct.inc"/>
<Caret Line="33" Column="1" TopLine="22"/> <Caret Line="7" Column="74" TopLine="1"/>
</Position2> </Position2>
<Position3> <Position3>
<Filename Value="..\windebugger.pp"/> <Filename Value="..\windebugger.pp"/>
<Caret Line="21" Column="1" TopLine="11"/> <Caret Line="224" Column="27" TopLine="202"/>
</Position3> </Position3>
<Position4> <Position4>
<Filename Value="..\windextra.pp"/> <Filename Value="fpwdloop.pas"/>
<Caret Line="25" Column="1" TopLine="12"/> <Caret Line="6" Column="46" TopLine="1"/>
</Position4> </Position4>
<Position5> <Position5>
<Filename Value="..\windextra.pp"/> <Filename Value="fpwdcommand.pas"/>
<Caret Line="34" Column="1" TopLine="12"/> <Caret Line="4" Column="57" TopLine="1"/>
</Position5> </Position5>
<Position6> <Position6>
<Filename Value="..\windebugger.pp"/> <Filename Value="fpwdcommand.pas"/>
<Caret Line="34" Column="1" TopLine="15"/> <Caret Line="258" Column="30" TopLine="243"/>
</Position6> </Position6>
<Position7> <Position7>
<Filename Value="fpwdglobal.pas"/> <Filename Value="fpwdloop.pas"/>
<Caret Line="34" Column="1" TopLine="12"/> <Caret Line="315" Column="1" TopLine="306"/>
</Position7> </Position7>
<Position8> <Position8>
<Filename Value="..\windebugger.pp"/> <Filename Value="fpwdloop.pas"/>
<Caret Line="4" Column="1" TopLine="1"/> <Caret Line="313" Column="25" TopLine="297"/>
</Position8> </Position8>
<Position9> <Position9>
<Filename Value="..\windebugger.pp"/> <Filename Value="fpwdloop.pas"/>
<Caret Line="162" Column="1" TopLine="144"/> <Caret Line="351" Column="53" TopLine="337"/>
</Position9> </Position9>
<Position10> <Position10>
<Filename Value="fpwd.lpr"/> <Filename Value="fpwdcommand.pas"/>
<Caret Line="10" Column="1" TopLine="1"/> <Caret Line="258" Column="30" TopLine="243"/>
</Position10> </Position10>
<Position11> <Position11>
<Filename Value="fpwdcommand.pas"/> <Filename Value="fpwdcommand.pas"/>
<Caret Line="560" Column="49" TopLine="549"/> <Caret Line="260" Column="28" TopLine="244"/>
</Position11> </Position11>
<Position12> <Position12>
<Filename Value="fpwdloop.pas"/> <Filename Value="fpwdcommand.pas"/>
<Caret Line="14" Column="15" TopLine="1"/> <Caret Line="432" Column="1" TopLine="411"/>
</Position12> </Position12>
<Position13> <Position13>
<Filename Value="fpwdloop.pas"/> <Filename Value="fpwdcommand.pas"/>
<Caret Line="4" Column="1" TopLine="1"/> <Caret Line="423" Column="8" TopLine="410"/>
</Position13> </Position13>
<Position14>
<Filename Value="fpwdloop.pas"/>
<Caret Line="28" Column="28" TopLine="17"/>
</Position14>
<Position15>
<Filename Value="fpwdcommand.pas"/>
<Caret Line="13" Column="46" TopLine="1"/>
</Position15>
<Position16>
<Filename Value="fpwdcommand.pas"/>
<Caret Line="273" Column="43" TopLine="262"/>
</Position16>
<Position17>
<Filename Value="fpwdglobal.pas"/>
<Caret Line="34" Column="1" TopLine="24"/>
</Position17>
<Position18>
<Filename Value="fpwd.lpr"/>
<Caret Line="21" Column="1" TopLine="1"/>
</Position18>
<Position19>
<Filename Value="fpwd.lpr"/>
<Caret Line="34" Column="1" TopLine="12"/>
</Position19>
<Position20>
<Filename Value="fpwdtype.pas"/>
<Caret Line="79" Column="1" TopLine="64"/>
</Position20>
<Position21>
<Filename Value="fpwdtype.pas"/>
<Caret Line="34" Column="1" TopLine="12"/>
</Position21>
<Position22>
<Filename Value="fpwdtype.pas"/>
<Caret Line="62" Column="1" TopLine="56"/>
</Position22>
<Position23>
<Filename Value="fpwdloop.pas"/>
<Caret Line="6" Column="1" TopLine="1"/>
</Position23>
<Position24>
<Filename Value="fpwdloop.pas"/>
<Caret Line="32" Column="1" TopLine="12"/>
</Position24>
<Position25>
<Filename Value="fpwdloop.pas"/>
<Caret Line="194" Column="1" TopLine="188"/>
</Position25>
<Position26>
<Filename Value="fpwdloop.pas"/>
<Caret Line="385" Column="5" TopLine="363"/>
</Position26>
<Position27>
<Filename Value="fpwdpeimage.pas"/>
<Caret Line="10" Column="1" TopLine="1"/>
</Position27>
<Position28>
<Filename Value="fpwdpeimage.pas"/>
<Caret Line="34" Column="1" TopLine="12"/>
</Position28>
<Position29>
<Filename Value="fpwdcommand.pas"/>
<Caret Line="6" Column="1" TopLine="1"/>
</Position29>
<Position30>
<Filename Value="fpwdbreak.pas"/>
<Caret Line="2" Column="10" TopLine="1"/>
</Position30>
</JumpHistory> </JumpHistory>
</ProjectOptions> </ProjectOptions>
<CompilerOptions> <CompilerOptions>
@ -314,7 +269,13 @@
</CodeGeneration> </CodeGeneration>
<Other> <Other>
<CompilerPath Value="$(CompPath)"/> <CompilerPath Value="$(CompPath)"/>
<ExecuteBefore>
<Command Value="buildx64.cmd"/>
<ScanForFPCMsgs Value="True"/>
<ScanForMakeMsgs Value="True"/>
</ExecuteBefore>
</Other> </Other>
<CompileReasons Compile="False" Build="False" Run="False"/>
</CompilerOptions> </CompilerOptions>
<Debugging> <Debugging>
<BreakPoints Count="11"> <BreakPoints Count="11">

View File

@ -253,10 +253,12 @@ begin
idx := 1; idx := 1;
Count := 1; Count := 1;
Size := 4; Size := 4;
case GMode of
dm32: Adress := GCurrentContext.Eip; {$ifdef cpui386}
dm64: Adress := GCurrentContext64.Rip; Adress := GCurrentContext.Eip;
end; {$else}
Adress := GCurrentContext.Rip;
{$endif}
if P[idx] <> '' if P[idx] <> ''
then begin then begin
@ -418,18 +420,15 @@ begin
Exit; Exit;
end; end;
case GMode of {$ifdef cpui386}
dm32: begin Adress := GCurrentContext.Eip;
Adress := GCurrentContext.Eip; Frame := GCurrentContext.Ebp;
Frame := GCurrentContext.Ebp; Size := 4;
Size := 4; {$else}
end; Adress := GCurrentContext.Rip;
dm64: begin Frame := GCurrentContext.Rdi;
Adress := GCurrentContext64.Rip; Size := 8;
Frame := GCurrentContext64.Rdi; {$endif}
Size := 8;
end;
end;
WriteLN('Callstack:'); WriteLN('Callstack:');
WriteLn(' ', FormatAdress(Adress)); WriteLn(' ', FormatAdress(Adress));

View File

@ -45,9 +45,12 @@ type
var var
GState: TMWDState; GState: TMWDState;
GFileName: String; GFileName: String;
{$ifdef cpui386}
GMode: TMWDMode = dm32; GMode: TMWDMode = dm32;
GCurrentContext64: TContextAMD64; {$else}
GCurrentContext: TContext absolute GCurrentContext64; GMode: TMWDMode = dm64;
{$endif}
GCurrentContext: TContext;
GMainProcess: TDbgProcess = nil; GMainProcess: TDbgProcess = nil;
GCurrentProcess: TDbgProcess = nil; GCurrentProcess: TDbgProcess = nil;

View File

@ -1,4 +1,4 @@
{ $Id: $ } { $Id $ }
{ {
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
fpwdloop.pas - FP standalone windows debugger - Debugger main loop fpwdloop.pas - FP standalone windows debugger - Debugger main loop
@ -117,35 +117,32 @@ begin
else else
Write(' Unknown code: ', AEvent.Exception.ExceptionRecord.ExceptionCode); Write(' Unknown code: ', AEvent.Exception.ExceptionRecord.ExceptionCode);
end; end;
case GMode of {$ifdef cpui386}
dm64: Info0 := AEvent.Exception64.ExceptionRecord.ExceptionAddress; Info0 := Cardinal(AEvent.Exception.ExceptionRecord.ExceptionAddress);
dm32: Info0 := Cardinal(AEvent.Exception.ExceptionRecord.ExceptionAddress); {$else}
else Info0 := AEvent.Exception64.ExceptionRecord.ExceptionAddress;
Info0 := 0; {$endif}
end;
Write(' at: ', FormatAdress(Info0)); Write(' at: ', FormatAdress(Info0));
Write(' Flags:', Format('%x', [AEvent.Exception.ExceptionRecord.ExceptionFlags]), ' ['); Write(' Flags:', Format('%x', [AEvent.Exception.ExceptionRecord.ExceptionFlags]), ' [');
if AEvent.Exception.ExceptionRecord.ExceptionFlags = 0 if AEvent.Exception.ExceptionRecord.ExceptionFlags = 0
then Write('Continuable') then Write('Continuable')
else Write('Not continuable'); else Write('Not continuable');
Write(']'); Write(']');
case GMode of {$ifdef cpui386}
dm64: Write(' ParamCount:', AEvent.Exception64.ExceptionRecord.NumberParameters); Write(' ParamCount:', AEvent.Exception.ExceptionRecord.NumberParameters);
dm32: Write(' ParamCount:', AEvent.Exception.ExceptionRecord.NumberParameters); {$else}
end; Write(' ParamCount:', AEvent.Exception64.ExceptionRecord.NumberParameters);
{$endif}
case AEvent.Exception.ExceptionRecord.ExceptionCode of case AEvent.Exception.ExceptionRecord.ExceptionCode of
EXCEPTION_ACCESS_VIOLATION: begin EXCEPTION_ACCESS_VIOLATION: begin
case GMode of {$ifdef cpui386}
dm64: begin Info0 := AEvent.Exception.ExceptionRecord.ExceptionInformation[0];
Info0 := AEvent.Exception64.ExceptionRecord.ExceptionInformation[0]; Info1Str := IntToHex(AEvent.Exception.ExceptionRecord.ExceptionInformation[1], 8);
Info1Str := IntToHex(AEvent.Exception64.ExceptionRecord.ExceptionInformation[1], 16); {$else}
end; Info0 := AEvent.Exception64.ExceptionRecord.ExceptionInformation[0];
dm32: begin Info1Str := IntToHex(AEvent.Exception64.ExceptionRecord.ExceptionInformation[1], 16);
Info0 := AEvent.Exception.ExceptionRecord.ExceptionInformation[0]; {$endif}
Info1Str := IntToHex(AEvent.Exception.ExceptionRecord.ExceptionInformation[1], 8);
end;
end;
case Info0 of case Info0 of
0: begin 0: begin
@ -160,32 +157,29 @@ begin
WriteLN; WriteLN;
Write(' Info: '); Write(' Info: ');
case GMode of {$ifdef cpui386}
dm64: begin with AEvent.Exception.ExceptionRecord do
with AEvent.Exception64.ExceptionRecord do for n := Low(ExceptionInformation) to high(ExceptionInformation) do
for n := Low(ExceptionInformation) to high(ExceptionInformation) do begin
begin Write(IntToHex(ExceptionInformation[n], 8), ' ');
Write(IntToHex(ExceptionInformation[n], 16), ' '); if n and 7 = 7
if n and 3 = 3 then begin
then begin WriteLN;
WriteLN; Write(' ');
Write(' '); end;
end;
end;
end; end;
dm32: begin {$else}
with AEvent.Exception.ExceptionRecord do with AEvent.Exception64.ExceptionRecord do
for n := Low(ExceptionInformation) to high(ExceptionInformation) do for n := Low(ExceptionInformation) to high(ExceptionInformation) do
begin begin
Write(IntToHex(ExceptionInformation[n], 8), ' '); Write(IntToHex(ExceptionInformation[n], 16), ' ');
if n and 7 = 7 if n and 3 = 3
then begin then begin
WriteLN; WriteLN;
Write(' '); Write(' ');
end; end;
end;
end; end;
end; {$endif}
WriteLn; WriteLn;
GState := dsPause; GState := dsPause;
end; end;
@ -270,56 +264,54 @@ procedure DebugLoop;
if GCurrentThread = nil then Exit; if GCurrentThread = nil then Exit;
case GMode of {$ifdef cpui386}
dm64: begin with GCurrentContext do WriteLN(Format('DS: 0x%x, ES: 0x%x, FS: 0x%x, GS: 0x%x', [SegDs, SegEs, SegFs, SegGs]));
with GCurrentContext64 do WriteLN(Format('SegDS: 0x%4.4x, SegES: 0x%4.4x, SegFS: 0x%4.4x, SegGS: 0x%4.4x', [SegDs, SegEs, SegFs, SegGs])); with GCurrentContext do WriteLN(Format('EAX: 0x%x, EBX: 0x%x, ECX: 0x%x, EDX: 0x%x, EDI: 0x%x, ESI: 0x%x', [Eax, Ebx, Ecx, Edx, Edi, Esi]));
with GCurrentContext64 do WriteLN(Format('RAX: 0x%16.16x, RBX: 0x%16.16x, RCX: 0x%16.16x, RDX: 0x%16.16x, RDI: 0x%16.16x, RSI: 0x%16.16x, R9: 0x%16.16x, R10: 0x%16.16x, R11: 0x%16.16x, R12: 0x%16.16x, R13: 0x%16.16x, R14: 0x%16.16x, R15: 0x%16.16x', [Rax, Rbx, Rcx, Rdx, Rdi, Rsi, R9, R10, R11, R12, R13, R14, R15])); with GCurrentContext do WriteLN(Format('CS: 0x%x, SS: 0x%x, EBP: 0x%x, EIP: 0x%x, ESP: 0x%x, EFlags: 0x%x', [SegCs, SegSs, Ebp, Eip, Esp, EFlags]));
with GCurrentContext64 do WriteLN(Format('SegCS: 0x%4.4x, SegSS: 0x%4.4x, RBP: 0x%16.16x, RIP: 0x%16.16x, RSP: 0x%16.16x, EFlags: 0x%8.8x', [SegCs, SegSs, Rbp, Rip, Rsp, EFlags])); with GCurrentContext do
end; begin
dm32: begin Write(Format('DR0: 0x%x, DR1: 0x%x, DR2: 0x%x, DR3: 0x%x', [Dr0, Dr1, Dr2, Dr3]));
with GCurrentContext do WriteLN(Format('DS: 0x%x, ES: 0x%x, FS: 0x%x, GS: 0x%x', [SegDs, SegEs, SegFs, SegGs])); Write(' DR6: 0x', IntToHex(Dr6, 8), ' [');
with GCurrentContext do WriteLN(Format('EAX: 0x%x, EBX: 0x%x, ECX: 0x%x, EDX: 0x%x, EDI: 0x%x, ESI: 0x%x', [Eax, Ebx, Ecx, Edx, Edi, Esi])); if Dr6 and $0001 <> 0 then Write('B0 ');
with GCurrentContext do WriteLN(Format('CS: 0x%x, SS: 0x%x, EBP: 0x%x, EIP: 0x%x, ESP: 0x%x, EFlags: 0x%x', [SegCs, SegSs, Ebp, Eip, Esp, EFlags])); if Dr6 and $0002 <> 0 then Write('B1 ');
with GCurrentContext do begin if Dr6 and $0004 <> 0 then Write('B2 ');
Write(Format('DR0: 0x%x, DR1: 0x%x, DR2: 0x%x, DR3: 0x%x', [Dr0, Dr1, Dr2, Dr3])); if Dr6 and $0008 <> 0 then Write('B3 ');
Write(' DR6: 0x', IntToHex(Dr6, 8), ' ['); if Dr6 and $2000 <> 0 then Write('BD ');
if Dr6 and $0001 <> 0 then Write('B0 '); if Dr6 and $4000 <> 0 then Write('BS ');
if Dr6 and $0002 <> 0 then Write('B1 '); if Dr6 and $8000 <> 0 then Write('BT ');
if Dr6 and $0004 <> 0 then Write('B2 '); Write('] DR7: 0x', IntToHex(Dr7, 8), ' [');
if Dr6 and $0008 <> 0 then Write('B3 '); if Dr7 and $01 <> 0 then Write('L0 ');
if Dr6 and $2000 <> 0 then Write('BD '); if Dr7 and $02 <> 0 then Write('G0 ');
if Dr6 and $4000 <> 0 then Write('BS '); if Dr7 and $04 <> 0 then Write('L1 ');
if Dr6 and $8000 <> 0 then Write('BT '); if Dr7 and $08 <> 0 then Write('G1 ');
Write('] DR7: 0x', IntToHex(Dr7, 8), ' ['); if Dr7 and $10 <> 0 then Write('L2 ');
if Dr7 and $01 <> 0 then Write('L0 '); if Dr7 and $20 <> 0 then Write('G2 ');
if Dr7 and $02 <> 0 then Write('G0 '); if Dr7 and $40 <> 0 then Write('L3 ');
if Dr7 and $04 <> 0 then Write('L1 '); if Dr7 and $80 <> 0 then Write('G3 ');
if Dr7 and $08 <> 0 then Write('G1 '); if Dr7 and $100 <> 0 then Write('LE ');
if Dr7 and $10 <> 0 then Write('L2 '); if Dr7 and $200 <> 0 then Write('GE ');
if Dr7 and $20 <> 0 then Write('G2 '); if Dr7 and $2000 <> 0 then Write('GD ');
if Dr7 and $40 <> 0 then Write('L3 '); f := Dr7 shr 16;
if Dr7 and $80 <> 0 then Write('G3 '); for n := 0 to 3 do
if Dr7 and $100 <> 0 then Write('LE '); begin
if Dr7 and $200 <> 0 then Write('GE '); Write('R/W', n,':');
if Dr7 and $2000 <> 0 then Write('GD '); case f and 3 of
f := Dr7 shr 16; 0: Write('ex');
for n := 0 to 3 do 1: Write('wo');
begin 2: Write('IO');
Write('R/W', n,':'); 3: Write('rw');
case f and 3 of
0: Write('ex');
1: Write('wo');
2: Write('IO');
3: Write('rw');
end;
f := f shr 2;
Write(' LEN', n,':', f and 3 + 1, ' ');
f := f shr 2;
end;
WriteLN(']');
end; end;
f := f shr 2;
Write(' LEN', n,':', f and 3 + 1, ' ');
f := f shr 2;
end; end;
WriteLN(']');
end; end;
{$else}
with GCurrentContext do WriteLN(Format('SegDS: 0x%4.4x, SegES: 0x%4.4x, SegFS: 0x%4.4x, SegGS: 0x%4.4x', [SegDs, SegEs, SegFs, SegGs]));
with GCurrentContext do WriteLN(Format('RAX: 0x%16.16x, RBX: 0x%16.16x, RCX: 0x%16.16x, RDX: 0x%16.16x, RDI: 0x%16.16x, RSI: 0x%16.16x, R9: 0x%16.16x, R10: 0x%16.16x, R11: 0x%16.16x, R12: 0x%16.16x, R13: 0x%16.16x, R14: 0x%16.16x, R15: 0x%16.16x', [Rax, Rbx, Rcx, Rdx, Rdi, Rsi, R9, R10, R11, R12, R13, R14, R15]));
with GCurrentContext do WriteLN(Format('SegCS: 0x%4.4x, SegSS: 0x%4.4x, RBP: 0x%16.16x, RIP: 0x%16.16x, RSP: 0x%16.16x, EFlags: 0x%8.8x', [SegCs, SegSs, Rbp, Rip, Rsp, EFlags]));
{$endif}
WriteLN('---'); WriteLN('---');
end; end;
@ -356,17 +348,16 @@ begin
else WriteLN('LOOP: ID:', MDebugEvent.dwTHreadID, ' -> H:', GCurrentThread.Handle); else WriteLN('LOOP: ID:', MDebugEvent.dwTHreadID, ' -> H:', GCurrentThread.Handle);
end; end;
FillChar(GCurrentContext64, SizeOf(GCurrentContext64), $EE); FillChar(GCurrentContext, SizeOf(GCurrentContext), $EE);
if GCurrentThread <> nil if GCurrentThread <> nil
then begin then begin
// TODO: move to TDbgThread // TODO: move to TDbgThread
case GMode of {$ifdef cpui386}
dm64: GCurrentContext64.ContextFlags := CONTEXT_SEGMENTS_AMD64 or CONTEXT_INTEGER_AMD64 or CONTEXT_CONTROL_AMD64; GCurrentContext.ContextFlags := CONTEXT_SEGMENTS or CONTEXT_INTEGER or CONTEXT_CONTROL {or CONTEXT_DEBUG_REGISTERS};
dm32: GCurrentContext.ContextFlags := CONTEXT_SEGMENTS or CONTEXT_INTEGER or CONTEXT_CONTROL {or CONTEXT_DEBUG_REGISTERS}; {$else}
else GCurrentContext.ContextFlags := CONTEXT_SEGMENTS_AMD64 or CONTEXT_INTEGER_AMD64 or CONTEXT_CONTROL_AMD64;
WriteLN('LOOP: Unknown mode'); {$endif}
end;
SetLastError(0); SetLastError(0);
// SuspendTHread(GCurrentThread.Handle); // SuspendTHread(GCurrentThread.Handle);
if not GetThreadContext(GCurrentThread.Handle, GCurrentContext) if not GetThreadContext(GCurrentThread.Handle, GCurrentContext)

View File

@ -1,4 +1,4 @@
{ $Id: $ } { $Id $ }
{ {
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
fpwdtype.pas - FP standalone windows debugger - Type definitions fpwdtype.pas - FP standalone windows debugger - Type definitions
@ -44,9 +44,9 @@ interface
uses uses
Windows; Windows;
type //type
DWORD64 = QWORD; // DWORD64 = QWORD;
ULONGLONG = QWORD; // ULONGLONG = QWORD;
// LONGLONG = int64; // LONGLONG = int64;
//QWORD = type cardinal; //QWORD = type cardinal;

View File

@ -449,8 +449,13 @@ begin
Context.ContextFlags := CONTEXT_DEBUG_REGISTERS; Context.ContextFlags := CONTEXT_DEBUG_REGISTERS;
{$ifdef cpui386}
Context.Dr0 := Context.Eip; Context.Dr0 := Context.Eip;
Context.Dr7 := (Context.Dr7 and $FFF0FFFF) or $1; Context.Dr7 := (Context.Dr7 and $FFF0FFFF) or $1;
{$else}
Context.Dr0 := Context.Rip;
Context.Dr7 := (Context.Dr7 and $FFFFFFFFFFF0FFFF) or $1;
{$endif}
// Context.EFlags := Context.EFlags or $100; // Context.EFlags := Context.EFlags or $100;
@ -645,7 +650,11 @@ begin
end; end;
Context.ContextFlags := CONTEXT_CONTROL; Context.ContextFlags := CONTEXT_CONTROL;
{$ifdef cpui386}
Dec(Context.Eip); Dec(Context.Eip);
{$else}
Dec(Context.Rip);
{$endif}
if not SetThreadContext(Thread.Handle, Context) if not SetThreadContext(Thread.Handle, Context)
then begin then begin