is there any way to get the start time of the thread in gdb core dump

Viewed 188

i am trying to find oldest thread in Linux core dump. So i need get start time of each thread that are running. So is there any way to get the start time of thread.

i tried to some command in gdb core file but that gives each call stack of threads but not start time.

Regards
Rabi

1 Answers

i am trying to find oldest thread in Linux core dump. So i need get start time of each thread that are running.

Your conclusion does not follow from your previous statement.

So is there any way to get the start time of thread.

No: that time is not recorded anywhere in the thread structure.

However, in general Linux allocates thread ids in increasing order, so sorting by thread id should give you the order you desire. For example:

(gdb) info thread
  Id   Target Id                           Frame 
* 1    Thread 0x7fa91e769740 (LWP 2128629) __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
  2    Thread 0x7fa91d766700 (LWP 2128632) 0x0000557aa5787165 in fn ()
  3    Thread 0x7fa91af61700 (LWP 2128637) 0x0000557aa5787165 in fn ()
  4    Thread 0x7fa91df67700 (LWP 2128631) 0x0000557aa5787165 in fn ()
  5    Thread 0x7fa91cf65700 (LWP 2128633) 0x0000557aa5787165 in fn ()
  6    Thread 0x7fa91bf63700 (LWP 2128635) 0x0000557aa5787165 in fn ()
  7    Thread 0x7fa91c764700 (LWP 2128634) 0x0000557aa5787165 in fn ()
  8    Thread 0x7fa91a760700 (LWP 2128638) 0x0000557aa5787165 in fn ()
  9    Thread 0x7fa91b762700 (LWP 2128636) 0x0000557aa5787165 in fn ()
  10   Thread 0x7fa919f5f700 (LWP 2128639) 0x0000557aa5787165 in fn ()

Here you can see that thread 1 was created first, followed by thread 4, 2, 5, 7, etc (LWP is the Linux thread id here).

Related