Bug 76821

Summary: Add access to gdb unique thread id
Product: Base System Reporter: Niall Douglas <s_sourceforge>
Component: threadsAssignee: freebsd-threads (Nobody) <threads>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Unspecified   
Hardware: Any   
OS: Any   

Description Niall Douglas 2005-01-29 17:20:03 UTC
It would be really handy if a unique integer could be obtained from struct pthread_t so that one can print debug information to stdout like so:

Thread 12345678 gets 32 bytes from pipe

.. and then in GDB one can match up thread id 12345678 with what gdb knows. Then you can get some idea of which thread is which, something that is currently rather hard :(

Some function like pthread_getid_np() would be ideal.

Cheers,
Niall
Comment 1 Daniel Eischen freebsd_committer freebsd_triage 2005-01-29 18:28:44 UTC
On Sat, 29 Jan 2005, Niall Douglas wrote:

>
> >Number:         76821
> >Category:       threads
> >Synopsis:       Add access to gdb unique thread id
> >Confidential:   no
> >Severity:       non-critical
> >Priority:       low
> >Responsible:    freebsd-threads
> >State:          open
> >Quarter:
> >Keywords:
> >Date-Required:
> >Class:          change-request
> >Submitter-Id:   current-users
> >Arrival-Date:   Sat Jan 29 17:20:03 GMT 2005
> >Closed-Date:
> >Last-Modified:
> >Originator:     Niall Douglas
> >Release:        5.3
> >Organization:
> >Environment:
> >Description:
> It would be really handy if a unique integer could be obtained from struct
pthread_t so that one can print debug information to stdout like so:

You can use pthread_getspecific() or TLS.

-- 
DE
Comment 2 Niall Douglas 2005-01-29 18:47:11 UTC
On 29 Jan 2005 at 13:28, Daniel Eischen wrote:

> > It would be really handy if a unique integer could be obtained from
> > struct
> pthread_t so that one can print debug information to stdout like so:
> 
> You can use pthread_getspecific() or TLS.

Doesn't help from the point of view of seeing which threads in GDB 
match which debug output statements. On Linux this is easy as 
pthread_t is a uint printed by gdb.

How about getting gdb to print the pthread_t pointer address instead? 
I don't care what the number is, so long as I can compare the thread 
listing in gdb to the debug output and it makes sense!

Cheers,
Niall
Comment 3 David Xu freebsd_committer freebsd_triage 2005-04-05 13:49:34 UTC
State Changed
From-To: open->closed

Fixed by printing thread address in gdb.