The hookmask of the coroutine will only copy the value of the parent thread when it is created. I wrote a debugger, and for performance reasons, I won't add line/count hooks at the begining. But when I want to pause lua, I need to add a line hook or a count hook for each coroutine because they have already been created. This means that I need to save each coroutine to the list, but I can't get the create and close events of the coroutine.
In addition, saving all the coroutines does not solve all the problems. Also for performance reasons, I will check if the function contains a breakpoint in the call hook and return hook to decide whether to add a line hook. But if lua_resume is called, these checks will not be triggered.
Should there be a resume hook and a resume return hook, just like a call hook and a return hook?