[lldb-vscode] Fix TestVSCode_setBreakpoints
authorWalter Erquinigo <waltermelon@fb.com>
Tue, 14 Jul 2020 01:26:41 +0000 (18:26 -0700)
committerWalter Erquinigo <waltermelon@fb.com>
Tue, 14 Jul 2020 01:27:53 +0000 (18:27 -0700)
It was failing because some module events had empty UUID, and that was not handled correctly.
The diff that added that logic is https://reviews.llvm.org/D82477

lldb/tools/lldb-vscode/JSONUtils.cpp

index 86c29fb..1ebaa5c 100644 (file)
@@ -331,7 +331,8 @@ llvm::json::Value CreateModule(lldb::SBModule &module) {
   llvm::json::Object object;
   if (!module.IsValid())
     return llvm::json::Value(std::move(object));
-  object.try_emplace("id", std::string(module.GetUUIDString()));
+  const char *uuid = module.GetUUIDString();
+  object.try_emplace("id", uuid ? std::string(uuid) : std::string(""));
   object.try_emplace("name", std::string(module.GetFileSpec().GetFilename()));
   char module_path_arr[PATH_MAX];
   module.GetFileSpec().GetPath(module_path_arr, sizeof(module_path_arr));