[Lldb-commits] [lldb] r186033 - Add support for listing inferior thread names on Linux.
emaste at freebsd.org
Mon Jul 15 13:00:38 PDT 2013
On 15 July 2013 15:22, Kopec, Matt <matt.kopec at intel.com> wrote:
> I'm not sure messages are the right place. We should also handle the case where a thread name changes through the pthread_setname_np call in the inferior.
> Since there are Linux and FreeBSD subclasses of ProcessPOSIX, we could add something like a SetThreadName virtual function to ProcessPOSIX and replace the SetName call below with this function. How about that?
On FreeBSD I don't have a ptrace event for a thread creation, so I'll
need to check the process's thread list after each stop event and
update any new / terminated / renamed threads; presumably this will be
equivalent to what Linux needs to do for just the renamed case. So
the SetThreadName implementation on FreeBSD is probably a no-op.
For a concrete example, this is what I'm currently doing upon attach
to create the threads:
if (PTRACE(PT_GETLWPLIST, pid, (void *)tids, tdcnt) < 0)
for (int i = 0; i < tdcnt; i++)
lldb::tid_t tid = tids[i];
log->Printf("ProcessMonitor::%s() adding tid = %" PRIu64,
lldb::ProcessSP processSP = process.shared_from_this();
struct ptrace_lwpinfo plwp;
inferior.reset(new POSIXThread(*processSP, tid));
if (PTRACE(PT_LWPINFO, tid, &plwp, sizeof(plwp)) == 0)
thread = static_cast<POSIXThread*>(inferior.get());
// Let our process instance know the thread has stopped.
More information about the lldb-commits