原始邮件
发件人:白 <597498687@qq.com> 发件时间:2026年8月17日 18:07 收件人:gdb-patches <gdb-patches@sourceware.org> 主题:[PATCH] infrun: Introduce empty-loop step heuristic |
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,
Bai
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,
Bai