[Lldb-commits] [lldb] [lldb] [mostly NFC] Large WP foundation: WatchpointResources (PR #68845)

Jason Molenda via lldb-commits lldb-commits at lists.llvm.org
Mon Oct 30 19:00:14 PDT 2023


================
@@ -266,33 +268,73 @@ void Watchpoint::Dump(Stream *s) const {
 
 // If prefix is nullptr, we display the watch id and ignore the prefix
 // altogether.
-void Watchpoint::DumpSnapshots(Stream *s, const char *prefix) const {
-  if (!prefix) {
-    s->Printf("\nWatchpoint %u hit:", GetID());
-    prefix = "";
-  }
+bool Watchpoint::DumpSnapshots(Stream *s, const char *prefix) const {
+  bool printed_anything = false;
----------------
jasonmolenda wrote:

The convention for these methods seems to be to return a stream without a final end-of-line character.  In StopInfo.cpp we call this method and check if it printed anything, and if so, print an EOL.  In Watchpoint::DumpWithLevel we ignore the return type from DumpSnapshots, but that's only because every line it adds is assumed to end without an EOL.  I don't really need a variable in this method, I could return false in the two places it is false and true in the one place it is true.

https://github.com/llvm/llvm-project/pull/68845


More information about the lldb-commits mailing list