0

I have a core dump and I want to get a Linux tid of a pthread in it using gdb. I have reached the point using this answer:

(gdb) p &this->m_thread->m_state->m_Thread
$29 = (pthread_t *) 0x7f05f84bde00

(gdb) p &((struct pthread *)(&this->m_thread->m_state->m_Thread))->tid
$28 = (pid_t *) 0x7f05f84be0d0

(gdb) p *&((struct pthread *)(&this->m_thread->m_state->m_Thread))->tid
$30 = 136478480

But the value does not look like LWP 2977, ... LWP 5110 that I can see when doing info threads. What do I do wrong?

JenyaKh
  • 2,040
  • 17
  • 25
  • 1
    What does `p this->m_thread->m_state->m_Thread` show? Because I think what you actually need to do is `p ((struct pthread *)this->m_thread->m_state->m_Thread)->tid`. – ssbssa Aug 04 '23 at 09:10
  • OHHHHHH, I don't understand yet but it worked!!!!!!!!! Thank you! Write your answer please! I want to upvote and accept! – JenyaKh Aug 04 '23 at 09:19

0 Answers0