I'm debugging a crash where a non-main thread uses UIKit drawing methods. I'd like to set a conditional breakpoint on -[UIView layoutSubviews]
that only triggers, if it's executed in a non-main thread. Is this possible?
You can set per-thread breakpoints using the gdb console. For example:
b -[UIView layoutSubviews] thread 2
(You use the gdb "info threads" commands to see what threads exist and what identifier gdb uses for them).
I don't think there's a way to set a breakpoint for every thread except the main thread (thread 1), but if you have a reasonable number of threads you could set breakpoints for each of them individually if necessary.
update:
If the per-thread thing isn't working out because of GCD, another approach you could take would be to just set a regular breakpoint, and set gdb commands for that breakpoint to dump out a backtrace ("where") and then "continue".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With