Categories
Uncategorized

Watching program flow in a time-sensitive situation

I’m working on some unit test in Java (well, Kotlin) for an Android project. When I set a breakpoint, the failure mode changes because there are timeouts and races going on. This is not an ideal situation, but I’m debugging someone else’s code here. So I found a clever way to log what code is getting called, and from where, by using breakpoint actions. Just put `new RuntimeException().printStackTrace()` in as a breakpoint action! Now your log shows when code got hit, and why it got there, but doesn’t actually stop execution, so it does less intrusive shift to the timeouts and race-conditions.