thread debugging

These situations came up in a separate conversation with Ed Maste, and I’m e-mailing to get thoughts on what the expected behavior would be.

This is all done with clang 3.3 on Ubuntu 12.04 x64. Code here:

For case #1, I set a breakpoint on the final printf() statement, hit run, and everything runs like I’d expect.

For case #2, I set a breakpoint on the sleep call in the threadproc, and the sleep call in main.

  • When it hits the breakpoint in threadproc, it also seems to hit some thread spawned breakpoint at the same time. Is this expected? We don’t see anything about this breakpoint in the first run.
  • When I type “n”, it looks like we hit two breakpoints again at the same time - the one in main and the one in threadproc. This also seems a bit confusing. Which thread am I on? I don’t believe I’ve ever used a debugger that shows two breakpoints being hit at the same time before. Would it make sense to queue them up and show them one at a time?