Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Is there a limit for breakpoints?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine
View previous topic :: View next topic  
Author Message
Pirulito
Newbie cheater
Reputation: 0

Joined: 13 May 2017
Posts: 13

PostPosted: Thu May 24, 2018 3:26 am    Post subject: Is there a limit for breakpoints? Reply with quote

Hi,

Is there a limit for the number of breakpoints (BP) that I can add to a process?

I am not talking about tens or hundreds, but thousands... Would it work?

My plan is to use LUA to add thousands of BPs to a process [debug_setBreakpoint(address)] and then have one debugger_onBreakpoint() function to alert me when a BP was hit.

Would this idea work? If yes, what instruction should I use in the debugger_onBreakpoint() function so that it just prints the address that was hit?

Thank you.
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 457

Joined: 09 May 2003
Posts: 25262
Location: The netherlands

PostPosted: Thu May 24, 2018 3:38 am    Post subject: Reply with quote

you can use software breakpoints (they change the code)

e.g:
Code:

  debug_setBreakpoint(address,1, bptExecute, bpmInt3, function()
    print('address got executed')
  end)


or:
Code:

function debugger_onBreakpoint()
  if targetIs64Bit() then
    print(string.format("RIP=%x", RIP))
  else
    print(string.format("EIP=%x", EIP))
  end
end
debug_setBreakpoint(address,1, bptExecute, bpmInt3)



Code:

debug_setBreakpoint(address, size OPTIONAL, trigger OPTIONAL, breakpointmethod OPTIONAL, functiontocall() OPTIONAL) : sets a breakpoint of a specific size at the given address. if trigger is bptExecute then size is ignored. If trigger is ignored then it will be of type bptExecute, which obviously also ignores the size then as well.  (Other triggers are bptAccess and bptWrite)
debug_setBreakpoint(address, size OPTIONAL, trigger OPTIONAL, functiontocall() OPTIONAL)
debug_setBreakpoint(address, functiontocall() OPTIONAL)

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
Pirulito
Newbie cheater
Reputation: 0

Joined: 13 May 2017
Posts: 13

PostPosted: Thu May 24, 2018 4:46 am    Post subject: Reply with quote

Thank you, Dark Byte.

About the software BP, if I understood it correctly, that first code you wrote replaces the first byte of the opcode (that starts at address 'address') with byte 'CC' which is int3. If such address is hit, it would print "address got executed". But I think I should use the following, correct?

Code:
debug_setBreakpoint (address, 1, bptExecute, bpmInt3,
  function()
    print(address .. ' got executed')
  end)


But then you also wrote that "they change code", which I understand, they change that first byte. But then I read in the wiki about Debugging that when using software BP " ... the debugger must restore the original byte, execute a single step, and restore with the breakpoint opcode."

What does this mean? Does it mean that the debugger automatically restores the changed byte after the address is hit or that I should put some extra code somewhere to restore such byte?

EDIT:Oh, I think I understood what the debugger does, that phrase " the debugger must restore the original byte, execute a single step, and restore with the breakpoint opcode."

When the address is hit, the int3 causes the interruption, then the debugger replaces the int3 opcode with whatever original byte was there so that it can execute the original opcode and then, after executing it, the debugger replaces again the first byte of the original opcode with the int3 opcode to keep the BP alive. So, if I understood it correctly, this is all automatic, I, as the user, must do nothing, right?

So the code is changed but the game never realizes it, correct?
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 457

Joined: 09 May 2003
Posts: 25262
Location: The netherlands

PostPosted: Thu May 24, 2018 6:04 am    Post subject: Reply with quote

right it is all automated.
the game won't notice unless it reads the memory and checks for changes

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites