Re: [DynInst_API:] Tracing from a thread?


Date: Tue, 02 Jun 2015 13:24:45 -0700
From: Josh Stone <jistone@xxxxxxxxxx>
Subject: Re: [DynInst_API:] Tracing from a thread?
On 06/02/2015 12:57 PM, Tony Zhang wrote:
> Hello,
> 
> Is it possible to use DynInst from a different thread within a process?
> For example, a program would create multiple pthreads, and one of them
> (a master) then attempts to control the execution of all other threads
> in the program.

On Linux, Dyninst works through ptrace, and ptrace forbids attaching to
threads in your own thread group -- it will return EPERM.

See Linux's ptrace_attach() in kernel/ptrace.c, in particular:

	retval = -EPERM;
	if (unlikely(task->flags & PF_KTHREAD))
		goto out;
	if (same_thread_group(task, current))
		goto out;

[← Prev in Thread] Current Thread [Next in Thread→]