[Lldb-commits] [lldb] [lldb-dap] Fix segfault in JSONUtils.cpp when GetUUIDString() returns nullptr (PR #169844)
Ebuka Ezike via lldb-commits
lldb-commits at lists.llvm.org
Fri Nov 28 02:48:42 PST 2025
================
@@ -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);
----------------
da-viper wrote:
```suggestion
if (const llvm::StringRef uuid = module.GetUUIDString(); !uuid.empty())
object.try_emplace("moduleId", uuid.str());
```
It makes more sense to use `llvm::StringRef` as we only convert/store it if it is valid. and the underlying `char *` is owned by lldb.
https://github.com/llvm/llvm-project/pull/169844
More information about the lldb-commits
mailing list