Author: karzan Date: 2024-03-11T10:07:12-07:00 New Revision: 501bc101c04675969ab673b247f2a58fa72bd09e
URL: https://github.com/llvm/llvm-project/commit/501bc101c04675969ab673b247f2a58fa72bd09e DIFF: https://github.com/llvm/llvm-project/commit/501bc101c04675969ab673b247f2a58fa72bd09e.diff LOG: [lldb] Save the edited line before clearing it in Editline::PrintAsync (#84154) If the `m_editor_status` is `EditorStatus::Editing`, PrintAsync clears the currently edited line. In some situations, the edited line is not saved. After the stream flushes, PrintAsync tries to display the unsaved line, causing the loss of the edited line. The issue arose while I was debugging REPRLRun in [Fuzzilli](https://github.com/googleprojectzero/fuzzilli). I started LLDB and attempted to set a breakpoint in libreprl-posix.c. I entered `breakpoint set -f lib` and used the "tab" key for command completion. After completion, the edited line was flushed, leaving a blank line. Added: Modified: lldb/source/Host/common/Editline.cpp Removed: ################################################################################ diff --git a/lldb/source/Host/common/Editline.cpp b/lldb/source/Host/common/Editline.cpp index e66271e8a6ee99..ed61aecc23b9b0 100644 --- a/lldb/source/Host/common/Editline.cpp +++ b/lldb/source/Host/common/Editline.cpp @@ -1597,6 +1597,7 @@ bool Editline::GetLines(int first_line_number, StringList &lines, void Editline::PrintAsync(Stream *stream, const char *s, size_t len) { std::lock_guard<std::recursive_mutex> guard(m_output_mutex); if (m_editor_status == EditorStatus::Editing) { + SaveEditedLine(); MoveCursor(CursorLocation::EditingCursor, CursorLocation::BlockStart); fprintf(m_output_file, ANSI_CLEAR_BELOW); } _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits