[Lldb-commits] [PATCH] D32930: New framework for lldb client-server communication tests.

Kamil Rytarowski via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri May 19 05:09:00 PDT 2017

krytarowski added inline comments.

Comment at: unittests/tools/lldb-server/tests/TestClient.cpp:115
+  if (thread_id == 0) thread_id = process_info->GetPid();
labath wrote:
> jmajors wrote:
> > labath wrote:
> > > This is a linux-ism. Other targets don't have the "pid == main thread id" concept. What is the semantics you intended for the thread_id = 0 case? If you wanted to resume the whole process (all threads) you can send `vCont;c` or just `c`. We also have the LLDB_INVALID_THREAD_ID symbolic constant to signify invalid thread.
> > I was using 0 so the caller didn't have to know what the main thread id was.
> Right, so this won't work because on netbsd (I believe) the main thread will have tid = 1.
> We could start special-casing the individual platforms here to get the right behaviour, but I am not sure the i-want-to-resume-only-the-main-thread-but-i-can't-be-bothered-to-look-it-up case is common enough for that -- If you don't have a thread ID handy, most of the time you will want to resume the whole process instead. So I think we should have two functions, one that resumes the whole process (which takes no arguments), and one that resumes only a single thread (and takes a mandatory argument).
> (also the argument type should be lldb::tid_t)
This is correct, process has it's PID, and it has one or more LWPs (threads). The main thread is 1, and it's counting 2,3,4 for second, third, fourth etc.

Thread 0 is internally (and at least in ptrace(2)) reserved for "all process" events.

If I know correctly, the same model is in Solaris.


More information about the lldb-commits mailing list