Search code examples
luareverse-engineeringdisassemblyidacheat-engine

cheat engine debug breakpoint on IDA function addresses


I have this function (4F314A) on IDA that I like to understand when / if will call:

enter image description here

I like to add a breakpoint to cheat engine and I have used this code:

debugProcess()  -- Attach Debugger to the process.
function debugger_onBreakpoint()

   print("hello hacking")


    return 0 --Break

end

myaddress=getAddress("battlezone2.exe")+0x4F314A
debug_setBreakpoint(myaddress); -- Address where to set breakpoint

but don't do nothing and I don't sure if is correct.

Is this the right way to add a breakpoint to cheat engine to see if a assembly function will call ?

Thanks !


Solution

  • In this case, you can only see if the function will call via a debugger and a breakpoint right before an instruction you know will execute

    Try setting a breakpoint at the first/second instruction

    Also, I believe you meant this:

    openProcess("battlezone2.exe") -- If you dont have it attached yet, this will do it
    debugProcess()  -- Attach Debugger to the process.
    function debugger_onBreakpoint()
        print("hello hacking")
        return 0 -- Returns 0 to Cheat engine
    
    end
    
    myaddress = getAddress("0x4F314A")
    debug_setBreakpoint(myaddress); -- Address where to set breakpoint
    

    getAddress takes a CEAddressString as first parameter, not the process name.