fix breakpoints that aren't an exact address match

find what accesses/writes now handles exceptions and debugreg (get previous opcode)
This commit is contained in:
cheatengine@gmail.com 2013-05-02 16:29:30 +00:00
parent 425ab8750c
commit 766b989c56
5 changed files with 63 additions and 5 deletions

View File

@ -138,7 +138,8 @@ begin
if currentthread<>nil then
begin
address:=currentThread.context.{$ifdef cpu64}Rip{$else}eip{$endif};
if usesdebugregs then //find out the previous opcode
if usesdebugregs or useexceptions then //find out the previous opcode
address:=previousopcode(address);
//disassemble to get the opcode and size

View File

@ -572,7 +572,8 @@ begin
for i := 0 to breakpointlist.Count - 1 do
begin
bpp:=PBreakpoint(breakpointlist.Items[i]);
if (bpp.address = address) then
if InRangeX(address, bpp.address, bpp.address+bpp.size) then
begin
found:=true;
bpp2:=bpp;

View File

@ -11,7 +11,7 @@ object frmBreakpointlist: TfrmBreakpointlist
OnClose = FormClose
OnCreate = FormCreate
Position = poScreenCenter
LCLVersion = '0.9.31'
LCLVersion = '1.0.8.0'
object ListView1: TListView
Left = 0
Height = 292
@ -80,6 +80,11 @@ object frmBreakpointlist: TfrmBreakpointlist
Caption = 'Set/change condition'
OnClick = miSetConditionClick
end
object miPageWide: TMenuItem
Caption = 'Change to pagewide breakpoint'
Visible = False
OnClick = miPageWideClick
end
object MenuItem1: TMenuItem
Caption = '-'
end

View File

@ -9,5 +9,6 @@ TFRMBREAKPOINTLIST.LISTVIEW1.COLUMNS[6].CAPTION=Pending deletion
TFRMBREAKPOINTLIST.MENUITEM2.CAPTION=Disable breakpoint
TFRMBREAKPOINTLIST.MIDELBREAKPOINT.CAPTION=Delete breakpoint
TFRMBREAKPOINTLIST.MISETCONDITION.CAPTION=Set/change condition
TFRMBREAKPOINTLIST.MIPAGEWIDE.CAPTION=Change to pagewide breakpoint
TFRMBREAKPOINTLIST.MENUITEM1.CAPTION=-
TFRMBREAKPOINTLIST.MISHOWSHADOW.CAPTION=Show shadow breakpoints

View File

@ -19,6 +19,7 @@ type
ListView1: TListView;
MenuItem1: TMenuItem;
MenuItem2: TMenuItem;
miPageWide: TMenuItem;
miShowShadow: TMenuItem;
miDelBreakpoint: TMenuItem;
miSetCondition: TMenuItem;
@ -29,6 +30,7 @@ type
procedure ListBox1DblClick(Sender: TObject);
procedure ListView1DblClick(Sender: TObject);
procedure MenuItem2Click(Sender: TObject);
procedure miPageWideClick(Sender: TObject);
procedure miShowShadowClick(Sender: TObject);
procedure miDelBreakpointClick(Sender: TObject);
procedure miSetConditionClick(Sender: TObject);
@ -152,6 +154,30 @@ begin
end;
end;
procedure TfrmBreakpointlist.miPageWideClick(Sender: TObject);
var bp: PBreakpoint;
begin
if (listview1.selected<>nil) and (MessageDlg('Are you sure you wish to change this to a pagewide breakpoint?', mtConfirmation, [mbyes, mbno], 0)=mryes) then
begin
debuggerthread.lockbplist;
try
bp:=listview1.selected.Data;
if bp.breakpointMethod=bpmException then
begin
bp.size:=bp.size+(bp.address and $fff);
bp.address:=bp.address-(bp.address and $fff);
end;
finally
debuggerthread.unlockbplist;
end;
updatebplist;
end;
end;
procedure TfrmBreakpointlist.miShowShadowClick(Sender: TObject);
var i: integer;
begin
@ -239,9 +265,33 @@ begin
end;
procedure TfrmBreakpointlist.pmBreakpointPopup(Sender: TObject);
var bp: Pbreakpoint;
begin
miDelBreakpoint.enabled:=listview1.Selected<>nil;
miSetCondition.enabled:=listview1.Selected<>nil;
if listview1.selected<>nil then
begin
miDelBreakpoint.enabled:=true;
miSetCondition.enabled:=true;
bp:=listview1.selected.Data;
debuggerthread.lockbplist;
try
if bp.breakpointMethod=bpmException then
miPageWide.visible:=true;
finally
debuggerthread.unlockbplist;
end;
end
else
begin
miDelBreakpoint.enabled:=false;
miSetCondition.enabled:=false;
miPageWide.visible:=false;
end;
end;
procedure TfrmBreakpointlist.Timer1Timer(Sender: TObject);