forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 341
Cherrypick commits to synchronize the debugger output and error stream #10370
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
JDevlieghere
merged 9 commits into
stable/20240723
from
cherrypick-output-error-stream-locking
Mar 28, 2025
Merged
Cherrypick commits to synchronize the debugger output and error stream #10370
JDevlieghere
merged 9 commits into
stable/20240723
from
cherrypick-output-error-stream-locking
Mar 28, 2025
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Remove Debugger::GetOutputStream and Debugger::GetErrorStream in preparation for replacing both with a new variant that needs to be locked and hence can't be handed out like we do right now. The patch replaces most uses with GetAsyncOutputStream and GetAsyncErrorStream respectively. There methods return new StreamSP objects that automatically get flushed on destruction. See llvm#126630 for more details. (cherry picked from commit eff3c34)
Similar to llvm#126821, in support of llvm#126630. (cherry picked from commit ed32d85)
- Remove _ap (auto_ptr) suffix with _up (unique_ptr) suffix - Move forward declaration from IOHandler.h to IOHandlerCursesGUI.h - Move curses namespace under lldb_private Motivated by Alex' comment in llvm#126630. (cherry picked from commit 776fa2d)
A handful of minor improvements to StreamAsynchronousIO: - Document the class. - Use a named enum value to distinguishing between stdout and stderr. - Add missing period to comment. - Clear the string instead of assigning to it. - Eliminate color argument. (cherry picked from commit 70e693c)
Implement ansi::StripAnsiTerminalCodes and fix a long standing bug where using format strings in lldb's prompt resulted in an incorrect prompt column width. (cherry picked from commit 2841cdb)
This patch improves the synchronization of the debugger's output and error streams using two new abstractions: `LockableStreamFile` and `LockedStreamFile`. - `LockableStreamFile` is a wrapper around a `StreamFile` and a mutex. Client cannot use the `StreamFile` without calling `Lock`, which returns a `LockedStreamFile`. - `LockedStreamFile` is an RAII object that locks the stream for the duration of its existence. As long as you hold on to the returned object you are permitted to write to the stream. The destruction of the object automatically flush the output stream. (cherry picked from commit 58279d1)
Make StreamAsynchronousIO an unique_ptr instead of a shared_ptr. I tried passing the class by value, but the llvm::raw_ostream forwarder stored in the Stream parent class isn't movable and I don't think it's worth changing that. Additionally, there's a few places that expect a StreamSP, which are easily created from a StreamUP. (cherry picked from commit 78d82d3)
Should fix the following compile error on Windows: C:\Python312\include\pyconfig.h(225): error C2371: 'pid_t': redefinition; different basic types C:\buildbot\as-builder-10\lldb-x-aarch64\llvm-project\lldb\include\lldb/Host/windows/PosixApi.h(80): note: see declaration of 'pid_t' (cherry picked from commit 57bac14)
@swift-ci test |
Unrelated test failure: @swift-ci test macos |
adrian-prantl
approved these changes
Mar 28, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
#10368 + 57bac14