 |
Cheat Engine The Official Site of Cheat Engine
|
| View previous topic :: View next topic |
| Author |
Message |
skynet888 !BEWARE! Deletes post on answer
Reputation: 1
Joined: 12 Apr 2021 Posts: 106
|
Posted: Thu Dec 03, 2026 6:05 am Post subject: set data access breakpoint on the address esp+04 immediate |
|
|
As shown in the screenshot: I want to set a data access breakpoint on the address esp+04 immediately after the instruction mov [esp+04],eax executes. I wrote a Lua script for this, but it has a bug. It causes the Lua output window to spam nonstop, and may crash the target process or Cheat Engine.
| Code: | local nextAddr = 0x6933BACB
local function onAccess()
print(string.format("onAccess:EIP=%X,Addr=%X", EIP, ESP + 4))
debug_removeBreakpoint(ESP + 4, 4)
debug_continueFromBreakpoint(co_run)
end
local function onNext()
debug_removeBreakpoint(nextAddr, 1)
debug_setBreakpoint(ESP + 4, 4, bptAccess, bpmDebugRegister, onAccess)
debug_continueFromBreakpoint(co_run)
end
debug_setBreakpoint(nextAddr, 1, bptExecute, bpmDebugRegister, onNext)
|
[/quote][/code] |
|
| Back to top |
|
 |
Dark Byte Site Admin
Reputation: 475
Joined: 09 May 2003 Posts: 26041 Location: The netherlands
|
Posted: Thu Dec 03, 2026 8:10 am Post subject: |
|
|
never call debug_continueFromBreakpoint from inside breakpoint handlers _________________
Tools give you results. Knowledge gives you control.
Like my help? Join me on Patreon so i can keep helping |
|
| Back to top |
|
 |
skynet888 !BEWARE! Deletes post on answer
Reputation: 1
Joined: 12 Apr 2021 Posts: 106
|
Posted: Fri Dec 04, 2026 1:43 am Post subject: |
|
|
| Dark Byte wrote: | | never call debug_continueFromBreakpoint from inside breakpoint handlers |
However, even after modifying the code, there is still a bug: debug_removeBreakpoint does not actually remove the breakpoint. As a result, the print call inside onAccess keeps getting triggered nonstop.
| Code: |
local nextAddr = 0x9DABACB
local watchedAddr = 0
local function onAccess()
print(string.format("onAccess触发:EIP=%X,watchedAddr=%X", EIP, watchedAddr))
debug_removeBreakpoint(watchedAddr, 4)
end
local function onNext()
watchedAddr = ESP + 4
print(string.format("onNext触发:EIP=%X,watchedAddr=%X", EIP, watchedAddr))
debug_removeBreakpoint(nextAddr, 1)
debug_setBreakpoint(watchedAddr, 4, bptAccess, bpmDebugRegister, onAccess)
end
debug_setBreakpoint(nextAddr, 1, bptExecute, bpmDebugRegister, onNext) |
|
|
| Back to top |
|
 |
Dark Byte Site Admin
Reputation: 475
Joined: 09 May 2003 Posts: 26041 Location: The netherlands
|
Posted: Fri Dec 04, 2026 2:13 am Post subject: |
|
|
removeBreakpoint takes only 1 parameter, it assumes an error if you give more than 1 _________________
Tools give you results. Knowledge gives you control.
Like my help? Join me on Patreon so i can keep helping |
|
| Back to top |
|
 |
Csimbi I post too much
Reputation: 99
Joined: 14 Jul 2007 Posts: 3445
|
Posted: Fri Dec 04, 2026 1:07 pm Post subject: |
|
|
| That did not work for me either, I do it via the UI, manually. |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
|