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())
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())
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits