I am having trouble reducing a large and heavily multi-threaded program (with many SIGPROFs) to a publishable test case, but I have been intermittently hitting the following assertion in gdb's "resume" function: gdb_assert (pc_in_thread_step_range (pc, tp)); The PC is in a function called inside the step range, and therefore you would expect process_event_stop_test's checks for this (starting with the comment, "We stepped out of the stepping range") to catch it and fix it up. But the problem is that the thread out of the step range is not the currently stepped thread. Process_event_stop_test calls switch_back_to_stepped_thread, which, in turn, calls resume, bypassing the extra logic in process_event_stop_test to fix up the step range, and leading to the assertion error. But I don't see any reason to assume that only the current thread would need the additional cleanup found in process_event_stop_test. In fact, switch_back_to_stepped_thread has a special case (hidden in currently_stepping_or_nexting_callback), to _prevent_ it from restarting the current thread, presumably so it that thread can get the additional cleanup. The enclosed patch does two things: 1. Adds a large amount of tracing, which helped me diagnose the problem. 2. Changes switch_back_to_stepped_thread to still switch back to a stepped thread, but to avoid restarting it, allowing the additional checks in process_event_stop_test to work their magic. The GDB testsuite still passes (in particular, no new failures in testsuite/gdb.threads), but I know there are a lot of subtleties here. This is the best fix I can come up with, but are there any other suggestions on how to approach the problem? (I'll do a ChangeLog entry after taking comments.) Thanks, Sterling