Forum > Operating Systems

Ubuntu: How to get pthread_t from tid [was: AV when using pthread_getname_np()]

<< < (5/5)

PascalDragon:

--- Quote from: Pascal on June 27, 2022, 02:16:40 pm ---Yes, right, it's all about debugging here as mentioned in initial post.
--- End quote ---

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.


--- Quote from: Pascal on June 27, 2022, 02:16:40 pm ---Well, is there really no way to get pthread_t from tid?
--- End quote ---

No, there isn't because pthread_t is a type provided by the C library, not the kernel and an application might not use the C library to create its threads (e.g. by using the clone syscall directly). Thus your safest bet is the comm file as that is provided by the kernel.


--- Quote from: Pascal on June 27, 2022, 02:16:40 pm ---I am thinking of adding a lookup array to Threadmanager (rtl/unix/cthreads.pp) which is updated in CBeginThread.


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---...AddThread(Do_SysCall(syscall_nr_gettid)), threadid);...
--- End quote ---

That would be rejected.

Pascal:

--- Quote from: PascalDragon on June 28, 2022, 01:40:45 pm ---
--- Quote from: Pascal on June 27, 2022, 02:16:40 pm ---Yes, right, it's all about debugging here as mentioned in initial post.
--- End quote ---

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.

--- End quote ---

Well, not that clear, you are right.


--- Quote from: PascalDragon on June 28, 2022, 01:40:45 pm ---
--- Quote from: Pascal on June 27, 2022, 02:16:40 pm ---I am thinking of adding a lookup array to Threadmanager (rtl/unix/cthreads.pp) which is updated in CBeginThread.


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---...AddThread(Do_SysCall(syscall_nr_gettid)), threadid);...
--- End quote ---

That would be rejected.

--- End quote ---

Was rejected as the lookup array will only be available from the debugger process not the other process.

Navigation

[0] Message Index

[*] Previous page

Go to full version