views:

119

answers:

1

When my Cocoa app hits an assertion in the code, gdb gives me a prompt as expected, but it's never (ok, rarely) in the right thread.

I know I can use Xcode's GUI debugger and it makes it a little less painful, but I'm thinking there has to be a gdb command line trick I don't know.

Is there an easier way of finding the thread that asserted other than changing to each thread and issuing where?

A: 

(gdb) thread apply all bt

Nikolai N Fetissov
This is what I do now. The problem with this is that it only shows the last stack frame which isn't always very helpful so you end up doing a where on each one.
nall
That shows you full stack traces of all running threads so you easily see which one has asserted. I think you are mixing this with 'info threads'.
Nikolai N Fetissov
You're right on. I just needed more coffee. Thanks!
nall
That is only a workaround. And not very comfortable when you have many threads.
Albert
Who said this is going to be comfortable :)
Nikolai N Fetissov