Posted: Sat May 30, 2020 3:10 pm Post subject: I feel so stupid
Spent entire day today trying to debug my code, because i kept crashing. I checked my hook, i checked how the registers were changed, looked how the stack changed, tried a bunch of different calling conventions, but nothing helped. Then i tried to move my hook a couple of bytes up. So i'm guessing my hook was in the middle of some jump destination or something? God, what a waste of a day. Is there any way of making sure something like this doesn't happen again? Who knows, there might be a really obscure jump somewhere that lands on that exact spot, but it could be very conditional, and cause a crash once in an hour or so, which would make debugging a nightmare. Luckily for me, my game crashed when i performed a certain action though. So don't be like me kids, try shifting up or down a little when hooking.
Branches (conditional or unconditional) to the middle of a function usually only happen from within the function itself. It's quite rare when it interferes with a code injection, and if it does happen, you can usually see it by enlarging the disassembler window.
If you must be more reasonably sure, you can use CE's dissect code feature (Tools -> Dissect Code). Last I checked this couldn't target dynamically allocated memory (e.g. result of JIT compilation), so in that case you'd have to go through Lua to dissect the correct region (View -> Memory Regions).
Code:
getDissectCode().dissect(0x1234000,0x1C000)
_________________
I don't know where I'm going, but I'll figure it out when I get there.
Yeah it did happen from the function itself, but i couldn't see it even with full screen. It was a pretty big jump. Didn't know about the dissect data feature, it's exactly what i needed, thanks a bunch.
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