mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-12-16 03:00:30 +01:00
* Moved Windows-specific code to read the instruction-pointer and base stack pointer register values to fpdbgwinclasses.pas
git-svn-id: trunk@44436 -
This commit is contained in:
parent
178cdf98b7
commit
eba8717294
@ -36,7 +36,11 @@ unit FPDCommand;
|
||||
interface
|
||||
|
||||
uses
|
||||
SysUtils, Classes, Windows, LCLProc, FpDbgWinExtra, FpDbgInfo, FpDbgClasses, DbgIntfBaseTypes;
|
||||
SysUtils, Classes,
|
||||
{$ifdef windows}
|
||||
Windows,
|
||||
{$endif}
|
||||
LCLProc, FpDbgInfo, FpDbgClasses, DbgIntfBaseTypes, FpDbgUtil;
|
||||
|
||||
procedure HandleCommand(ACommand: String);
|
||||
|
||||
@ -189,11 +193,7 @@ begin
|
||||
then begin
|
||||
// current addr
|
||||
P := '';
|
||||
{$ifdef cpui386}
|
||||
Address := GCurrentContext^.Eip;
|
||||
{$else}
|
||||
Address := GCurrentContext^.Rip;
|
||||
{$endif}
|
||||
Address := GCurrentProcess.GetInstructionPointerRegisterValue;
|
||||
end
|
||||
else begin
|
||||
P := GetPart([], [':'], S);
|
||||
@ -318,12 +318,8 @@ begin
|
||||
idx := 1;
|
||||
Count := 1;
|
||||
Size := 4;
|
||||
|
||||
{$ifdef cpui386}
|
||||
Address := GCurrentContext^.Eip;
|
||||
{$else}
|
||||
Address := GCurrentContext^.Rip;
|
||||
{$endif}
|
||||
|
||||
Address := GCurrentProcess.GetInstructionPointerRegisterValue;
|
||||
|
||||
if P[idx] <> ''
|
||||
then begin
|
||||
@ -485,15 +481,9 @@ begin
|
||||
Exit;
|
||||
end;
|
||||
|
||||
{$ifdef cpui386}
|
||||
Address := GCurrentContext^.Eip;
|
||||
Frame := GCurrentContext^.Ebp;
|
||||
Size := 4;
|
||||
{$else}
|
||||
Address := GCurrentContext^.Rip;
|
||||
Frame := GCurrentContext^.Rdi;
|
||||
Size := 8;
|
||||
{$endif}
|
||||
Address := GCurrentProcess.GetInstructionPointerRegisterValue;
|
||||
Frame := GCurrentProcess.GetStackBasePointerRegisterValue;;
|
||||
Size := sizeof(pointer);
|
||||
|
||||
WriteLN('Callstack:');
|
||||
WriteLn(' ', FormatAddress(Address));
|
||||
|
||||
@ -172,6 +172,9 @@ type
|
||||
|
||||
function WriteData(const AAdress: TDbgPtr; const ASize: Cardinal; const AData): Boolean; virtual;
|
||||
|
||||
function GetInstructionPointerRegisterValue: TDbgPtr; virtual; abstract;
|
||||
function GetStackBasePointerRegisterValue: TDbgPtr; virtual; abstract;
|
||||
|
||||
property Handle: THandle read GetHandle;
|
||||
property Name: String read FName write SetName;
|
||||
property ProcessID: integer read FProcessID;
|
||||
|
||||
@ -97,6 +97,9 @@ type
|
||||
function ResolveDebugEvent(AThread: TDbgThread): TFPDEvent; override;
|
||||
procedure StartProcess(const AInfo: TCreateProcessDebugInfo);
|
||||
|
||||
function GetInstructionPointerRegisterValue: TDbgPtr; override;
|
||||
function GetStackBasePointerRegisterValue: TDbgPtr; override;
|
||||
|
||||
function AddrOffset: Int64; override;
|
||||
function AddLib(const AInfo: TLoadDLLDebugInfo): TDbgLibrary;
|
||||
procedure AddThread(const AID: Integer; const AInfo: TCreateThreadDebugInfo);
|
||||
@ -831,6 +834,24 @@ begin
|
||||
FMainThread := OSDbgClasses.DbgThreadClass.Create(Self, ThreadID, AInfo.hThread, AInfo.lpThreadLocalBase, AInfo.lpStartAddress);
|
||||
end;
|
||||
|
||||
function TDbgWinProcess.GetInstructionPointerRegisterValue: TDbgPtr;
|
||||
begin
|
||||
{$ifdef cpui386}
|
||||
Result := GCurrentContext^.Eip;
|
||||
{$else}
|
||||
Result := GCurrentContext^.Rip;
|
||||
{$endif}
|
||||
end;
|
||||
|
||||
function TDbgWinProcess.GetStackBasePointerRegisterValue: TDbgPtr;
|
||||
begin
|
||||
{$ifdef cpui386}
|
||||
Result := GCurrentContext^.Ebp;
|
||||
{$else}
|
||||
Result := GCurrentContext^.Rdi;
|
||||
{$endif}
|
||||
end;
|
||||
|
||||
function TDbgWinProcess.AddrOffset: Int64;
|
||||
begin
|
||||
Result:=inherited AddrOffset - TDbgPtr(FInfo.lpBaseOfImage);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user