Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
110 commits
Select commit Hold shift + click to select a range
5590083
Fix interaction of desched sig and vsyscall patching
Keno Jan 12, 2021
a4ca5c7
Add a mechanism to test time slice signal interactions
Keno Jan 12, 2021
f25671d
Handle EINTR (which apparently you can still get on a WNOWAIT waitid(…
khuey Apr 13, 2021
254f53c
Make `rr sources` return full paths for DWOs when possible.
rocallahan Apr 16, 2021
21f2097
Put the resolved DWO path in full_path
rocallahan Apr 16, 2021
7565362
Use toplevel __asm__ instead of __attribute__((naked))
rocallahan Apr 16, 2021
340e04e
Look at ancestors of original_file_name to try to find a build direct…
rocallahan Apr 17, 2021
165f85a
Handle cases where all files in a VCS dir were skipped (e.g. due to n…
rocallahan Apr 17, 2021
7cf2f0f
Suggest /etc/sysctl.d instead of /etc/sysctl.conf
lf- Apr 17, 2021
878f756
Print more info if we get an unexpected status on kill
rocallahan Apr 18, 2021
e63d602
Mark some singlestep flag functions const.
khuey Apr 28, 2021
030e34f
Add microarch id for Zen 3 Cezanne APUs
chris-morgan Apr 29, 2021
565be8d
Mention Pernosco as development sponsor
rocallahan May 10, 2021
01684a8
Copy new bpf commands from kernel headers.
khuey May 10, 2021
ee71f98
Allow BPF_OBJ_GET.
khuey May 10, 2021
2f1271d
Note failing bpf subcommand when we die.
khuey May 10, 2021
78611c3
Make userfaultfd return ENOSYS in the hope this works for some users
rocallahan May 11, 2021
37d6685
Make sure maybe_intercept_mem_request() does not write to invalid memory
sidkshatriya May 8, 2021
996ecf0
Search for external debuginfo by build-id
rocallahan May 11, 2021
63bebd3
Test write monitoring for multiply-mapped shared memory
rocallahan May 14, 2021
c777d06
Remove the attractive nuisance RR_BUILD_SHARED option.
khuey May 11, 2021
ed0964e
Support F_NOTIFY.
khuey May 14, 2021
95629d5
Make EmuFile cloning not materialize hole data
rocallahan May 15, 2021
5c6e992
Support mapping of sparse files by allowing raw-data records to conta…
rocallahan May 13, 2021
d18f580
Fix comment
rocallahan May 15, 2021
29048db
patch_syscall_with_hook() can fail; don't assume it always succeeds
sidkshatriya May 17, 2021
52144d6
Fix error in data_end calculation.
khuey May 18, 2021
6c1c3e2
Don't lose the last hole of the file
rocallahan May 18, 2021
1d82691
Always write a data record even if we read no bytes (restores behavio…
rocallahan May 18, 2021
65631cb
Add test for 52144d683b7b9e213918d61da5bc1b8b14974fab
rocallahan May 18, 2021
ebbbc73
Add forward compatibility version checking
rocallahan May 19, 2021
e9ec388
Fix comment
rocallahan May 19, 2021
fce8713
Fix bugs when traversing raw data records in the presence of holes.
khuey May 20, 2021
57c4dea
Fix find_holes to return holes relative to the given offset
rocallahan May 20, 2021
2a90da3
Fix regression involving offset mutating under us
rocallahan May 20, 2021
7469e11
Change test/shared_monitor.c to use syscall
jalapenopuzzle May 20, 2021
cd65670
Print holes in 'rr dump'
rocallahan May 20, 2021
f922127
Fix 32-bit build by adding cast.
bernhardu May 23, 2021
e627c19
GdbServer: fix diversion exit notification
Bob131 May 23, 2021
d3b38fc
GdbServer: assert around DiversionSession::find_task
Bob131 May 24, 2021
b184eae
Add support for ioctl FS_IOC_FIEMAP.
bernhardu May 23, 2021
e613d1a
gdbinit: query gdb.VERSION
GitMensch May 27, 2021
fb90e88
Fix escape sequence in gdb version regex
MarianJancar May 28, 2021
08e2873
Silence warning
rocallahan May 28, 2021
1bf2fdf
Support pkey_* syscalls
rocallahan May 28, 2021
c62a7c1
Nondeterminisic signals that would normally be fatal to an init proce…
rocallahan May 28, 2021
0fcc204
Enable ioperm syscall.
bernhardu May 29, 2021
5007ed6
Enable iopl syscall.
bernhardu May 29, 2021
7657223
Add ioctl VT_OPENQRY, VT_GETSTATE and KDGKBMODE.
bernhardu May 31, 2021
343ea36
Add ioctl FBIOGET_FSCREENINFO and FBIOGET_VSCREENINFO.
bernhardu May 31, 2021
7c63c0b
Handle traceinfo and replay of traces that never execed successfully …
khuey Jun 2, 2021
59fb6d7
Session: add TaskContext
Bob131 Jun 3, 2021
3fb8ef2
DiversionSession: capture task context before exit
Bob131 Jun 3, 2021
bfbd3ce
Avoid use-after-free of task object in ReplaySession::replay_step.
bernhardu Jun 3, 2021
62b2d4d
PerfCounters_x86.h: add support for AMD A8-3530MX
Hi-Angel Jun 6, 2021
59e55ba
Increase timeout for conditional_breakpoint_offload test.
bernhardu Jun 5, 2021
177a0d6
Use unsigned long instead of int for PTRACE_GETEVENTMSG.
bernhardu Jun 3, 2021
2c78ef4
Change plain char buffer to unique_ptr to free memory at function exit.
bernhardu Jun 7, 2021
7214d96
Close directory after use in read_all_proc_fds.
bernhardu Jun 7, 2021
8c92237
Close directory after use in ls.
bernhardu Jun 7, 2021
a781a47
Close directory after use in get_folder_size.
bernhardu Jun 7, 2021
265cb49
Close directory after use in SourcesCommand::run.
bernhardu Jun 7, 2021
7228160
Syscall-buffer F_SETLK/F_SETLKW on 64-bit systems
rocallahan Jun 7, 2021
0f60b49
We don't need to worry about the value of perf_event_paranoid if we'r…
rocallahan Jun 10, 2021
3e99470
Pass TEST_MONITOR_DEFAULT_TIMEOUT also to 32 bit tests.
bernhardu Jun 9, 2021
49dc4a7
Do not wait for force_close_record_session.
bernhardu Jun 11, 2021
82ab0f9
Add '--tty' option to 'rr replay' to redirect echoed tracee output to…
rocallahan Jun 13, 2021
da2cb40
Don't crash when not using --tty
rocallahan Jun 13, 2021
a386a86
Move pkeys test to x86 dir.
khuey Jun 11, 2021
37dcab8
Move ioperm test to x86 dir.
khuey Jun 11, 2021
3a76090
Implement _raw_syscall for aarch64.
khuey Jun 11, 2021
6ac98b3
Suppress warnings about unused variables on AArch64.
khuey Jun 11, 2021
3e22528
Modify alignment directed for AArch64 which uses powers of 2 instead …
khuey Jun 11, 2021
e717735
Move iopl test to x86 dir.
khuey Jun 11, 2021
cd611e4
sys/io.h is an x86 specific header.
khuey Jun 11, 2021
0d857d3
Implement my_read on AArch64.
khuey Jun 12, 2021
29f8a00
Move ptrace_sysemu to the x86 dir because it's very x86 specific.
khuey Jun 12, 2021
a940db0
Fix typos.
khuey Jun 13, 2021
339c53c
Temporarily skip building librrpreload.so on AArch64.
khuey Jun 13, 2021
09e56d7
Don't make an iovec of an iovec!
khuey Jun 13, 2021
cadfb06
Use external timeout if that is greater.
bernhardu Jun 9, 2021
8345ba6
Support 'end' event spec in 'rr dump' to select the last event in the…
rocallahan Jun 14, 2021
7854be5
Make io_uring return ENOSYS for now
rocallahan Jun 14, 2021
3857152
Ensure our VDSO has DT_HASH and DT_VERSYM/DT_VERDEF/DT_VERDEFNUM entries
rocallahan Jun 16, 2021
24df90a
FS_IOC_FIEMAP can return EOPNOTSUPP
rocallahan Jun 16, 2021
d1b5b78
Fix some missing error handling exits
rocallahan Jun 18, 2021
5cd6e25
Use the correct size for DWARF5 compilation units
rocallahan Jun 18, 2021
5d9c894
Downgrade warnings to infos
rocallahan Jun 18, 2021
5126dac
Support DW_FORM_string
rocallahan Jun 18, 2021
99d3d41
Cache access() calls to avoid syscalls
rocallahan Jun 19, 2021
1d1277e
Fix truly, mind-bogglingly broken ExternalDebugInfo::operator<
rocallahan Jun 19, 2021
18d9e2d
Fix faccess mode argument
rocallahan Jun 21, 2021
b774bec
Change tweak_librrpage.py to relocate the last three sections.
bernhardu Jun 21, 2021
7b5db50
Ensure our 32-bit VDSO has the same additional sections like 64-bit V…
bernhardu Jun 20, 2021
43f2829
Print useful info when assertion fails
rocallahan Jun 22, 2021
6599586
Do not wait for SYNC_TOKEN until timeout exceeds, if subshell died al…
bernhardu Jun 20, 2021
89ae326
Recognize the latest syscalls.
khuey Jun 22, 2021
81decae
Make rseq return ENOSYS for now.
khuey Jun 22, 2021
dfab4e7
Skip call_exit on gdb 9.2
khuey Jun 25, 2021
21cad83
Implement GET_ACTION_AVAIL and GET_NOTIF_SIZES for seccomp
yuyichao Jun 25, 2021
7fd0789
Make block-cloning syscallbuf optimization use privileged syscalls to…
rocallahan Jun 26, 2021
6752032
Move explicit_checkpoints to x86/ because it uses rdtsc.
khuey Jun 28, 2021
2099ff3
implement my_write for gdb_bogus_breakpoint
khuey Jun 28, 2021
26fccb3
Stub out the last couple things that don't work on AArch64.
khuey Jun 28, 2021
713858c
Force use of the LSE-enabled ld.
khuey Jun 28, 2021
bcb7ec1
Keep high resource limits during replay
rocallahan Jun 29, 2021
0a26c2a
Suppress compiler warnings by checking for failed patch matches
rocallahan Jun 29, 2021
782537e
Don't verify seccomp_notif_sizes
rocallahan Jun 29, 2021
bcb7b30
Make error message more informative.
khuey Jun 29, 2021
7797753
Adds support for RDMA_VERBS_IOCTL requests
sodar Oct 6, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 44 additions & 38 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ set(supports32bit true)
set(x86ish false)
if (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "aarch64")
set(supports32bit false)
set(FLAGS_COMMON "${FLAGS_COMMON} -march=armv8.3-a")
set(FLAGS_COMMON "${FLAGS_COMMON} -march=armv8.3-a -Wl,-dynamic-linker=/lib/aarch64-linux-gnu/atomics/ld-linux-aarch64.so.1")
else()
set(x86ish true)
set(FLAGS_COMMON "${FLAGS_COMMON} -msse2 -D__MMX__ -D__SSE__ -D__SSE2__")
Expand Down Expand Up @@ -342,7 +342,7 @@ foreach(file ${RR_PAGE_FILES})
set_source_files_properties("${CMAKE_SOURCE_DIR}/src/preload/${file}"
PROPERTIES COMPILE_FLAGS ${PRELOAD_COMPILE_FLAGS})
endforeach(file)
set_target_properties(rrpage PROPERTIES LINK_FLAGS "-Wl,-T -Wl,${CMAKE_SOURCE_DIR}/src/preload/rr_page.ld -nostartfiles -nostdlib -Wl,-z,max-page-size=0x1000 ${LINKER_FLAGS}")
set_target_properties(rrpage PROPERTIES LINK_FLAGS "-Wl,-T -Wl,${CMAKE_SOURCE_DIR}/src/preload/rr_page.ld -Wl,--hash-style=both -nostartfiles -nostdlib -Wl,-z,max-page-size=0x1000 ${LINKER_FLAGS}")
set_target_properties(rrpage PROPERTIES LINK_DEPENDS ${CMAKE_SOURCE_DIR}/src/preload/rr_page.ld)
# CMake seems to have trouble generating the link line without this
set_target_properties(rrpage PROPERTIES LINKER_LANGUAGE C)
Expand All @@ -364,6 +364,7 @@ set(PRELOAD_SOURCE_FILES
rrcalls.h
syscallbuf.h
)
if (x86ish)
add_library(rrpreload)
foreach(file ${PRELOAD_FILES})
target_sources(rrpreload PUBLIC "${CMAKE_SOURCE_DIR}/src/preload/${file}")
Expand All @@ -372,6 +373,7 @@ foreach(file ${PRELOAD_FILES})
endforeach(file)
set_target_properties(rrpreload PROPERTIES LINK_FLAGS "-nostartfiles ${LINKER_FLAGS}")
set_target_properties(rrpreload PROPERTIES INSTALL_RPATH "\$ORIGIN")
endif()

set(AUDIT_FILES
rtld-audit.c
Expand Down Expand Up @@ -544,29 +546,10 @@ else()
set(CMAKE_INSTALL_INCLUDEDIR "include")
endif()

option(RR_BUILD_SHARED "Build the rr shared library as well as the binary (experimental).")

if(RR_BUILD_SHARED)
add_library(rr ${RR_SOURCES})
set_target_properties(rr PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib)
add_executable(rrbin src/main.cc)
set(RR_BIN rrbin)
post_build_executable(rrbin)
set_target_properties(rrbin PROPERTIES ENABLE_EXPORTS true OUTPUT_NAME rr)
set_target_properties(rrbin PROPERTIES INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
set_target_properties(rrbin PROPERTIES INSTALL_RPATH_USE_LINK_PATH true)
set_target_properties(brotli PROPERTIES POSITION_INDEPENDENT_CODE ON)
target_link_libraries(rrbin rr)
install(TARGETS rr
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
else()
add_executable(rr ${RR_SOURCES} src/main.cc)
set_target_properties(rr PROPERTIES ENABLE_EXPORTS true)
post_build_executable(rr)
set(RR_BIN rr)
endif()
add_executable(rr ${RR_SOURCES} src/main.cc)
set_target_properties(rr PROPERTIES ENABLE_EXPORTS true)
post_build_executable(rr)
set(RR_BIN rr)
add_dependencies(rr Generated)

option(strip "Strip debug info from rr binary")
Expand All @@ -593,13 +576,12 @@ else()
endif()

set_target_properties(rr PROPERTIES LINK_FLAGS "${RR_MAIN_LINKER_FLAGS}")
if(RR_BUILD_SHARED)
set_target_properties(rrbin PROPERTIES LINK_FLAGS "${RR_MAIN_LINKER_FLAGS}")
endif()

if (x86ish)
target_link_libraries(rrpreload
${CMAKE_DL_LIBS}
)
endif()

add_executable(rr_exec_stub src/exec_stub.c)
post_build_executable(rr_exec_stub)
Expand Down Expand Up @@ -661,7 +643,11 @@ install(PROGRAMS scripts/signal-rr-recording.sh
install(PROGRAMS scripts/rr_completion
DESTINATION ${CMAKE_INSTALL_DATADIR}/bash-completion/completions RENAME rr)

install(TARGETS ${RR_BIN} rrpreload rrpage rraudit rr_exec_stub
set(RR_INSTALL_LIBS rrpage rraudit rr_exec_stub)
if (x86ish)
set(RR_INSTALL_LIBS rrpreload ${RR_INSTALL_LIBS})
endif()
install(TARGETS ${RR_BIN} ${RR_INSTALL_LIBS}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/rr
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}/rr)
Expand All @@ -686,7 +672,7 @@ if(rr_32BIT AND rr_64BIT)
PROPERTIES COMPILE_FLAGS "-m32 ${PRELOAD_COMPILE_FLAGS}")
endforeach(file)

set_target_properties(rrpage_32 PROPERTIES LINK_FLAGS "-m32 -Wl,-T -Wl,${CMAKE_SOURCE_DIR}/src/preload/rr_page.ld -nostartfiles -nostdlib ${LINKER_FLAGS}")
set_target_properties(rrpage_32 PROPERTIES LINK_FLAGS "-m32 -Wl,-T -Wl,${CMAKE_SOURCE_DIR}/src/preload/rr_page.ld -Wl,--hash-style=both -nostartfiles -nostdlib ${LINKER_FLAGS}")
set_target_properties(rrpage_32 PROPERTIES LINK_DEPENDS ${CMAKE_SOURCE_DIR}/src/preload/rr_page.ld)
set_target_properties(rrpage_32 PROPERTIES LINKER_LANGUAGE C)

Expand Down Expand Up @@ -785,6 +771,7 @@ set(BASIC_TESTS
big_buffers
block
block_open
bpf
brk
brk2
capget
Expand Down Expand Up @@ -835,10 +822,12 @@ set(BASIC_TESTS
exit_with_syscallbuf_signal
fadvise
fanotify
fatal_init_signal
fatal_sigsegv_thread
fcntl_dupfd
x86/fault_in_code_page
fcntl_dupfd
fcntl_misc
fcntl_notify
fcntl_owner_ex
fcntl_rw_hints
fcntl_seals
Expand Down Expand Up @@ -884,17 +873,23 @@ set(BASIC_TESTS
invalid_fcntl
invalid_ioctl
io
io_uring
ioctl
ioctl_fb
ioctl_fs
ioctl_pty
ioctl_sg
ioctl_tty
ioctl_vt
x86/ioperm
x86/iopl
join_threads
joystick
kcmp
keyctl
kill_newborn
kill_ptracee
large_hole
large_write_deadlock
legacy_ugid
x86/lsl
Expand Down Expand Up @@ -965,6 +960,7 @@ set(BASIC_TESTS
pid_ns_reap
pid_ns_segv
pidfd
x86/pkeys
poll_sig_race
ppoll
prctl
Expand Down Expand Up @@ -1002,7 +998,7 @@ set(BASIC_TESTS
ptrace_singlestep
ptrace_syscall
ptrace_syscall_clone_untraced
ptrace_sysemu
x86/ptrace_sysemu
ptrace_sysemu_syscall
ptrace_trace_clone
ptrace_trace_exit
Expand All @@ -1026,6 +1022,7 @@ set(BASIC_TESTS
rename
rlimit
robust_futex
rseq
rusage
samask
save_data_fd
Expand All @@ -1037,6 +1034,7 @@ set(BASIC_TESTS
scm_rights
scratch_read
seccomp
seccomp_cloning
seccomp_clone_fail
seccomp_desched
seccomp_kill_exit
Expand All @@ -1058,6 +1056,8 @@ set(BASIC_TESTS
setsid
setuid
shared_exec
shared_monitor
shared_offset
shared_write
shm
shm_unmap
Expand Down Expand Up @@ -1092,6 +1092,7 @@ set(BASIC_TESTS
sigtrap
simple_threads_stress
sioc
small_holes
sock_names_opts
spinlock_priorities
splice
Expand Down Expand Up @@ -1140,12 +1141,15 @@ set(BASIC_TESTS
unexpected_exit_pid_ns
unjoined_thread
unshare
userfaultfd
utimes
vdso_parts
vfork_flush
vfork_shared
video_capture
vm_readv_writev
vsyscall
vsyscall_timeslice
x86/x87env
wait
wait_sigstop
Expand Down Expand Up @@ -1224,7 +1228,8 @@ set(TESTS_WITH_PROGRAM
exit_group
exit_race
exit_status
explicit_checkpoints
x86/explicit_checkpoints
fd_limit
fork_stress
fork_syscalls
function_calls
Expand Down Expand Up @@ -1318,8 +1323,8 @@ set(TESTS_WITH_PROGRAM
ttyname
unexpected_stack_growth
user_ignore_sig
vdso_gettimeofday_stack
vdso_clock_gettime_stack
vdso_gettimeofday_stack
vdso_time_stack
vfork
vfork_read_clone_stress
Expand Down Expand Up @@ -1432,6 +1437,7 @@ set(TESTS_WITHOUT_PROGRAM
syscallbuf_timeslice_250
trace_version
term_trace_cpu
tty
unmap_vdso
unwind_on_signal
vfork_exec
Expand Down Expand Up @@ -1666,20 +1672,20 @@ if(BUILD_TESTS)
foreach(test ${BASIC_TESTS} ${BASIC_CPP_TESTS} ${OTHER_TESTS})
get_filename_component(testname ${test} NAME)
add_test(${test}-32
bash source_dir/src/test/basic_test.run ${testname}_32 "" bin_dir)
bash source_dir/src/test/basic_test.run ${testname}_32 "" bin_dir ${TEST_MONITOR_DEFAULT_TIMEOUT})
configure_test(${test}-32)
add_test(${test}-32-no-syscallbuf
bash source_dir/src/test/basic_test.run ${testname}_32 -n bin_dir)
bash source_dir/src/test/basic_test.run ${testname}_32 -n bin_dir ${TEST_MONITOR_DEFAULT_TIMEOUT})
configure_test(${test}-32-no-syscallbuf)
endforeach(test)

foreach(test ${TESTS_WITH_PROGRAM} ${TESTS_WITHOUT_PROGRAM})
get_filename_component(testname ${test} NAME)
add_test(${test}-32
bash source_dir/src/test/${test}.run ${testname}_32 "" bin_dir)
bash source_dir/src/test/${test}.run ${testname}_32 "" bin_dir ${TEST_MONITOR_DEFAULT_TIMEOUT})
configure_test(${test}-32)
add_test(${test}-32-no-syscallbuf
bash source_dir/src/test/${test}.run ${testname}_32 -n bin_dir)
bash source_dir/src/test/${test}.run ${testname}_32 -n bin_dir ${TEST_MONITOR_DEFAULT_TIMEOUT})
configure_test(${test}-32-no-syscallbuf)
endforeach(test)
endif()
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ Please contribute! Make sure to review the [pull request checklist](/CONTRIBUTI

If you find rr useful, please [add a testimonial](https://github.com/rr-debugger/rr/wiki/Testimonials).

rr development is sponsored by [Pernosco](https://pernos.co) and was originated by [Mozilla](https://www.mozilla.org).

# System requirements

* Linux kernel ≥ 3.11 is required (for `PTRACE_SETSIGMASK`).
Expand Down
5 changes: 5 additions & 0 deletions src/AutoRemoteSyscalls.cc
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,11 @@ AutoRemoteSyscalls::AutoRemoteSyscalls(Task* t,
}

void AutoRemoteSyscalls::setup_path(bool enable_singlestep_path) {
#if defined(__aarch64__)
// XXXkhuey this fast path doesn't work on AArch64 yet, go slow instead
enable_singlestep_path = false;
#endif

if (!replaced_bytes.empty()) {
// XXX what to do here to clean up if the task died unexpectedly?
t->write_mem(remote_ptr<uint8_t>(initial_regs.ip().to_data_ptr<uint8_t>()),
Expand Down
2 changes: 0 additions & 2 deletions src/AutoRemoteSyscalls.h
Original file line number Diff line number Diff line change
Expand Up @@ -289,8 +289,6 @@ class AutoRemoteSyscalls {

AutoRemoteSyscalls& operator=(const AutoRemoteSyscalls&) = delete;
AutoRemoteSyscalls(const AutoRemoteSyscalls&) = delete;
void* operator new(size_t) = delete;
void operator delete(void*) = delete;
};

} // namespace rr
Expand Down
7 changes: 7 additions & 0 deletions src/DiversionSession.cc
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,15 @@ DiversionSession::DiversionResult DiversionSession::diversion_step(

// An exit might have occurred while processing a previous syscall.
if (t->ptrace_event() == PTRACE_EVENT_EXIT) {
// We're about to destroy the task, so capture the context while
// we can.
TaskContext context(t);
handle_ptrace_exit_event(t);
// This is now a dangling pointer, so clear it.
context.task = nullptr;
result.status = DIVERSION_EXITED;
result.break_status.task_context = context;
result.break_status.task_exit = true;
return result;
}

Expand Down
Loading