[lldb-dev] How to debug a child process ?
Jim Ingham via lldb-dev
lldb-dev at lists.llvm.org
Mon Sep 30 17:31:52 PDT 2019
> On Sep 30, 2019, at 5:05 PM, Peter Rowat via lldb-dev <lldb-dev at lists.llvm.org> wrote:
> I have a process P1 that forks a child process P2. Both have graphic displays, P2 is an animation depending on data from P1.
> P2 suddenly disappears at a time that is never the same as any previous run.
> I use lldb to run P1 and when P2 disappears P1 hangs, and lldb prints a message like
> "2019-09-30 16:19:18.648148-0700 animTS[54508:1706244] detected buffer overflow”.
That's not an lldb error, so I don't know what 1706244 means.
> animTS is my process P2, 54508 is the P2 process number. What is the number 1706244 ? It isn’t an address.
> How can I run lldb on the P2 process ?
You can attach to the process. If there's only one process with the name animTS, then you can use:
(lldb) process attach -w -n animTS
That will get lldb to poll the process table until something with the name animTS shows up, and then will attach to it.
If there are lots of animTS processes, then you probably will need to get P1 to print the PID of P2 when it forks it, then you can attach by pid (process attach -p).
> Thanks for any help.
> — Peter R
> lldb-dev mailing list
> lldb-dev at lists.llvm.org
More information about the lldb-dev