Ticket #295 (closed enhancement: fixed)

Opened 14 years ago

Last modified 14 years ago

[Patch] Name threads to ease debugging

Reported by: adi Assigned to:
Priority: trivial Milestone: FFADO 2.1
Component: generic Version: FFADO SVN (trunk)
Keywords: Cc:
The device the bug applies to:

Description

Hi!

According to http://0pointer.de/blog/projects/name-your-threads.html, it's possible to give names to pthreads.

This could be especially helpful in debugging sessions, either to find the corresponding RTPRIOs or even later to discover where things go wrong. gdb support for thread names is on its way.

glibc has recently added the corresponding pthread_setname_np and pthread_getname_np functions, however, this functionaly won't be available for endusers anytime soon, so we have to stick to prctl instead.

The attached patch names the FFADO threads. This is the output *without* the patch:

adi@hex:/root/ffado-trunk/libffado$ cat /proc/`pgrep jackd`/task/*/comm
jackd
jackd
jackd
jackd
jackd
jackd
jackd
jackd
jackd
jackd
jackd
jackd
jackd
jackd

And here now the result with the patch applied:

adi@hex:/root/ffado-trunk/libffado$ cat /proc/`pgrep jackd`/task/*/comm
jackd
jackd
jackd
jackd
WDGHBT
WDGCHK
BUSRST
ARMSTD
ARMRT
CTRHLP
ISOXMT
ISORCV
jackd
jackd

Looks useful, isn't it? ;)

Attachments

ffado-threadnames.patch (0.6 kB) - added by adi on 07/21/10 09:58:22.

Change History

07/21/10 09:58:22 changed by adi

  • attachment ffado-threadnames.patch added.

07/21/10 10:13:29 changed by adi

  • summary changed from Name threads to ease debugging to [Patch] Name threads to ease debugging.

09/12/10 12:48:49 changed by arnonym

  • status changed from new to closed.
  • resolution set to fixed.
  • milestone set to FFADO 2.1.

Applied a modified version in r1894.