[Lldb-commits] [PATCH] D133038: Add GetSourceMap public API

Jim Ingham via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Aug 31 12:23:32 PDT 2022


jingham added a comment.

I'm a little sad that we don't yet have a way to read the current value of a setting into an SBStructuredData, so we do this piecemeal instead.  But that's a bigger project, so if you need this now, it doesn't seem fair to block you on that.  We should really name the output SBStructuredData keys more instructively, however.



================
Comment at: lldb/include/lldb/API/SBTarget.h:91
+  /// \return
+  ///     A SBStructuredData with the source map entries collected.
+  lldb::SBStructuredData GetSourceMap();
----------------
You have to say what the structure is so people will know how to fetch the elements.


================
Comment at: lldb/source/API/SBTarget.cpp:222
+
+  std::string json_str =
+      llvm::formatv("{0:2}",
----------------
It seems a little round-about to convert the source map to JSON, then from JSON to an SBStructuredData.  You should be able to write the elements directly.  I'm not sure how much that matters, however.


================
Comment at: lldb/source/Target/PathMappingList.cpp:138
+    llvm::json::Object entry;
+    entry.try_emplace("first", pair.first.GetStringRef().str());
+    entry.try_emplace("second", pair.second.GetStringRef().str());
----------------
Can we call these something more instructive than "first" and "second"?  These are the "original" path and the "substitution" path, maybe those would be good keys?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D133038/new/

https://reviews.llvm.org/D133038



More information about the lldb-commits mailing list