[Lldb-commits] [PATCH] D128234: Fix build break introduced by https://reviews.llvm.org/D127702

jeffrey tan via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Jun 20 17:23:13 PDT 2022


yinghuitan created this revision.
yinghuitan added reviewers: clayborg, thakis, kazu.
Herald added a project: All.
yinghuitan requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

Fix build break introduced by https://reviews.llvm.org/D127702


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D128234

Files:
  lldb/tools/lldb-vscode/BreakpointBase.cpp
  lldb/tools/lldb-vscode/BreakpointBase.h


Index: lldb/tools/lldb-vscode/BreakpointBase.h
===================================================================
--- lldb/tools/lldb-vscode/BreakpointBase.h
+++ lldb/tools/lldb-vscode/BreakpointBase.h
@@ -20,6 +20,8 @@
 struct BreakpointBase {
   // logMessage part can be either a raw text or an expression.
   struct LogMessagePart {
+    LogMessagePart(llvm::StringRef text, bool is_expr)
+        : text(text), is_expr(is_expr) {}
     llvm::StringRef text;
     bool is_expr;
   };
Index: lldb/tools/lldb-vscode/BreakpointBase.cpp
===================================================================
--- lldb/tools/lldb-vscode/BreakpointBase.cpp
+++ lldb/tools/lldb-vscode/BreakpointBase.cpp
@@ -103,7 +103,8 @@
     last_raw_text_start = curly_braces_range.second + 1;
   }
   // Trailing raw text after close curly brace.
-  if (logMessage.size() > last_raw_text_start)
+  assert(last_raw_text_start >= 0);
+  if (logMessage.size() > (size_t)last_raw_text_start)
     logMessageParts.emplace_back(
         llvm::StringRef(logMessage.c_str() + last_raw_text_start,
                         logMessage.size() - last_raw_text_start),
@@ -127,7 +128,8 @@
     if (messagePart.is_expr) {
       // Try local frame variables first before fall back to expression
       // evaluation
-      const char *expr = messagePart.text.str().c_str();
+      std::string expr_str = messagePart.text.str();
+      const char *expr = expr_str.c_str();
       lldb::SBValue value =
           frame.GetValueForVariablePath(expr, lldb::eDynamicDontRunTarget);
       if (value.GetError().Fail())


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D128234.438505.patch
Type: text/x-patch
Size: 1584 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20220621/479b02e2/attachment.bin>


More information about the lldb-commits mailing list