[Lldb-commits] [PATCH] D96947: [lldb] Prevent double new lines behind errors/warning/messages from LLDB commands
Raphael Isemann via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Wed Feb 24 05:42:39 PST 2021
This revision was automatically updated to reflect the committed changes.
Closed by commit rG6201017d541f: [lldb] Prevent double new lines behind errors/warning/messages from LLDB… (authored by teemperor).
Herald added a subscriber: lldb-commits.
Changed prior to commit:
https://reviews.llvm.org/D96947?vs=324570&id=326062#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D96947/new/
https://reviews.llvm.org/D96947
Files:
lldb/include/lldb/Interpreter/CommandReturnObject.h
lldb/source/Commands/CommandObjectMemory.cpp
lldb/source/Interpreter/CommandReturnObject.cpp
lldb/test/Shell/Commands/command-disassemble.s
Index: lldb/test/Shell/Commands/command-disassemble.s
===================================================================
--- lldb/test/Shell/Commands/command-disassemble.s
+++ lldb/test/Shell/Commands/command-disassemble.s
@@ -6,16 +6,12 @@
# CHECK: (lldb) disassemble
# CHECK-NEXT: error: Cannot disassemble around the current function without a selected frame.
-# CHECK-EMPTY:
# CHECK-NEXT: (lldb) disassemble --line
# CHECK-NEXT: error: Cannot disassemble around the current line without a selected frame.
-# CHECK-EMPTY:
# CHECK-NEXT: (lldb) disassemble --frame
# CHECK-NEXT: error: Cannot disassemble around the current function without a selected frame.
-# CHECK-EMPTY:
# CHECK-NEXT: (lldb) disassemble --pc
# CHECK-NEXT: error: Cannot disassemble around the current PC without a selected frame.
-# CHECK-EMPTY:
# CHECK-NEXT: (lldb) disassemble --start-address 0x0
# CHECK-NEXT: command-disassemble.s.tmp`foo:
# CHECK-NEXT: command-disassemble.s.tmp[0x0] <+0>: int $0x10
Index: lldb/source/Interpreter/CommandReturnObject.cpp
===================================================================
--- lldb/source/Interpreter/CommandReturnObject.cpp
+++ lldb/source/Interpreter/CommandReturnObject.cpp
@@ -90,28 +90,19 @@
void CommandReturnObject::AppendMessage(llvm::StringRef in_string) {
if (in_string.empty())
return;
- GetOutputStream() << in_string << "\n";
+ GetOutputStream() << in_string.rtrim() << '\n';
}
void CommandReturnObject::AppendWarning(llvm::StringRef in_string) {
if (in_string.empty())
return;
- warning(GetErrorStream()) << in_string << '\n';
-}
-
-// Similar to AppendWarning, but do not prepend 'warning: ' to message, and
-// don't append "\n" to the end of it.
-
-void CommandReturnObject::AppendRawWarning(llvm::StringRef in_string) {
- if (in_string.empty())
- return;
- GetErrorStream() << in_string;
+ warning(GetErrorStream()) << in_string.rtrim() << '\n';
}
void CommandReturnObject::AppendError(llvm::StringRef in_string) {
if (in_string.empty())
return;
- error(GetErrorStream()) << in_string << '\n';
+ error(GetErrorStream()) << in_string.rtrim() << '\n';
}
void CommandReturnObject::SetError(const Status &error,
Index: lldb/source/Commands/CommandObjectMemory.cpp
===================================================================
--- lldb/source/Commands/CommandObjectMemory.cpp
+++ lldb/source/Commands/CommandObjectMemory.cpp
@@ -356,8 +356,8 @@
result.AppendErrorWithFormat("%s takes a start address expression with "
"an optional end address expression.\n",
m_cmd_name.c_str());
- result.AppendRawWarning("Expressions should be quoted if they contain "
- "spaces or other special characters.\n");
+ result.AppendWarning("Expressions should be quoted if they contain "
+ "spaces or other special characters.");
result.SetStatus(eReturnStatusFailed);
return false;
}
Index: lldb/include/lldb/Interpreter/CommandReturnObject.h
===================================================================
--- lldb/include/lldb/Interpreter/CommandReturnObject.h
+++ lldb/include/lldb/Interpreter/CommandReturnObject.h
@@ -95,8 +95,6 @@
void AppendMessageWithFormat(const char *format, ...)
__attribute__((format(printf, 2, 3)));
- void AppendRawWarning(llvm::StringRef in_string);
-
void AppendWarning(llvm::StringRef in_string);
void AppendWarningWithFormat(const char *format, ...)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D96947.326062.patch
Type: text/x-patch
Size: 3573 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20210224/853a2fd7/attachment.bin>
More information about the lldb-commits
mailing list