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 


Help with Breakpoint

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
shakib187
Expert Cheater
Reputation: 0

Joined: 24 May 2007
Posts: 215

PostPosted: Sat Jul 13, 2013 7:47 pm    Post subject: Help with Breakpoint Reply with quote

debugProcess() -- Attach Debugger to the process.
autoAssemble([[aobscan(bla, 66 89 01 35 7F 0D 00 00 66 89 86 82 0A 00 00 8B 86 7C 0A 00 00)]]);

function debugger_onBreakpoint()

if(EDX==0x00000FB1) then
return 0 --Break
else
return 1 --Not Break
end
end

debug_setBreakpoint(bla)

It's not breakpointing in the location of bla, what am i doing wrong
Back to top
View user's profile Send private message
Gniarf
Grandmaster Cheater Supreme
Reputation: 43

Joined: 12 Mar 2012
Posts: 1285

PostPosted: Sat Jul 13, 2013 8:23 pm    Post subject: Re: Help with Breakpoint Reply with quote

Basically your problem is that bla is only known within the AA script. There are at least 2 ways to fix that:
The Quick and Dirty:
Code:
debugProcess()
autoAssemble([[aobscan(bla, 66 89 01 35 7F 0D 00 00 66 89 86 82 0A 00 00 8B 86 7C 0A 00 00)
registersymbol(bla)]]);  -- <-Added this line

function debugger_onBreakpoint()

  if(EDX==0x00000FB1) then
    return 0 --Break
  else
    return 1  --Not Break
  end
end

debug_setBreakpoint("bla") -- <-added quotes here


The Clean Way:
Code:
debugProcess()

function PlaceMyBreakPoint()
  local AOBResults=AOBScan("66 89 01 35 7F 0D 00 00 66 89 86 82 0A 00 00 8B 86 7C 0A 00 00","+X") -- might want to adjust "+X" for a more restrictive scan
  if (AOBResults~=nil) then
     if (AOBResults.Count>1) then
       print("My AOB signature was found several times!")
     else
       debug_setBreakpoint(AOBResults[0])
     end
  else
    print("Signature not found")
  end
  object_destroy(AOBResults); --not sure this is still useful in ce 6.3
end

function debugger_onBreakpoint()
  if(EDX==0x00000FB1) then
    return 0 --Break
  else
    return 1  --Not Break
  end
end

PlaceMyBreakPoint()

_________________
DO NOT PM me if you want help on making/fixing/using a hack.
Back to top
View user's profile Send private message
shakib187
Expert Cheater
Reputation: 0

Joined: 24 May 2007
Posts: 215

PostPosted: Sun Jul 14, 2013 3:08 pm    Post subject: Reply with quote

debugProcess()
local ecxVal
autoAssemble([[aobscan(bla, 66 89 ** 00 00 00 00 00 66 ** 86 82 ** 00 00 8B 86 7C 0A 00 00);
registersymbol(bla)]])
function debugger_onBreakpoint()

if(EDX==0x00000FB1) then
return 0
else
return 1
end
end

debug_setBreakpoint("bla")
memrec=createTableEntry
memrec=memrec_setAddress(te,ecxVal)
memrec=memrec_freeze(te)

So far I got that, I still am wondering where to write
mov [ecxVal],ecx

and where to just run + remove breakpoint after recording that value
Back to top
View user's profile Send private message
Gniarf
Grandmaster Cheater Supreme
Reputation: 43

Joined: 12 Mar 2012
Posts: 1285

PostPosted: Sun Jul 14, 2013 3:32 pm    Post subject: Reply with quote

shakib187 wrote:
So far I got that, I still am wondering where to write
mov [ecxVal],ecx
When the breakpoint is hit, ie in debugger_onBreakpoint() though you don't need an asm patch for that.

shakib187 wrote:
and where to just run + remove breakpoint after recording that value
When the breakpoint is hit, ie in debugger_onBreakpoint() and after you're recorded the address of your variable.
Code:
debugProcess()
autoAssemble([[aobscan(bla, 66 89 ** 00 00 00 00 00 66 ** 86 82 ** 00 00 8B 86 7C 0A 00 00);
registersymbol(bla)]])
debug_setBreakpoint("bla")

memrec=getAddressList().createMemoryRecord(); --create a dummy memory record

function debugger_onBreakpoint()
  if(EDX==0x00000FB1) then
    --set the dummy's address
    memrec.setAddress(string.format("%X",ECX)); --address must be a string
    memrec.Active=true; --freeze record
    debug_removeBreakpoint("bla") --if you don't want to keep memrec updated
  end
  return 1; --always continue
end

_________________
DO NOT PM me if you want help on making/fixing/using a hack.
Back to top
View user's profile Send private message
shakib187
Expert Cheater
Reputation: 0

Joined: 24 May 2007
Posts: 215

PostPosted: Sun Jul 14, 2013 3:51 pm    Post subject: Reply with quote

Code:
debugProcess()
autoAssemble([[aobscan(bla, 66 89 ** 00 00 00 00 00 66 ** 86 82 ** 00 00 8B 86 7C 0A 00 00);
registersymbol(bla)]])
debug_setBreakpoint("bla")

memrec=getAddressList().createMemoryRecord(); --create a dummy memory record

function debugger_onBreakpoint()
  if(EDX==0x00000FB1) then
    --set the dummy's address
    memrec.setAddress(string.format("%X",ECX)); --address must be a string
    memrec.Active=true; --freeze record
    debug_removeBreakpoint("bla") --if you don't want to keep memrec updated
  end
  return 1; --always continue
end



memrec.Active=true; how does this freeze? I am so lost

memrec.setAddress(string.format("%X",ECX) what is "%X" for?
Back to top
View user's profile Send private message
Gniarf
Grandmaster Cheater Supreme
Reputation: 43

Joined: 12 Mar 2012
Posts: 1285

PostPosted: Sun Jul 14, 2013 3:59 pm    Post subject: Reply with quote

shakib187 wrote:
memrec.Active=true; how does this freeze? I am so lost
C:\Program Files (x86)\Cheat Engine 6.3\main.lua, line 1267

shakib187 wrote:
memrec.setAddress(string.format("%X",ECX) what is "%X" for?
%X tells string.format to take ECX (an integer) and convert it to a string showing this number in hexadecimal.
string (incl. string.format) documentation

_________________
DO NOT PM me if you want help on making/fixing/using a hack.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting 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