mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-22 12:59:26 +02:00
Renamed TDbgDisassembler class and all related classes to avoid name clashes with FpDebugDebugger classes.
Patch/Contributed by ccrause git-svn-id: trunk@62757 -
This commit is contained in:
parent
147cf21fef
commit
62facbb44d
@ -950,5 +950,5 @@ initialization
|
||||
RegisterDbgOsClasses(TOSDbgClasses.Create(
|
||||
TDbgAvrProcess,
|
||||
TDbgAvrThread,
|
||||
TAvrDisassembler));
|
||||
TAvrAsmDecoder));
|
||||
end.
|
||||
|
@ -397,9 +397,9 @@ type
|
||||
TStartInstanceFlag = (siRediretOutput, siForceNewConsole);
|
||||
TStartInstanceFlags = set of TStartInstanceFlag;
|
||||
|
||||
{ TDbgDisassemblerInstruction }
|
||||
{ TDbgAsmInstruction }
|
||||
|
||||
TDbgDisassemblerInstruction = class(TRefCountedObject)
|
||||
TDbgAsmInstruction = class(TRefCountedObject)
|
||||
public
|
||||
// returns byte len of call instruction at AAddress // 0 if not a call intruction
|
||||
function IsCallInstruction: boolean; virtual;
|
||||
@ -408,9 +408,9 @@ type
|
||||
function InstructionLength: Integer; virtual;
|
||||
end;
|
||||
|
||||
{ TDbgDisassembler }
|
||||
{ TDbgAsmDecoder }
|
||||
|
||||
TDbgDisassembler = class
|
||||
TDbgAsmDecoder = class
|
||||
protected
|
||||
function GetLastErrorWasMemReadErr: Boolean; virtual;
|
||||
function GetMaxInstrSize: integer; virtual; abstract;
|
||||
@ -422,7 +422,7 @@ type
|
||||
procedure Disassemble(var AAddress: Pointer; out ACodeBytes: String; out ACode: String); virtual; abstract;
|
||||
procedure ReverseDisassemble(var AAddress: Pointer; out ACodeBytes: String; out ACode: String); virtual;
|
||||
|
||||
function GetInstructionInfo(AnAddress: TDBGPtr): TDbgDisassemblerInstruction; virtual; abstract;
|
||||
function GetInstructionInfo(AnAddress: TDBGPtr): TDbgAsmInstruction; virtual; abstract;
|
||||
function GetFunctionFrameInfo(AnAddress: TDBGPtr; out AnIsOutsideFrame: Boolean): Boolean; virtual;
|
||||
|
||||
property LastErrorWasMemReadErr: Boolean read GetLastErrorWasMemReadErr;
|
||||
@ -430,7 +430,7 @@ type
|
||||
property MinInstructionSize: integer read GetMinInstrSize; // abstract
|
||||
property CanReverseDisassemble: boolean read GetCanReverseDisassemble;
|
||||
end;
|
||||
TDbgDisassemblerClass = class of TDbgDisassembler;
|
||||
TDbgDisassemblerClass = class of TDbgAsmDecoder;
|
||||
|
||||
{ TDbgProcess }
|
||||
|
||||
@ -438,7 +438,7 @@ type
|
||||
protected const
|
||||
Int3: Byte = $CC;
|
||||
private
|
||||
FDisassembler: TDbgDisassembler;
|
||||
FDisassembler: TDbgAsmDecoder;
|
||||
FExceptionClass: string;
|
||||
FExceptionMessage: string;
|
||||
FExitCode: DWord;
|
||||
@ -449,7 +449,7 @@ type
|
||||
FThreadID: Integer;
|
||||
FWatchPointData: TFpWatchPointData;
|
||||
|
||||
function GetDisassembler: TDbgDisassembler;
|
||||
function GetDisassembler: TDbgAsmDecoder;
|
||||
function GetLastLibraryLoaded: TDbgLibrary;
|
||||
function GetPauseRequested: boolean;
|
||||
procedure SetPauseRequested(AValue: boolean);
|
||||
@ -580,7 +580,7 @@ public
|
||||
property LastEventProcessIdentifier: THandle read GetLastEventProcessIdentifier;
|
||||
property MainThread: TDbgThread read FMainThread;
|
||||
property GotExitProcess: Boolean read FGotExitProcess write FGotExitProcess;
|
||||
property Disassembler: TDbgDisassembler read GetDisassembler;
|
||||
property Disassembler: TDbgAsmDecoder read GetDisassembler;
|
||||
end;
|
||||
TDbgProcessClass = class of TDbgProcess;
|
||||
|
||||
@ -1277,36 +1277,36 @@ begin
|
||||
SetValue(ANumValue, trim(FlagS),4,Cardinal(-1));
|
||||
end;
|
||||
|
||||
{ TDbgDisassemblerInstruction }
|
||||
{ TDbgAsmInstruction }
|
||||
|
||||
function TDbgDisassemblerInstruction.IsCallInstruction: boolean;
|
||||
function TDbgAsmInstruction.IsCallInstruction: boolean;
|
||||
begin
|
||||
Result := False;
|
||||
end;
|
||||
|
||||
function TDbgDisassemblerInstruction.IsReturnInstruction: boolean;
|
||||
function TDbgAsmInstruction.IsReturnInstruction: boolean;
|
||||
begin
|
||||
Result := False;
|
||||
end;
|
||||
|
||||
function TDbgDisassemblerInstruction.IsLeaveStackFrame: boolean;
|
||||
function TDbgAsmInstruction.IsLeaveStackFrame: boolean;
|
||||
begin
|
||||
Result := False;
|
||||
end;
|
||||
|
||||
function TDbgDisassemblerInstruction.InstructionLength: Integer;
|
||||
function TDbgAsmInstruction.InstructionLength: Integer;
|
||||
begin
|
||||
Result := 0;
|
||||
end;
|
||||
|
||||
{ TDbgDisassembler }
|
||||
{ TDbgAsmDecoder }
|
||||
|
||||
function TDbgDisassembler.GetLastErrorWasMemReadErr: Boolean;
|
||||
function TDbgAsmDecoder.GetLastErrorWasMemReadErr: Boolean;
|
||||
begin
|
||||
Result := False;
|
||||
end;
|
||||
|
||||
function TDbgDisassembler.GetCanReverseDisassemble: boolean;
|
||||
function TDbgAsmDecoder.GetCanReverseDisassemble: boolean;
|
||||
begin
|
||||
Result := false;
|
||||
end;
|
||||
@ -1316,7 +1316,7 @@ end;
|
||||
// If not decrease instruction size and try again.
|
||||
// Many pitfalls with X86 instruction encoding...
|
||||
// Avr may give 130/65535 = 0.2% errors per instruction reverse decoded
|
||||
procedure TDbgDisassembler.ReverseDisassemble(var AAddress: Pointer; out
|
||||
procedure TDbgAsmDecoder.ReverseDisassemble(var AAddress: Pointer; out
|
||||
ACodeBytes: String; out ACode: String);
|
||||
var
|
||||
i, instrLen: integer;
|
||||
@ -1335,7 +1335,7 @@ begin
|
||||
AAddress := AAddress - instrLen;
|
||||
end;
|
||||
|
||||
function TDbgDisassembler.GetFunctionFrameInfo(AnAddress: TDBGPtr; out
|
||||
function TDbgAsmDecoder.GetFunctionFrameInfo(AnAddress: TDBGPtr; out
|
||||
AnIsOutsideFrame: Boolean): Boolean;
|
||||
begin
|
||||
Result := False;
|
||||
@ -1957,7 +1957,7 @@ begin
|
||||
Result := FLibMap.LastLibraryAdded;
|
||||
end;
|
||||
|
||||
function TDbgProcess.GetDisassembler: TDbgDisassembler;
|
||||
function TDbgProcess.GetDisassembler: TDbgAsmDecoder;
|
||||
begin
|
||||
if FDisassembler = nil then
|
||||
FDisassembler := OSDbgClasses.DbgDisassemblerClass.Create(Self);
|
||||
|
@ -39,7 +39,7 @@ type
|
||||
FProcess: TDbgProcess;
|
||||
FThreadRemoved: boolean;
|
||||
FIsInitialized: Boolean;
|
||||
FNextInstruction: TDbgDisassemblerInstruction;
|
||||
FNextInstruction: TDbgAsmInstruction;
|
||||
procedure Init; virtual;
|
||||
procedure DoResolveEvent(var AnEvent: TFPDEvent; AnEventThread: TDbgThread; out Finished: boolean); virtual; abstract;
|
||||
public
|
||||
@ -48,7 +48,7 @@ type
|
||||
procedure DoBeforeLoopStart;
|
||||
procedure DoContinue(AProcess: TDbgProcess; AThread: TDbgThread); virtual; abstract;
|
||||
procedure ResolveEvent(var AnEvent: TFPDEvent; AnEventThread: TDbgThread; out Finished: boolean);
|
||||
function NextInstruction: TDbgDisassemblerInstruction; inline;
|
||||
function NextInstruction: TDbgAsmInstruction; inline;
|
||||
property Thread: TDbgThread read FThread write SetThread;
|
||||
end;
|
||||
|
||||
@ -342,7 +342,7 @@ begin
|
||||
DoResolveEvent(AnEvent, AnEventThread, Finished);
|
||||
end;
|
||||
|
||||
function TDbgControllerCmd.NextInstruction: TDbgDisassemblerInstruction;
|
||||
function TDbgControllerCmd.NextInstruction: TDbgAsmInstruction;
|
||||
begin
|
||||
if FNextInstruction = nil then begin
|
||||
FNextInstruction := FProcess.Disassembler.GetInstructionInfo(FThread.GetInstructionPointerRegisterValue);
|
||||
|
@ -967,7 +967,7 @@ initialization
|
||||
RegisterDbgOsClasses(TOSDbgClasses.Create(
|
||||
TDbgDarwinProcess,
|
||||
TDbgDarwinThread,
|
||||
TX86Disassembler
|
||||
TX86AsmDecoder
|
||||
));
|
||||
|
||||
end.
|
||||
|
@ -44,17 +44,17 @@ type
|
||||
//The function Disassemble decodes the instruction at the given address.
|
||||
//Unrecognized instructions are assumed to be data statements [dw XXXX]
|
||||
|
||||
TAvrDisassembler = class;
|
||||
TAvrAsmDecoder = class;
|
||||
|
||||
{ TX86DisassemblerInstruction }
|
||||
|
||||
{ TAvrDisassemblerInstruction }
|
||||
{ TAvrAsmInstruction }
|
||||
|
||||
TAvrDisassemblerInstruction = class(TDbgDisassemblerInstruction)
|
||||
TAvrAsmInstruction = class(TDbgAsmInstruction)
|
||||
private const
|
||||
INSTR_CODEBIN_LEN = 4;
|
||||
private
|
||||
FDisassembler: TAvrDisassembler;
|
||||
FAsmDecoder: TAvrAsmDecoder;
|
||||
FAddress: TDBGPtr;
|
||||
FCodeBin: array[0..INSTR_CODEBIN_LEN-1] of byte;
|
||||
FInstrLen: Integer;
|
||||
@ -62,7 +62,7 @@ type
|
||||
protected
|
||||
procedure ReadCode; inline;
|
||||
public
|
||||
constructor Create(ADisassembler: TAvrDisassembler);
|
||||
constructor Create(AAsmDecoder: TAvrAsmDecoder);
|
||||
procedure SetAddress(AnAddress: TDBGPtr);
|
||||
function IsCallInstruction: boolean; override;
|
||||
function IsReturnInstruction: boolean; override;
|
||||
@ -70,13 +70,13 @@ type
|
||||
function InstructionLength: Integer; override;
|
||||
end;
|
||||
|
||||
{ TAvrDisassembler }
|
||||
{ TAvrAsmDecoder }
|
||||
|
||||
TAvrDisassembler = class(TDbgDisassembler)
|
||||
TAvrAsmDecoder = class(TDbgAsmDecoder)
|
||||
private
|
||||
FProcess: TDbgProcess;
|
||||
FLastErrWasMem: Boolean;
|
||||
FLastInstr: TAvrDisassemblerInstruction;
|
||||
FLastInstr: TAvrAsmInstruction;
|
||||
protected
|
||||
function GetLastErrorWasMemReadErr: Boolean; override;
|
||||
function GetMaxInstrSize: integer; override;
|
||||
@ -84,7 +84,7 @@ type
|
||||
function GetCanReverseDisassemble: boolean; override;
|
||||
|
||||
procedure Disassemble(var AAddress: Pointer; out ACodeBytes: String; out ACode: String); override;
|
||||
function GetInstructionInfo(AnAddress: TDBGPtr): TDbgDisassemblerInstruction; override;
|
||||
function GetInstructionInfo(AnAddress: TDBGPtr): TDbgAsmInstruction; override;
|
||||
|
||||
// returns byte len of call instruction at AAddress // 0 if not a call intruction
|
||||
function GetFunctionFrameInfo(AnAddress: TDBGPtr; out
|
||||
@ -145,31 +145,31 @@ begin
|
||||
result := format(opConstHex16, ['dw', instr]);
|
||||
end;
|
||||
|
||||
{ TAvrDisassemblerInstruction }
|
||||
{ TAvrAsmInstruction }
|
||||
|
||||
procedure TAvrDisassemblerInstruction.ReadCode;
|
||||
procedure TAvrAsmInstruction.ReadCode;
|
||||
begin
|
||||
if not (diCodeRead in FFlags) then begin
|
||||
if not FDisassembler.FProcess.ReadData(FAddress, INSTR_CODEBIN_LEN, FCodeBin) then
|
||||
if not FAsmDecoder.FProcess.ReadData(FAddress, INSTR_CODEBIN_LEN, FCodeBin) then
|
||||
Include(FFlags, diCodeReadError);
|
||||
Include(FFlags, diCodeRead);
|
||||
end;
|
||||
end;
|
||||
|
||||
constructor TAvrDisassemblerInstruction.Create(ADisassembler: TAvrDisassembler);
|
||||
constructor TAvrAsmInstruction.Create(AAsmDecoder: TAvrAsmDecoder);
|
||||
begin
|
||||
FDisassembler := ADisassembler;
|
||||
FAsmDecoder := AAsmDecoder;
|
||||
inherited Create;
|
||||
AddReference;
|
||||
end;
|
||||
|
||||
procedure TAvrDisassemblerInstruction.SetAddress(AnAddress: TDBGPtr);
|
||||
procedure TAvrAsmInstruction.SetAddress(AnAddress: TDBGPtr);
|
||||
begin
|
||||
FAddress := AnAddress;
|
||||
FFlags := [];
|
||||
end;
|
||||
|
||||
function TAvrDisassemblerInstruction.IsCallInstruction: boolean;
|
||||
function TAvrAsmInstruction.IsCallInstruction: boolean;
|
||||
var
|
||||
LoByte, HiByte: byte;
|
||||
begin
|
||||
@ -183,7 +183,7 @@ begin
|
||||
Result := true;
|
||||
end;
|
||||
|
||||
function TAvrDisassemblerInstruction.IsReturnInstruction: boolean;
|
||||
function TAvrAsmInstruction.IsReturnInstruction: boolean;
|
||||
var
|
||||
LoByte, HiByte: byte;
|
||||
begin
|
||||
@ -195,12 +195,12 @@ begin
|
||||
Result := true;
|
||||
end;
|
||||
|
||||
function TAvrDisassemblerInstruction.IsLeaveStackFrame: boolean;
|
||||
function TAvrAsmInstruction.IsLeaveStackFrame: boolean;
|
||||
begin
|
||||
Result := false;
|
||||
end;
|
||||
|
||||
function TAvrDisassemblerInstruction.InstructionLength: Integer;
|
||||
function TAvrAsmInstruction.InstructionLength: Integer;
|
||||
var
|
||||
LoByte, HiByte: byte;
|
||||
begin
|
||||
@ -213,27 +213,27 @@ begin
|
||||
Result := 4;
|
||||
end;
|
||||
|
||||
function TAvrDisassembler.GetLastErrorWasMemReadErr: Boolean;
|
||||
function TAvrAsmDecoder.GetLastErrorWasMemReadErr: Boolean;
|
||||
begin
|
||||
Result := FLastErrWasMem;
|
||||
end;
|
||||
|
||||
function TAvrDisassembler.GetMaxInstrSize: integer;
|
||||
function TAvrAsmDecoder.GetMaxInstrSize: integer;
|
||||
begin
|
||||
Result := 4;
|
||||
end;
|
||||
|
||||
function TAvrDisassembler.GetMinInstrSize: integer;
|
||||
function TAvrAsmDecoder.GetMinInstrSize: integer;
|
||||
begin
|
||||
Result := 2;
|
||||
end;
|
||||
|
||||
function TAvrDisassembler.GetCanReverseDisassemble: boolean;
|
||||
function TAvrAsmDecoder.GetCanReverseDisassemble: boolean;
|
||||
begin
|
||||
Result := true;
|
||||
end;
|
||||
|
||||
procedure TAvrDisassembler.Disassemble(var AAddress: Pointer; out
|
||||
procedure TAvrAsmDecoder.Disassemble(var AAddress: Pointer; out
|
||||
ACodeBytes: String; out ACode: String);
|
||||
var
|
||||
CodeIdx, r, d, k, q: byte;
|
||||
@ -836,30 +836,30 @@ begin
|
||||
Inc(AAddress, CodeIdx);
|
||||
end;
|
||||
|
||||
function TAvrDisassembler.GetInstructionInfo(AnAddress: TDBGPtr
|
||||
): TDbgDisassemblerInstruction;
|
||||
function TAvrAsmDecoder.GetInstructionInfo(AnAddress: TDBGPtr
|
||||
): TDbgAsmInstruction;
|
||||
begin
|
||||
if (FLastInstr = nil) or (FLastInstr.RefCount > 1) then begin
|
||||
ReleaseRefAndNil(FLastInstr);
|
||||
FLastInstr := TAvrDisassemblerInstruction.Create(Self);
|
||||
FLastInstr := TAvrAsmInstruction.Create(Self);
|
||||
end;
|
||||
|
||||
FLastInstr.SetAddress(AnAddress);
|
||||
Result := FLastInstr;
|
||||
end;
|
||||
|
||||
function TAvrDisassembler.GetFunctionFrameInfo(AnAddress: TDBGPtr; out
|
||||
function TAvrAsmDecoder.GetFunctionFrameInfo(AnAddress: TDBGPtr; out
|
||||
AnIsOutsideFrame: Boolean): Boolean;
|
||||
begin
|
||||
result := false;
|
||||
end;
|
||||
|
||||
constructor TAvrDisassembler.Create(AProcess: TDbgProcess);
|
||||
constructor TAvrAsmDecoder.Create(AProcess: TDbgProcess);
|
||||
begin
|
||||
FProcess := AProcess;
|
||||
end;
|
||||
|
||||
destructor TAvrDisassembler.Destroy;
|
||||
destructor TAvrAsmDecoder.Destroy;
|
||||
begin
|
||||
ReleaseRefAndNil(FLastInstr);
|
||||
inherited Destroy;
|
||||
|
@ -201,15 +201,15 @@ type
|
||||
ParseFlags: TFlags;
|
||||
end;
|
||||
|
||||
TX86Disassembler = class;
|
||||
TX86AsmDecoder = class;
|
||||
|
||||
{ TX86DisassemblerInstruction }
|
||||
{ TX86AsmInstruction }
|
||||
|
||||
TX86DisassemblerInstruction = class(TDbgDisassemblerInstruction)
|
||||
TX86AsmInstruction = class(TDbgAsmInstruction)
|
||||
const
|
||||
INSTR_CODEBIN_LEN = 16;
|
||||
private
|
||||
FDisassembler: TX86Disassembler;
|
||||
FAsmDecoder: TX86AsmDecoder;
|
||||
FAddress: TDBGPtr;
|
||||
FCodeBin: array[0..INSTR_CODEBIN_LEN-1] of byte;
|
||||
FInstruction: TInstruction;
|
||||
@ -219,7 +219,7 @@ type
|
||||
procedure ReadCode; inline;
|
||||
procedure Disassemble; inline;
|
||||
public
|
||||
constructor Create(ADisassembler: TX86Disassembler);
|
||||
constructor Create(AAsmDecoder: TX86AsmDecoder);
|
||||
procedure SetAddress(AnAddress: TDBGPtr);
|
||||
function IsCallInstruction: boolean; override;
|
||||
function IsReturnInstruction: boolean; override;
|
||||
@ -229,9 +229,9 @@ type
|
||||
property X86Instruction: TInstruction read FInstruction; // only valid after call to X86OpCode
|
||||
end;
|
||||
|
||||
{ TX86Disassembler }
|
||||
{ TX86AsmDecoder }
|
||||
|
||||
TX86Disassembler = class(TDBGDisassembler)
|
||||
TX86AsmDecoder = class(TDbgAsmDecoder)
|
||||
private const
|
||||
MAX_CODEBIN_LEN = 50;
|
||||
FMaxInstructionSize = 16;
|
||||
@ -240,7 +240,7 @@ type
|
||||
FProcess: TDbgProcess;
|
||||
FLastErrWasMem: Boolean;
|
||||
FCodeBin: array[0..MAX_CODEBIN_LEN-1] of byte;
|
||||
FLastInstr: TX86DisassemblerInstruction;
|
||||
FLastInstr: TX86AsmInstruction;
|
||||
protected
|
||||
function GetLastErrorWasMemReadErr: Boolean; override;
|
||||
function GetMaxInstrSize: integer; override;
|
||||
@ -253,7 +253,7 @@ type
|
||||
destructor Destroy; override;
|
||||
|
||||
procedure Disassemble(var AAddress: Pointer; out ACodeBytes: String; out ACode: String); override;
|
||||
function GetInstructionInfo(AnAddress: TDBGPtr): TDbgDisassemblerInstruction; override;
|
||||
function GetInstructionInfo(AnAddress: TDBGPtr): TDbgAsmInstruction; override;
|
||||
|
||||
function GetFunctionFrameInfo(AnAddress: TDBGPtr; out
|
||||
AnIsOutsideFrame: Boolean): Boolean; override;
|
||||
@ -372,44 +372,44 @@ const
|
||||
'o', 'no', 'b', 'nb', 'z', 'nz', 'be', 'nbe', 's', 'ns', 'p', 'np', 'l', 'nl', 'le', 'nle'
|
||||
);
|
||||
|
||||
{ TX86DisassemblerInstruction }
|
||||
{ TX86AsmInstruction }
|
||||
|
||||
procedure TX86DisassemblerInstruction.ReadCode;
|
||||
procedure TX86AsmInstruction.ReadCode;
|
||||
begin
|
||||
if not (diCodeRead in FFlags) then begin
|
||||
if not FDisassembler.FProcess.ReadData(FAddress, INSTR_CODEBIN_LEN, FCodeBin) then
|
||||
if not FAsmDecoder.FProcess.ReadData(FAddress, INSTR_CODEBIN_LEN, FCodeBin) then
|
||||
Include(FFlags, diCodeReadError);
|
||||
Include(FFlags, diCodeRead);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TX86DisassemblerInstruction.Disassemble;
|
||||
procedure TX86AsmInstruction.Disassemble;
|
||||
var
|
||||
a: PByte;
|
||||
begin
|
||||
if not (diDisAss in FFlags) then begin
|
||||
ReadCode;
|
||||
a := @FCodeBin[0];
|
||||
FDisassembler.Disassemble(a, FInstruction);
|
||||
FAsmDecoder.Disassemble(a, FInstruction);
|
||||
FInstrLen := a - @FCodeBin[0];
|
||||
Include(FFlags, diDisAss);
|
||||
end;
|
||||
end;
|
||||
|
||||
constructor TX86DisassemblerInstruction.Create(ADisassembler: TX86Disassembler);
|
||||
constructor TX86AsmInstruction.Create(AAsmDecoder: TX86AsmDecoder);
|
||||
begin
|
||||
FDisassembler := ADisassembler;
|
||||
FAsmDecoder := AAsmDecoder;
|
||||
inherited Create;
|
||||
AddReference;
|
||||
end;
|
||||
|
||||
procedure TX86DisassemblerInstruction.SetAddress(AnAddress: TDBGPtr);
|
||||
procedure TX86AsmInstruction.SetAddress(AnAddress: TDBGPtr);
|
||||
begin
|
||||
FAddress := AnAddress;
|
||||
FFlags := [];
|
||||
end;
|
||||
|
||||
function TX86DisassemblerInstruction.IsCallInstruction: boolean;
|
||||
function TX86AsmInstruction.IsCallInstruction: boolean;
|
||||
var
|
||||
a: PByte;
|
||||
begin
|
||||
@ -417,7 +417,7 @@ begin
|
||||
ReadCode;
|
||||
a := @FCodeBin[0];
|
||||
|
||||
if (FDisassembler.FProcess.Mode = dm64) then begin
|
||||
if (FAsmDecoder.FProcess.Mode = dm64) then begin
|
||||
while (a < @FCodeBin[0] + INSTR_CODEBIN_LEN) and (a^ in [$40..$4F, $64..$67]) do
|
||||
inc(a);
|
||||
if not (a^ in [$E8, $FF]) then
|
||||
@ -434,31 +434,31 @@ begin
|
||||
Result := FInstruction.OpCode = OPcall;
|
||||
end;
|
||||
|
||||
function TX86DisassemblerInstruction.IsReturnInstruction: boolean;
|
||||
function TX86AsmInstruction.IsReturnInstruction: boolean;
|
||||
begin
|
||||
Disassemble;
|
||||
Result := (FInstruction.OpCode = OPret) or (FInstruction.OpCode = OPretf);
|
||||
end;
|
||||
|
||||
function TX86DisassemblerInstruction.IsLeaveStackFrame: boolean;
|
||||
function TX86AsmInstruction.IsLeaveStackFrame: boolean;
|
||||
begin
|
||||
Disassemble;
|
||||
Result := (FInstruction.OpCode = OPleave);
|
||||
end;
|
||||
|
||||
function TX86DisassemblerInstruction.InstructionLength: Integer;
|
||||
function TX86AsmInstruction.InstructionLength: Integer;
|
||||
begin
|
||||
Disassemble;
|
||||
Result := FInstrLen;
|
||||
end;
|
||||
|
||||
function TX86DisassemblerInstruction.X86OpCode: TOpCode;
|
||||
function TX86AsmInstruction.X86OpCode: TOpCode;
|
||||
begin
|
||||
Disassemble;
|
||||
Result := FInstruction.OpCode;
|
||||
end;
|
||||
|
||||
procedure TX86Disassembler.Disassemble(var AAddress: Pointer; out AnInstruction: TInstruction);
|
||||
procedure TX86AsmDecoder.Disassemble(var AAddress: Pointer; out AnInstruction: TInstruction);
|
||||
var
|
||||
Code: PByte;
|
||||
CodeIdx: Byte;
|
||||
@ -3427,7 +3427,7 @@ begin
|
||||
Inc(AAddress, CodeIdx);
|
||||
end;
|
||||
|
||||
procedure TX86Disassembler.Disassemble(var AAddress: Pointer;
|
||||
procedure TX86AsmDecoder.Disassemble(var AAddress: Pointer;
|
||||
out ACodeBytes: String; out ACode: String);
|
||||
const
|
||||
MEMPTR: array[TOperandSize] of string = ('byte ptr ', 'word ptr ', 'dword ptr ', 'qword ptr ', '', 'tbyte ptr ', '16byte ptr ');
|
||||
@ -3509,36 +3509,36 @@ begin
|
||||
ACodeBytes := S;
|
||||
end;
|
||||
|
||||
function TX86Disassembler.GetInstructionInfo(AnAddress: TDBGPtr
|
||||
): TDbgDisassemblerInstruction;
|
||||
function TX86AsmDecoder.GetInstructionInfo(AnAddress: TDBGPtr
|
||||
): TDbgAsmInstruction;
|
||||
begin
|
||||
if (FLastInstr = nil) or (FLastInstr.RefCount > 1) then begin
|
||||
ReleaseRefAndNil(FLastInstr);
|
||||
FLastInstr := TX86DisassemblerInstruction.Create(Self);
|
||||
FLastInstr := TX86AsmInstruction.Create(Self);
|
||||
end;
|
||||
|
||||
FLastInstr.SetAddress(AnAddress);
|
||||
Result := FLastInstr;
|
||||
end;
|
||||
|
||||
{ TX86Disassembler }
|
||||
{ TX86AsmDecoder }
|
||||
|
||||
function TX86Disassembler.GetLastErrorWasMemReadErr: Boolean;
|
||||
function TX86AsmDecoder.GetLastErrorWasMemReadErr: Boolean;
|
||||
begin
|
||||
Result := FLastErrWasMem;
|
||||
end;
|
||||
|
||||
function TX86Disassembler.GetMaxInstrSize: integer;
|
||||
function TX86AsmDecoder.GetMaxInstrSize: integer;
|
||||
begin
|
||||
Result := 16;
|
||||
end;
|
||||
|
||||
function TX86Disassembler.GetMinInstrSize: integer;
|
||||
function TX86AsmDecoder.GetMinInstrSize: integer;
|
||||
begin
|
||||
Result := 1;
|
||||
end;
|
||||
|
||||
function TX86Disassembler.GetCanReverseDisassemble: boolean;
|
||||
function TX86AsmDecoder.GetCanReverseDisassemble: boolean;
|
||||
begin
|
||||
{$IFDEF FPDEBUG_WITH_REVERSE_DISASM}
|
||||
Result := true;
|
||||
@ -3547,25 +3547,25 @@ begin
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
function TX86Disassembler.ReadCodeAt(AnAddress: TDBGPtr; var ALen: Cardinal
|
||||
function TX86AsmDecoder.ReadCodeAt(AnAddress: TDBGPtr; var ALen: Cardinal
|
||||
): Boolean;
|
||||
begin
|
||||
FLastErrWasMem := not FProcess.ReadData(AnAddress, ALen, FCodeBin[0], ALen);
|
||||
Result := FLastErrWasMem;
|
||||
end;
|
||||
|
||||
constructor TX86Disassembler.Create(AProcess: TDbgProcess);
|
||||
constructor TX86AsmDecoder.Create(AProcess: TDbgProcess);
|
||||
begin
|
||||
FProcess := AProcess;
|
||||
end;
|
||||
|
||||
destructor TX86Disassembler.Destroy;
|
||||
destructor TX86AsmDecoder.Destroy;
|
||||
begin
|
||||
ReleaseRefAndNil(FLastInstr);
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
function TX86Disassembler.GetFunctionFrameInfo(AnAddress: TDBGPtr; out
|
||||
function TX86AsmDecoder.GetFunctionFrameInfo(AnAddress: TDBGPtr; out
|
||||
AnIsOutsideFrame: Boolean): Boolean;
|
||||
var
|
||||
ADataLen: Cardinal;
|
||||
|
@ -1378,7 +1378,7 @@ initialization
|
||||
RegisterDbgOsClasses(TOSDbgClasses.Create(
|
||||
TDbgLinuxProcess,
|
||||
TDbgLinuxThread,
|
||||
TX86Disassembler
|
||||
TX86AsmDecoder
|
||||
));
|
||||
|
||||
end.
|
||||
|
@ -1747,7 +1747,7 @@ initialization
|
||||
RegisterDbgOsClasses(TOSDbgClasses.Create(
|
||||
TDbgWinProcess,
|
||||
TDbgWinThread,
|
||||
TX86Disassembler
|
||||
TX86AsmDecoder
|
||||
));
|
||||
|
||||
end.
|
||||
|
@ -523,7 +523,7 @@ end;
|
||||
procedure TDbgControllerStepOverOrFinallyCmd.InternalContinue(
|
||||
AProcess: TDbgProcess; AThread: TDbgThread);
|
||||
var
|
||||
Instr: TDbgDisassemblerInstruction;
|
||||
Instr: TDbgAsmInstruction;
|
||||
begin
|
||||
{
|
||||
00000001000374AE 4889C1 mov rcx,rax
|
||||
@ -534,10 +534,10 @@ begin
|
||||
}
|
||||
if (AThread = FThread) then begin
|
||||
Instr := NextInstruction;
|
||||
if Instr is TX86DisassemblerInstruction then begin
|
||||
case TX86DisassemblerInstruction(Instr).X86OpCode of
|
||||
if Instr is TX86AsmInstruction then begin
|
||||
case TX86AsmInstruction(Instr).X86OpCode of
|
||||
OPmov:
|
||||
if UpperCase(TX86DisassemblerInstruction(Instr).X86Instruction.Operand[2].Value) = 'RBP' then
|
||||
if UpperCase(TX86AsmInstruction(Instr).X86Instruction.Operand[2].Value) = 'RBP' then
|
||||
FFinState := fsMov;
|
||||
OPcall:
|
||||
if FFinState = fsMov then begin
|
||||
@ -1309,7 +1309,7 @@ var
|
||||
StatIndex: integer;
|
||||
FirstIndex: integer;
|
||||
ALastAddr, tmpAddr, tmpPointer, prevInstructionSize: TDBGPtr;
|
||||
ADisassembler: FpDbgClasses.TDbgDisassembler;
|
||||
ADisassembler: TDbgAsmDecoder;
|
||||
|
||||
begin
|
||||
Result := False;
|
||||
|
Loading…
Reference in New Issue
Block a user