Click here to Skip to main content
15,891,136 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Lets say we have a process in LINUX which has two threads. Is it possible to trace one thread using another thread(main thread) using PTRACE system call.

Normally PTRACE system call is used to trace a process.Example GDB ,where GDB process will attach it to a traced process. But i am not sure whether the same PTRACE can be used for tracing threads? Please someone clarify

What I have tried:

I have not tried using PTRACE system call for tracing threads.
Posted
Comments
Jochen Arndt 14-Dec-16 9:11am    
As far as I know (therefore as comment): Yes

But you need the thread ID (TID, same type as PID). When using pthreads note that this is not the same as the pthread ID (pthread_t).

The TID can be retrieved by the thread itself calling gettid().

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900