================ @@ -1165,6 +1188,24 @@ llvm::json::Value CreateVariable(lldb::SBValue v, int64_t variablesReference, const char *evaluateName = evaluateStream.GetData(); if (evaluateName && evaluateName[0]) EmplaceSafeString(object, "evaluateName", std::string(evaluateName)); + + if (lldb::SBDeclaration decl = v.GetDeclaration(); decl.IsValid()) { + llvm::json::Object decl_obj; + if (lldb::SBFileSpec file = decl.GetFileSpec(); file.IsValid()) { + char path[PATH_MAX] = ""; + if (file.GetPath(path, sizeof(path)) && + lldb::SBFileSpec::ResolvePath(path, path, PATH_MAX)) { + decl_obj.try_emplace("path", std::string(path)); + } + } + + if (int line = decl.GetLine()) + decl_obj.try_emplace("line", line); + if (int column = decl.GetColumn()) + decl_obj.try_emplace("column", column); + + object.try_emplace("declaration", std::move(decl_obj)); ---------------- clayborg wrote:
So above we might or might not get any of the info, do we want to only emplace this into "declaration" if we at least have both a valid path _and_ a valid line? https://github.com/llvm/llvm-project/pull/74865 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits