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

View File

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

View File

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

View File

@ -1,4 +1,4 @@
{ $Id: $ }
{ $Id $ }
{
---------------------------------------------------------------------------
fpwdloop.pas - FP standalone windows debugger - Debugger main loop
@ -117,35 +117,32 @@ begin
else
Write(' Unknown code: ', AEvent.Exception.ExceptionRecord.ExceptionCode);
end;
case GMode of
dm64: Info0 := AEvent.Exception64.ExceptionRecord.ExceptionAddress;
dm32: Info0 := Cardinal(AEvent.Exception.ExceptionRecord.ExceptionAddress);
else
Info0 := 0;
end;
{$ifdef cpui386}
Info0 := Cardinal(AEvent.Exception.ExceptionRecord.ExceptionAddress);
{$else}
Info0 := AEvent.Exception64.ExceptionRecord.ExceptionAddress;
{$endif}
Write(' at: ', FormatAdress(Info0));
Write(' Flags:', Format('%x', [AEvent.Exception.ExceptionRecord.ExceptionFlags]), ' [');
if AEvent.Exception.ExceptionRecord.ExceptionFlags = 0
then Write('Continuable')
else Write('Not continuable');
Write(']');
case GMode of
dm64: Write(' ParamCount:', AEvent.Exception64.ExceptionRecord.NumberParameters);
dm32: Write(' ParamCount:', AEvent.Exception.ExceptionRecord.NumberParameters);
end;
{$ifdef cpui386}
Write(' ParamCount:', AEvent.Exception.ExceptionRecord.NumberParameters);
{$else}
Write(' ParamCount:', AEvent.Exception64.ExceptionRecord.NumberParameters);
{$endif}
case AEvent.Exception.ExceptionRecord.ExceptionCode of
EXCEPTION_ACCESS_VIOLATION: begin
case GMode of
dm64: begin
Info0 := AEvent.Exception64.ExceptionRecord.ExceptionInformation[0];
Info1Str := IntToHex(AEvent.Exception64.ExceptionRecord.ExceptionInformation[1], 16);
end;
dm32: begin
Info0 := AEvent.Exception.ExceptionRecord.ExceptionInformation[0];
Info1Str := IntToHex(AEvent.Exception.ExceptionRecord.ExceptionInformation[1], 8);
end;
end;
{$ifdef cpui386}
Info0 := AEvent.Exception.ExceptionRecord.ExceptionInformation[0];
Info1Str := IntToHex(AEvent.Exception.ExceptionRecord.ExceptionInformation[1], 8);
{$else}
Info0 := AEvent.Exception64.ExceptionRecord.ExceptionInformation[0];
Info1Str := IntToHex(AEvent.Exception64.ExceptionRecord.ExceptionInformation[1], 16);
{$endif}
case Info0 of
0: begin
@ -160,32 +157,29 @@ begin
WriteLN;
Write(' Info: ');
case GMode of
dm64: begin
with AEvent.Exception64.ExceptionRecord do
for n := Low(ExceptionInformation) to high(ExceptionInformation) do
begin
Write(IntToHex(ExceptionInformation[n], 16), ' ');
if n and 3 = 3
then begin
WriteLN;
Write(' ');
end;
end;
{$ifdef cpui386}
with AEvent.Exception.ExceptionRecord do
for n := Low(ExceptionInformation) to high(ExceptionInformation) do
begin
Write(IntToHex(ExceptionInformation[n], 8), ' ');
if n and 7 = 7
then begin
WriteLN;
Write(' ');
end;
end;
dm32: begin
with AEvent.Exception.ExceptionRecord do
for n := Low(ExceptionInformation) to high(ExceptionInformation) do
begin
Write(IntToHex(ExceptionInformation[n], 8), ' ');
if n and 7 = 7
then begin
WriteLN;
Write(' ');
end;
end;
{$else}
with AEvent.Exception64.ExceptionRecord do
for n := Low(ExceptionInformation) to high(ExceptionInformation) do
begin
Write(IntToHex(ExceptionInformation[n], 16), ' ');
if n and 3 = 3
then begin
WriteLN;
Write(' ');
end;
end;
end;
{$endif}
WriteLn;
GState := dsPause;
end;
@ -270,56 +264,54 @@ procedure DebugLoop;
if GCurrentThread = nil then Exit;
case GMode of
dm64: begin
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 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 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]));
end;
dm32: begin
with GCurrentContext do WriteLN(Format('DS: 0x%x, ES: 0x%x, FS: 0x%x, GS: 0x%x', [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 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 GCurrentContext do begin
Write(Format('DR0: 0x%x, DR1: 0x%x, DR2: 0x%x, DR3: 0x%x', [Dr0, Dr1, Dr2, Dr3]));
Write(' DR6: 0x', IntToHex(Dr6, 8), ' [');
if Dr6 and $0001 <> 0 then Write('B0 ');
if Dr6 and $0002 <> 0 then Write('B1 ');
if Dr6 and $0004 <> 0 then Write('B2 ');
if Dr6 and $0008 <> 0 then Write('B3 ');
if Dr6 and $2000 <> 0 then Write('BD ');
if Dr6 and $4000 <> 0 then Write('BS ');
if Dr6 and $8000 <> 0 then Write('BT ');
Write('] DR7: 0x', IntToHex(Dr7, 8), ' [');
if Dr7 and $01 <> 0 then Write('L0 ');
if Dr7 and $02 <> 0 then Write('G0 ');
if Dr7 and $04 <> 0 then Write('L1 ');
if Dr7 and $08 <> 0 then Write('G1 ');
if Dr7 and $10 <> 0 then Write('L2 ');
if Dr7 and $20 <> 0 then Write('G2 ');
if Dr7 and $40 <> 0 then Write('L3 ');
if Dr7 and $80 <> 0 then Write('G3 ');
if Dr7 and $100 <> 0 then Write('LE ');
if Dr7 and $200 <> 0 then Write('GE ');
if Dr7 and $2000 <> 0 then Write('GD ');
f := Dr7 shr 16;
for n := 0 to 3 do
begin
Write('R/W', n,':');
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(']');
{$ifdef cpui386}
with GCurrentContext do WriteLN(Format('DS: 0x%x, ES: 0x%x, FS: 0x%x, GS: 0x%x', [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 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 GCurrentContext do
begin
Write(Format('DR0: 0x%x, DR1: 0x%x, DR2: 0x%x, DR3: 0x%x', [Dr0, Dr1, Dr2, Dr3]));
Write(' DR6: 0x', IntToHex(Dr6, 8), ' [');
if Dr6 and $0001 <> 0 then Write('B0 ');
if Dr6 and $0002 <> 0 then Write('B1 ');
if Dr6 and $0004 <> 0 then Write('B2 ');
if Dr6 and $0008 <> 0 then Write('B3 ');
if Dr6 and $2000 <> 0 then Write('BD ');
if Dr6 and $4000 <> 0 then Write('BS ');
if Dr6 and $8000 <> 0 then Write('BT ');
Write('] DR7: 0x', IntToHex(Dr7, 8), ' [');
if Dr7 and $01 <> 0 then Write('L0 ');
if Dr7 and $02 <> 0 then Write('G0 ');
if Dr7 and $04 <> 0 then Write('L1 ');
if Dr7 and $08 <> 0 then Write('G1 ');
if Dr7 and $10 <> 0 then Write('L2 ');
if Dr7 and $20 <> 0 then Write('G2 ');
if Dr7 and $40 <> 0 then Write('L3 ');
if Dr7 and $80 <> 0 then Write('G3 ');
if Dr7 and $100 <> 0 then Write('LE ');
if Dr7 and $200 <> 0 then Write('GE ');
if Dr7 and $2000 <> 0 then Write('GD ');
f := Dr7 shr 16;
for n := 0 to 3 do
begin
Write('R/W', n,':');
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;
{$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('---');
end;
@ -356,17 +348,16 @@ begin
else WriteLN('LOOP: ID:', MDebugEvent.dwTHreadID, ' -> H:', GCurrentThread.Handle);
end;
FillChar(GCurrentContext64, SizeOf(GCurrentContext64), $EE);
FillChar(GCurrentContext, SizeOf(GCurrentContext), $EE);
if GCurrentThread <> nil
then begin
// TODO: move to TDbgThread
case GMode of
dm64: GCurrentContext64.ContextFlags := CONTEXT_SEGMENTS_AMD64 or CONTEXT_INTEGER_AMD64 or CONTEXT_CONTROL_AMD64;
dm32: GCurrentContext.ContextFlags := CONTEXT_SEGMENTS or CONTEXT_INTEGER or CONTEXT_CONTROL {or CONTEXT_DEBUG_REGISTERS};
else
WriteLN('LOOP: Unknown mode');
end;
{$ifdef cpui386}
GCurrentContext.ContextFlags := CONTEXT_SEGMENTS or CONTEXT_INTEGER or CONTEXT_CONTROL {or CONTEXT_DEBUG_REGISTERS};
{$else}
GCurrentContext.ContextFlags := CONTEXT_SEGMENTS_AMD64 or CONTEXT_INTEGER_AMD64 or CONTEXT_CONTROL_AMD64;
{$endif}
SetLastError(0);
// SuspendTHread(GCurrentThread.Handle);
if not GetThreadContext(GCurrentThread.Handle, GCurrentContext)

View File

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

View File

@ -449,8 +449,13 @@ begin
Context.ContextFlags := CONTEXT_DEBUG_REGISTERS;
{$ifdef cpui386}
Context.Dr0 := Context.Eip;
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;
@ -645,7 +650,11 @@ begin
end;
Context.ContextFlags := CONTEXT_CONTROL;
{$ifdef cpui386}
Dec(Context.Eip);
{$else}
Dec(Context.Rip);
{$endif}
if not SetThreadContext(Thread.Handle, Context)
then begin