Hi,
This subject is deep, i mean really deep, yet it is not that hard once you got the idea, and it is not that straight forward, as you drawn it, i had built small debugger (-ish) for fun and learning and dropped it when felt i got what i need to know and the whole thing started to become boring.
See, if the break point happened by a simple trap like INT3 then the thread triggered it will change its execution and jump, hence losing and corrupting its own thread context at that moment.
To prevent that you need to set the debugging environment first, and that include using the CPU debug registers
https://en.wikipedia.org/wiki/X86_debug_register , and this is the tricky part or the complicated part, yet it is pretty straight forward from here.
I suggest reading about the subject and i have very nice resources about that:
1) The Wikipedia page mentioned above is hard to interpret but can be used as reference.
2) There is great blog posts from an expert, an ex member of Microsoft Debugger Platform team:
https://www.timdbg.com/
Part 5 is about breakpoints
https://www.timdbg.com/posts/writing...cratch-part-5/ and he is using
https://wiki.osdev.org/CPU_Registers...ebug_Registers as reference instead of Wikipedia.
3) My favorite one ! and this one i am using in many places when i need to do runtime stuff.
https://github.com/x64dbg/TitanEngine
This engine is used in xdbg64 as main debugging engine, it is very powerful, also have unique capabilities for hooking, a Pascal header is here, but it might be out-dated
https://github.com/jsj2008/TitanEngi...ter/SDK/Delphi
4) The one that really might help you is CheatEngine, it is not for moding/patching games, but it can do many many things, i use it as debugging tool as it is one mighty debugger written in Pascal:
https://github.com/cheat-engine/cheat-engine
Hope that helps.