[Lldb-commits] [PATCH] D72813: Fixes to lldb's eLaunchFlagLaunchInTTY feature on macOS

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Jan 17 00:30:59 PST 2020


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





More information about the lldb-commits mailing list