labath added a comment.

In D72813#1825027 <https://reviews.llvm.org/D72813#1825027>, @jasonmolenda 
wrote:

>   If we attach while darwin-debug is executing, then we get the exec mach 
> exception, ....


Not really my thing, but couldn't you just ensure that you *always* attach 
while darwin-debug is executing? E.g., the binary could do something like:

  send_pid();
  while(!am_i_being_debugged()) usleep(1000);
  posix_spawn(...);

I had sort of assumed this wasn't possible because of SIP, but your comment 
makes it sounds that this does work at least sometimes...

BTW, is quite unfortunate that the CLOEXEC trick doesn't work. We use that for 
launching on linux, and it's pretty neat. The best part about it is that if the 
execve() fails, you still get to keep the fd and can send an error message 
about what went wrong. This bit of code uses the libc api directly, so I don't 
know if the problem here is with the lldb Read function or the darwin system 
apis...


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72813/new/

https://reviews.llvm.org/D72813



_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to