From the output of strace -o file lldb someprog
, I found there is no ptrace
.
Then how can lldb get features like PTRACE_ATTACH/PTRACE_SINGLESTEP
and so on?
Ironically, the lldb process doesn't do any actual debugging. Instead, it always uses a proxy (lldb-server on Linux, debugserver on Darwin)(*) to do the actual debugging, and communicates with it using the gdb remote serial protocol. lldb-server does use ptrace on Linux (and somewhat on Darwin).
(*) I think there still is an in-process adaptor for Windows, but IIRC they are switching to lldb-server as well.