llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-lldb Author: Aaron (aahrun) <details> <summary>Changes</summary> When creating a stack frame in JSONUtils.cpp CreateStackFrame() the code constructs a std::string from module.GetUUIDString(), which can return nullptr in some cases (as documented in the implementation of SBModule::GetUUIDString()). This causes a segmentation fault when passed to the std::string constructor. This fix adds a null check before constructing the UUID string, falling back to an empty string if nullptr is returned. The existing empty check ensures the moduleId field is omitted from the JSON when no UUID exists. --- Full diff: https://github.com/llvm/llvm-project/pull/169844.diff 1 Files Affected: - (modified) lldb/tools/lldb-dap/JSONUtils.cpp (+2-1) ``````````diff diff --git a/lldb/tools/lldb-dap/JSONUtils.cpp b/lldb/tools/lldb-dap/JSONUtils.cpp index 81eadae03bb48..1cc01cd547582 100644 --- a/lldb/tools/lldb-dap/JSONUtils.cpp +++ b/lldb/tools/lldb-dap/JSONUtils.cpp @@ -554,7 +554,8 @@ llvm::json::Value CreateStackFrame(DAP &dap, lldb::SBFrame &frame, lldb::SBModule module = frame.GetModule(); if (module.IsValid()) { - std::string uuid = module.GetUUIDString(); + const char *uuid_cstr = module.GetUUIDString(); + std::string uuid = uuid_cstr ? uuid_cstr : ""; if (!uuid.empty()) object.try_emplace("moduleId", uuid); } `````````` </details> https://github.com/llvm/llvm-project/pull/169844 _______________________________________________ lldb-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
