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 


Strange debug effect

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine
View previous topic :: View next topic  
Author Message
Antoshick
Advanced Cheater
Reputation: 0

Joined: 02 Nov 2018
Posts: 56

PostPosted: Fri Dec 11, 2020 9:59 am    Post subject: Strange debug effect Reply with quote

Hi all, after many years of using CE i met some strange debug effect.
I make injection to some instruction and start debug by step (F7). But the write to the variable occurs before debugging will reach my instruction.

this is main part of code

Code:

//------------------ Alloc
alloc(Alloc_Address_1,100)
registersymbol(Alloc_Address_1)
//------------------ Original
movdqu [rcx],xmm0
movups xmm1,[rax+10]
//------------------ Added by me
push r9   //Writing into Alloc_Address_1 sometimes occurred here
push r10
mov r9,[rcx]   //Writing into Alloc_Address_1  sometimes occurred here, also
mov r10,[rcx+20]
add r9,r10
mov [Alloc_Address_1],r9
pop r10
pop r9


Video of this effect
https://www.youtube.com/watch?v=CfdwFY5M9Hs

Why this may happend?
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 152

Joined: 06 Jul 2014
Posts: 4725

PostPosted: Fri Dec 11, 2020 12:50 pm    Post subject: Reply with quote

Are there multiple threads executing the same code?
Try adding a spinlock and see if it still happens:
Code:
alloc(spinlock,4)

spinlock:
  dd 0

newmem:
  push rax
  push rcx
  push rdx
  xor ecx,ecx
  mov edx,1
acquireLock:
  mov eax,ecx
  lock cmpxchg [spinlock],edx
  jne enterloop
  // your code here...
  pop rdx
  pop rcx
  pop rax
  jmp return
spinloop:
  rep nop
enterloop:
  mov eax,[spinlock]
  test eax,eax
  jne spinloop
  jmp acquireLock

_________________
I don't know where I'm going, but I'll figure it out when I get there.
Back to top
View user's profile Send private message
Antoshick
Advanced Cheater
Reputation: 0

Joined: 02 Nov 2018
Posts: 56

PostPosted: Sat Dec 12, 2020 6:17 am    Post subject: Reply with quote

ParkourPenguin wrote:
Are there multiple threads executing the same code?
Try adding a spinlock and see if it still happens:

Yes, this function is used by 12 different calls. I saw it in Ghidra.
The code makes the game frozen and takes up 100% of the CPU.
I found that the other thread has RBX less than RAX. So I made the filter by this deal. Now work fine.
I just use some calculation based on this instruction, and without a filter, in the middle (for example) of the calculation process, another thread comes and rewrites the value until the current thread has finished working

Thanks for help!
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 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