robovm/robovm — pull request #567 by badlogic (2014-10-30 23:05:23+00:00)
Title: Proposal for debug hook

I quickly implemented the required debug hooks:

* debug_hooks.c contains all functions that we require at the moment
* init.c and thread.c call into those hooks in appropriate places
* a corresponding branch named `hooks` in the debug project let's you test the changes. It already uses the new hook locations in `debug_hooks.c`

TODOs
* the hooks are currently forward declared in `init.c` and `thread.c`, i couldn't get weak linking ala `registerDarwinExceptionHandler` working. Clang always links against the weak versions of the hooks even when linking to librobovm-debug.a. So, at the moment the methods are always linked in.
* Moving `debug_hooks.c` to `vm/debug` requires us to always set the `skipInstall` flag on the `Config` so `librobovm-debug.a` gets linked. Maybe we should put it in a new static lib that gets added if `Config#debug` is true? `debug_hooks.c` is currently in `vm/core` where it doesn't belong.
* `debug_hooks.c` needs to be compiled with debug info even if the resulting static lib was build in release mode.
* Apart from `debugHookWaitForAttach`, all hooks simply log to `stderr`, maybe you want them to do something else on which we can break.