Dew
Dew

Reputation: 3143

Multithreading and GDB

In a C++ multithreaded environment.There are two thread running and program gets crashed when the second thread try to access something, but the crash happen due to first thread. How can you find out that using GDB.

Upvotes: 2

Views: 208

Answers (1)

neuro
neuro

Reputation: 15180

Use thread 1 and thread 2 (or t 1 and t 2) to switch between threads, and use bt to have the stack trace of the two. Then print some variable to guess which one is badly broken, uninitialized, out of range, etc. :)

Look at the help too. help threads give you hints ...

my2c

Upvotes: 2

Related Questions