I'm seeing some problems when (attempting to) use checkpoints with multiple inferiors. I'll describe two such cases below... Build gdb and make your CWD the gdb directory containing the gdb executable. Then run the following test: make check TESTS=gdb.multi/base.exp This test should have all passes; I see 27 passes when I do it. I'll use the programs associated with this test to demonstrate some bugs. Now, start GDB as follows: ./gdb -q -iex 'set debuginfod enabled off' Turning debuginfod off (or on) prevents GDB from asking the question about using debuginfod, allowing us to paste the following commands to GDB all at once. Run the following commands within the GDB session: file testsuite/outputs/gdb.multi/base/hello start add-inferior -exec testsuite/outputs/gdb.multi/base/goodbye inferior 2 start checkpoint step inferior 1 detach Upon execution of the detach command, an internal error will occur. A different internal error may be caused by doing 'restart 0' instead of 'detach'. Example session showing the bug (detach): kev@f39-1:gdb$ ./gdb -q -iex 'set debuginfod enabled off' (gdb) file testsuite/outputs/gdb.multi/base/hello Reading symbols from testsuite/outputs/gdb.multi/base/hello... (gdb) start Temporary breakpoint 1 at 0x401199: file /mesquite2/sourceware-git/f39-master/bld/../../worktree-master/gdb/testsuite/gdb.multi/hello.c, line 51. Starting program: /mesquite2/sourceware-git/f39-master/bld/gdb/testsuite/outputs/gdb.multi/base/hello [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib64/libthread_db.so.1". Temporary breakpoint 1, main () at /mesquite2/sourceware-git/f39-master/bld/../../worktree-master/gdb/testsuite/gdb.multi/hello.c:51 51 alarm (240); (gdb) add-inferior -exec testsuite/outputs/gdb.multi/base/goodbye [New inferior 2] Added inferior 2 on connection 1 (native) Reading symbols from testsuite/outputs/gdb.multi/base/goodbye... (gdb) inferior 2 [Switching to inferior 2 [<null>] (/mesquite2/sourceware-git/f39-master/bld/gdb/testsuite/outputs/gdb.multi/base/goodbye)] (gdb) start Temporary breakpoint 2 at 0x401199: -qualified main. (2 locations) Starting program: /mesquite2/sourceware-git/f39-master/bld/gdb/testsuite/outputs/gdb.multi/base/goodbye [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib64/libthread_db.so.1". Thread 2.1 "goodbye" hit Temporary breakpoint 2.2, main () at /mesquite2/sourceware-git/f39-master/bld/../../worktree-master/gdb/testsuite/gdb.multi/goodbye.c:61 61 mailand(); (gdb) checkpoint checkpoint 1: fork returned pid 239943. (gdb) step mailand () at /mesquite2/sourceware-git/f39-master/bld/../../worktree-master/gdb/testsuite/gdb.multi/goodbye.c:46 46 glob = 46; (gdb) inferior 1 [Switching to inferior 1 [process 239939] (/mesquite2/sourceware-git/f39-master/bld/gdb/testsuite/outputs/gdb.multi/base/hello)] [Switching to thread 1.1 (Thread 0x7ffff7cd3740 (LWP 239939))] #0 main () at /mesquite2/sourceware-git/f39-master/bld/../../worktree-master/gdb/testsuite/gdb.multi/hello.c:51 51 alarm (240); (gdb) detach /mesquite2/sourceware-git/f39-master/bld/../../worktree-master/gdb/linux-nat.c:624: internal-error: lwp_lwpid_htab_add_lwp: Assertion `slot != NULL && *slot == NULL' failed. A problem internal to GDB has been detected, further debugging may prove unreliable. ----- Backtrace ----- 0x4ef132 gdb_internal_backtrace_1 /mesquite2/sourceware-git/f39-master/bld/../../worktree-master/gdb/bt-utils.c:122 0x4ef132 _Z22gdb_internal_backtracev /mesquite2/sourceware-git/f39-master/bld/../../worktree-master/gdb/bt-utils.c:168 0x8d9074 internal_vproblem /mesquite2/sourceware-git/f39-master/bld/../../worktree-master/gdb/utils.c:396 0x8d92f8 _Z15internal_verrorPKciS0_P13__va_list_tag /mesquite2/sourceware-git/f39-master/bld/../../worktree-master/gdb/utils.c:476 0xa1e431 _Z18internal_error_locPKciS0_z /mesquite2/sourceware-git/f39-master/bld/../../worktree-master/gdbsupport/errors.cc:58 0x6c4a41 lwp_lwpid_htab_add_lwp /mesquite2/sourceware-git/f39-master/bld/../../worktree-master/gdb/linux-nat.c:624 0x6c4a41 add_initial_lwp /mesquite2/sourceware-git/f39-master/bld/../../worktree-master/gdb/linux-nat.c:792 0x6c7d58 add_lwp /mesquite2/sourceware-git/f39-master/bld/../../worktree-master/gdb/linux-nat.c:806 0x6c7d58 _Z21linux_nat_switch_fork6ptid_t /mesquite2/sourceware-git/f39-master/bld/../../worktree-master/gdb/linux-nat.c:887 0x6c28fe fork_load_infrun_state /mesquite2/sourceware-git/f39-master/bld/../../worktree-master/gdb/linux-fork.c:219 0x6c343b _Z17linux_fork_detachi /mesquite2/sourceware-git/f39-master/bld/../../worktree-master/gdb/linux-fork.c:381 0x6c8bd8 _ZN16linux_nat_target6detachEP8inferiori /mesquite2/sourceware-git/f39-master/bld/../../worktree-master/gdb/linux-nat.c:1436 0x6d8652 _ZN16thread_db_target6detachEP8inferiori /mesquite2/sourceware-git/f39-master/bld/../../worktree-master/gdb/linux-thread-db.c:1385 0x85e943 _Z13target_detachP8inferiori /mesquite2/sourceware-git/f39-master/bld/../../worktree-master/gdb/target.c:2526 0x680aed _Z14detach_commandPKci /mesquite2/sourceware-git/f39-master/bld/../../worktree-master/gdb/infcmd.c:2863 0x5224ac _Z8cmd_funcP16cmd_list_elementPKci /mesquite2/sourceware-git/f39-master/bld/../../worktree-master/gdb/cli/cli-decode.c:2735 0x86cd0a _Z15execute_commandPKci /mesquite2/sourceware-git/f39-master/bld/../../worktree-master/gdb/top.c:575 0x600c4f _Z15command_handlerPKc /mesquite2/sourceware-git/f39-master/bld/../../worktree-master/gdb/event-top.c:552 0x60204a _Z20command_line_handlerOSt10unique_ptrIcN3gdb13xfree_deleterIcEEE /mesquite2/sourceware-git/f39-master/bld/../../worktree-master/gdb/event-top.c:788 0x60149b gdb_rl_callback_handler /mesquite2/sourceware-git/f39-master/bld/../../worktree-master/gdb/event-top.c:259 0x91ef44 rl_callback_read_char /mesquite2/sourceware-git/f39-master/bld/../../worktree-master/readline/readline/callback.c:290 0x6015bd gdb_rl_callback_read_char_wrapper_noexcept /mesquite2/sourceware-git/f39-master/bld/../../worktree-master/gdb/event-top.c:195 0x60173c gdb_rl_callback_read_char_wrapper /mesquite2/sourceware-git/f39-master/bld/../../worktree-master/gdb/event-top.c:234 0x8a763f stdin_event_handler /mesquite2/sourceware-git/f39-master/bld/../../worktree-master/gdb/ui.c:155 0xa1ed35 gdb_wait_for_event /mesquite2/sourceware-git/f39-master/bld/../../worktree-master/gdbsupport/event-loop.cc:716 0xa1f826 _Z16gdb_do_one_eventi /mesquite2/sourceware-git/f39-master/bld/../../worktree-master/gdbsupport/event-loop.cc:217 0x6e92c9 start_event_loop /mesquite2/sourceware-git/f39-master/bld/../../worktree-master/gdb/main.c:407 0x6e92c9 captured_command_loop /mesquite2/sourceware-git/f39-master/bld/../../worktree-master/gdb/main.c:471 0x6ebba4 captured_main /mesquite2/sourceware-git/f39-master/bld/../../worktree-master/gdb/main.c:1324 0x6ebba4 _Z8gdb_mainP18captured_main_args /mesquite2/sourceware-git/f39-master/bld/../../worktree-master/gdb/main.c:1343 0x446ad4 main /mesquite2/sourceware-git/f39-master/bld/../../worktree-master/gdb/gdb.c:39 --------------------- /mesquite2/sourceware-git/f39-master/bld/../../worktree-master/gdb/linux-nat.c:624: internal-error: lwp_lwpid_htab_add_lwp: Assertion `slot != NULL && *slot == NULL' failed. A problem internal to GDB has been detected, further debugging may prove unreliable. Example session showing the bug (restart 0): kev@f39-1:gdb$ ./gdb -q -iex 'set debuginfod enabled off' (gdb) file testsuite/outputs/gdb.multi/base/hello Reading symbols from testsuite/outputs/gdb.multi/base/hello... (gdb) start Temporary breakpoint 1 at 0x401199: file /mesquite2/sourceware-git/f39-master/bld/../../worktree-master/gdb/testsuite/gdb.multi/hello.c, line 51. Starting program: /mesquite2/sourceware-git/f39-master/bld/gdb/testsuite/outputs/gdb.multi/base/hello [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib64/libthread_db.so.1". Temporary breakpoint 1, main () at /mesquite2/sourceware-git/f39-master/bld/../../worktree-master/gdb/testsuite/gdb.multi/hello.c:51 51 alarm (240); (gdb) add-inferior -exec testsuite/outputs/gdb.multi/base/goodbye [New inferior 2] Added inferior 2 on connection 1 (native) Reading symbols from testsuite/outputs/gdb.multi/base/goodbye... (gdb) inferior 2 [Switching to inferior 2 [<null>] (/mesquite2/sourceware-git/f39-master/bld/gdb/testsuite/outputs/gdb.multi/base/goodbye)] (gdb) start Temporary breakpoint 2 at 0x401199: -qualified main. (2 locations) Starting program: /mesquite2/sourceware-git/f39-master/bld/gdb/testsuite/outputs/gdb.multi/base/goodbye [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib64/libthread_db.so.1". Thread 2.1 "goodbye" hit Temporary breakpoint 2.2, main () at /mesquite2/sourceware-git/f39-master/bld/../../worktree-master/gdb/testsuite/gdb.multi/goodbye.c:61 61 mailand(); (gdb) checkpoint checkpoint 1: fork returned pid 240018. (gdb) step mailand () at /mesquite2/sourceware-git/f39-master/bld/../../worktree-master/gdb/testsuite/gdb.multi/goodbye.c:46 46 glob = 46; (gdb) inferior 1 [Switching to inferior 1 [process 240014] (/mesquite2/sourceware-git/f39-master/bld/gdb/testsuite/outputs/gdb.multi/base/hello)] [Switching to thread 1.1 (Thread 0x7ffff7cd3740 (LWP 240014))] #0 main () at /mesquite2/sourceware-git/f39-master/bld/../../worktree-master/gdb/testsuite/gdb.multi/hello.c:51 51 alarm (240); (gdb) restart 0 /mesquite2/sourceware-git/f39-master/bld/../../worktree-master/gdb/linux-fork.c:736: internal-error: linux_fork_context: Assertion `oldfp != NULL' failed. A problem internal to GDB has been detected, further debugging may prove unreliable. ----- Backtrace ----- 0x4ef132 gdb_internal_backtrace_1 /mesquite2/sourceware-git/f39-master/bld/../../worktree-master/gdb/bt-utils.c:122 0x4ef132 _Z22gdb_internal_backtracev /mesquite2/sourceware-git/f39-master/bld/../../worktree-master/gdb/bt-utils.c:168 0x8d9074 internal_vproblem /mesquite2/sourceware-git/f39-master/bld/../../worktree-master/gdb/utils.c:396 0x8d92f8 _Z15internal_verrorPKciS0_P13__va_list_tag /mesquite2/sourceware-git/f39-master/bld/../../worktree-master/gdb/utils.c:476 0xa1e431 _Z18internal_error_locPKciS0_z /mesquite2/sourceware-git/f39-master/bld/../../worktree-master/gdbsupport/errors.cc:58 0x6c3e50 linux_fork_context /mesquite2/sourceware-git/f39-master/bld/../../worktree-master/gdb/linux-fork.c:736 0x6c3e50 restart_command /mesquite2/sourceware-git/f39-master/bld/../../worktree-master/gdb/linux-fork.c:761 0x5224ac _Z8cmd_funcP16cmd_list_elementPKci /mesquite2/sourceware-git/f39-master/bld/../../worktree-master/gdb/cli/cli-decode.c:2735 0x86cd0a _Z15execute_commandPKci /mesquite2/sourceware-git/f39-master/bld/../../worktree-master/gdb/top.c:575 0x600c4f _Z15command_handlerPKc /mesquite2/sourceware-git/f39-master/bld/../../worktree-master/gdb/event-top.c:552 0x60204a _Z20command_line_handlerOSt10unique_ptrIcN3gdb13xfree_deleterIcEEE /mesquite2/sourceware-git/f39-master/bld/../../worktree-master/gdb/event-top.c:788 0x60149b gdb_rl_callback_handler /mesquite2/sourceware-git/f39-master/bld/../../worktree-master/gdb/event-top.c:259 0x91ef44 rl_callback_read_char /mesquite2/sourceware-git/f39-master/bld/../../worktree-master/readline/readline/callback.c:290 0x6015bd gdb_rl_callback_read_char_wrapper_noexcept /mesquite2/sourceware-git/f39-master/bld/../../worktree-master/gdb/event-top.c:195 0x60173c gdb_rl_callback_read_char_wrapper /mesquite2/sourceware-git/f39-master/bld/../../worktree-master/gdb/event-top.c:234 0x8a763f stdin_event_handler /mesquite2/sourceware-git/f39-master/bld/../../worktree-master/gdb/ui.c:155 0xa1ed35 gdb_wait_for_event /mesquite2/sourceware-git/f39-master/bld/../../worktree-master/gdbsupport/event-loop.cc:716 0xa1f826 _Z16gdb_do_one_eventi /mesquite2/sourceware-git/f39-master/bld/../../worktree-master/gdbsupport/event-loop.cc:217 0x6e92c9 start_event_loop /mesquite2/sourceware-git/f39-master/bld/../../worktree-master/gdb/main.c:407 0x6e92c9 captured_command_loop /mesquite2/sourceware-git/f39-master/bld/../../worktree-master/gdb/main.c:471 0x6ebba4 captured_main /mesquite2/sourceware-git/f39-master/bld/../../worktree-master/gdb/main.c:1324 0x6ebba4 _Z8gdb_mainP18captured_main_args /mesquite2/sourceware-git/f39-master/bld/../../worktree-master/gdb/main.c:1343 0x446ad4 main /mesquite2/sourceware-git/f39-master/bld/../../worktree-master/gdb/gdb.c:39 --------------------- /mesquite2/sourceware-git/f39-master/bld/../../worktree-master/gdb/linux-fork.c:736: internal-error: linux_fork_context: Assertion `oldfp != NULL' failed. A problem internal to GDB has been detected, further debugging may prove unreliable.
I plan to work on this, so I'm assigning it to myself.