Hi, This patch addresses PR gdb/21221. When a user single-steps a source line containing a tight empty loop, GDB currently steps every iteration and only stops once the loop finishes. The patch introduces a heuristic that ends the step after one iteration by detecting when the inferior returns to the first stop PC observed on the same source line. The heuristic is only active in forward execution and includes a safety threshold to avoid runaway steps. A ui_out message is emitted so front-ends can parse the stop reason. Tested by gdb.base/empty-loop-step.exp. Thanks, 白