I have a file scope kernel extension that informs a daemon when an application is launched. The daemon is required to pause the launched application at the beginning of its first instruction in main().
When calling ptrace with PT_ATTACH, the daemon appears to attach too early and is in the dynamic linker (dyld).
Here is an example of the callstack of thread 0 when attached: -
Thread 0:
0 dyld 0x00007fff6e4cd35e mach_reply_port + 10
1 dyld 0x00007fff6e4cd4d4 _mig_init + 13
2 dyld 0x00007fff6e4cd17f mach_init + 46
3 dyld 0x00007fff6e4aa239 dyldbootstrap::start(macho_header const*, int, char const**, long, macho_header const*, unsigned long*) + 411
4 dyld 0x00007fff6e4aa05e _dyld_start + 54
Therefore, is there any way to either ensure the daemon can attach to the beginning of the main function after loading libraries has finished, or to repeatedly single step to that point, in which case, how would I be able to find the address of main, considering there may be no symbols available for a launched application?
Thanks.