Or should i use reading "/proc/[pid]/task/[tid]/comm"?
Yes, right. The problem i have now is that i only have pid (process_id) and tid (task_id) but i need pthread_id!Are you even calling "pthread_create" anywhere?
Or should i use reading "/proc/[pid]/task/[tid]/comm"?From the same link: https://linux.die.net/man/3/pthread_getname_np
Notes
pthread_setname_np() internally writes to the thread specific comm file under /proc filesystem: /proc/self/task/[tid]/comm. pthread_getname_np() retrieves it from the same location. ยด
even if it needs the good offices of Sven or Marco to get it into the RTL.
Yes, right. The problem i have now is that i only have pid (process_id) and tid (task_id) but i need pthread_id!Are you even calling "pthread_create" anywhere?
There is nothing that needs to be implemented in the RTL here, because we're talking about debugging third party applications (Pascal didn't clarify this, but I remembered that they had asked about this functionality in FpDebug some months ago).
Well, is there really no way to get pthread_t from tid?
This works inside the thread. But as i am debugging another process i need a function which converts the tid to a pthread_t to make a call to pthread_getname_np().Well, is there really no way to get pthread_t from tid?
And what about pthread_self: https://www.delftstack.com/howto/c/pthread-get-thread-id-in-c/
This works inside the thread. But as i am debugging another process i need a function which converts the tid to a pthread_t to make a call to pthread_getname_np().Well, is there really no way to get pthread_t from tid?
And what about pthread_self: https://www.delftstack.com/howto/c/pthread-get-thread-id-in-c/
Or should i use reading "/proc/[pid]/task/[tid]/comm"?From the same link: https://linux.die.net/man/3/pthread_getname_npQuoteNotes
pthread_setname_np() internally writes to the thread specific comm file under /proc filesystem: /proc/self/task/[tid]/comm.
pthread_getname_np() retrieves it from the same location.
And you didn't read my answer:I've read and understood it. But my original goal was to use pthread_getname_np instead of /proc/[tid]/comm.QuoteOr should i use reading "/proc/[pid]/task/[tid]/comm"?From the same link: https://linux.die.net/man/3/pthread_getname_npQuoteNotes
pthread_setname_np() internally writes to the thread specific comm file under /proc filesystem: /proc/self/task/[tid]/comm.
pthread_getname_np() retrieves it from the same location.
Yes, right, it's all about debugging here as mentioned in initial post.
Well, is there really no way to get pthread_t from tid?
I am thinking of adding a lookup array to Threadmanager (rtl/unix/cthreads.pp) which is updated in CBeginThread.
... AddThread(Do_SysCall(syscall_nr_gettid)), threadid); ...
Yes, right, it's all about debugging here as mentioned in initial post.
Ehm, no this isn't mentioned in your initial post. While there is a TDbgLinuxThread type in the code example this does in no way explain what you're trying to do. It could after all simply be some thread in your own application that has this name for providing information about other threads in the same application. Nothing hints at you trying to extend FpDebug.
I am thinking of adding a lookup array to Threadmanager (rtl/unix/cthreads.pp) which is updated in CBeginThread.
... AddThread(Do_SysCall(syscall_nr_gettid)), threadid); ...
That would be rejected.