[PATCH 0/2] Improve handling of thread numbers for reverse execution targets

Magne Hov via Gdb-patches
2023-06-29T08:37:22Z

Hi,

This patchset improves the way thread numbers and thread-specific breakpoints
are handled for reverse execution targets:
- While navigating forwards and backwards in time threads should always be
presented with the same thread number, regardless of whether they have
previously been seen to exit.
- Thread-specific breakpoints must stay inserted when moving backwards in time
even if the corresponding thread has terminated.

The builtin record targets don't support threads well, so I haven't been able to
test with them:
- target record-full does seem to record multiple threads, but it does not seem
to present information about non-main threads at replay time.
- target record-btrace does not seem to let you view or select an exited thread,
even after reversing past the thread exit.

GDB's test suite flagged these regressions, but they appear to be intermittent
between unpatched runs as well:
- gdb.base/step-over-syscall.exp
- gdb.threads/attach-many-short-lived-threads.exp
- gdb.threads/process-dies-while-handling-bp.exp

I have manually tested the info thread command and thread-specific breakpoints
with rr (https://rr-project.org) and UDB (https://undo.io), and the patches have
passed UDB's internal test suite.

I've already signed FSF agreement.

Magne Hov (2):
gdb: keep record of thread numbers for reverse execution targets
gdb: retain thread-specific breakpoints in reverse execution targets

gdb/breakpoint.c | 18 +++++++++++++-----
gdb/inferior.c | 1 +
gdb/inferior.h | 7 +++++++
gdb/thread.c | 38 ++++++++++++++++++++++++++++++++++++--
4 files changed, 57 insertions(+), 7 deletions(-)

--
2.25.1