View previous topic :: View next topic |
Author |
Message |
weakspider How do I cheat?
Reputation: 0
Joined: 29 Jun 2016 Posts: 3
|
Posted: Wed Jun 29, 2016 11:51 pm Post subject: find what accessed memory region through lua |
|
|
I want to use to lua to determine what where some parts of the memory is being access from.
my code
Code: |
function debugger_onBreakpoint()
print(getNameFromAddress(address))
return 1
end
openProcess("process.exe")
debugProcess()
debug_setBreakpoint(address, 10, bptAccess)
|
however this does not produce any results.
If I debug using "Find out what is accessing this address" I do get results. I am not sure what I'm doing wrong here, any help iswould be welcome
|
|
Back to top |
|
 |
cooleko Grandmaster Cheater
Reputation: 11
Joined: 04 May 2016 Posts: 717
|
Posted: Thu Jun 30, 2016 1:06 am Post subject: |
|
|
Check out the lua page, your code doesnt follow it exactly, I have never called the functions so cant help you more, but if you change your code to follow the example, it may provide a better starting place.
http://wiki.cheatengine.org/index.php?title=Lua_Debugging
|
|
Back to top |
|
 |
weakspider How do I cheat?
Reputation: 0
Joined: 29 Jun 2016 Posts: 3
|
Posted: Thu Jun 30, 2016 1:16 am Post subject: |
|
|
I don't see how my code is wrong
|
|
Back to top |
|
 |
cooleko Grandmaster Cheater
Reputation: 11
Joined: 04 May 2016 Posts: 717
|
Posted: Thu Jun 30, 2016 1:48 am Post subject: |
|
|
So I tested the code myself, this is what I used, and it worked:
Code: | if not shields then
shields = { }
end
function debugger_onBreakpoint()
if (EIP ~= 0x09581CF1) then return 0 end -- ignore user-set breakpoints
shields[RSI] = readFloat(RSI+0x58) -- store shield in table
debug_continueFromBreakpoint(co_run) -- continue execution
print(shields[RSI])
return 1 -- let CE know we handled breakpoint, no need to update debugger form
end
--openProcess("SPAZ2_64.exe")
--debugProcess()
debug_setBreakpoint(0x09581CF1) |
So as i said, instead of starting with a custom example, just follow the examples given, see if you can get something to work, then you can try your overloaded debug_setBreakpoint
but the only two differences i noticed, which made me think you should try sticking with the example is that you dont tell the debugger what to do on trigger (debug_continueFromBreakpoint) and you used the optional entries for (debug_setBreakpoint), why do you want to break on 10 bytes after the address? Just break at your address for a test.
0x09581CF1 is the instruction I broke on, I didnt try accesses, guess I could try that later since it doesnt follow your example closely.
EDIT: Tested again on accesses on multiple values appearing in memory
Code: | bAddr=0x62956030
cnt=1
function debugger_onBreakpoint()
-- if (EIP ~= 0x0EF86891) then return 0 end -- ignore user-set breakpoints
-- shields[RSI] = readFloat(RSI+0x58) -- store shield in table
-- debug_continueFromBreakpoint(co_run) -- continue execution
print(cnt .. ": " .. EIP .. " - " .. readFloat(bAddr))
cnt = cnt+1
if cnt == 10 then
cnt=1
print(" ")
debug_removeBreakpoint(bAddr)
end
return 1 -- let CE know we handled breakpoint, no need to update debugger form
end
--openProcess("SPAZ2_64.exe")
--debugProcess()
debug_setBreakpoint(bAddr,10,bptAccess) |
Still worked just fine. Are you sure the address is correct?
EDIT:
Tried one last test to see if it was possibly what is giving you trouble, I added the "print(getNameFromAddress(bAddr))" but it worked just fine, it printed the address I gave to it.
|
|
Back to top |
|
 |
weakspider How do I cheat?
Reputation: 0
Joined: 29 Jun 2016 Posts: 3
|
Posted: Thu Jun 30, 2016 2:17 am Post subject: |
|
|
works indeed, thank you for your help
|
|
Back to top |
|
 |
|