[all-commits] [llvm/llvm-project] 27c788: [lldb-dap] Restore the override FD used by the out...
John Harrison via All-commits
all-commits at lists.llvm.org
Thu Mar 6 13:57:28 PST 2025
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 27c788de759472316169795fa06d592221ac602e
https://github.com/llvm/llvm-project/commit/27c788de759472316169795fa06d592221ac602e
Author: John Harrison <harjohn at google.com>
Date: 2025-03-06 (Thu, 06 Mar 2025)
Changed paths:
M lldb/test/API/tools/lldb-dap/io/TestDAP_io.py
M lldb/tools/lldb-dap/DAP.cpp
M lldb/tools/lldb-dap/OutputRedirector.cpp
M lldb/tools/lldb-dap/OutputRedirector.h
Log Message:
-----------
[lldb-dap] Restore the override FD used by the output redirect on stop. (#129964)
While running lldb-dap over stdin/stdout the `stdout` and `stderr` FD's
are replaced with a pipe that is reading the output to forward to the
dap client. During shutdown we were not properly restoring those FDs,
which means if any component attempted to write to stderr it would
trigger a SIGPIPE due to the pipe being closed during the shutdown
process. This can happen if we have an error reported from the
`DAP::Loop` call that would then log to stderr, such as an error parsing
a malformed DAP message or if lldb-dap crashed and it was trying to
write the stack trace to stderr.
There is one place we were not handling an `llvm::Error` if there was no
logging setup that could trigger this condition.
To address this, I updated the OutputRedirector to restore the FD to the
prior state when `Stop` is called.
---------
Co-authored-by: Jonas Devlieghere <jonas at devlieghere.com>
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list