[Lldb-commits] [lldb] [LLDB-DAP] SBDebugger don't prefix title on progress updates (PR #124648)

Jacob Lalonde via lldb-commits lldb-commits at lists.llvm.org
Thu Jan 30 15:46:14 PST 2025


================
@@ -411,6 +412,30 @@ void SendStdOutStdErr(DAP &dap, lldb::SBProcess &process) {
     dap.SendOutput(OutputType::Stderr, llvm::StringRef(buffer, count));
 }
 
+static std::string GetStringFromStructuredData(lldb::SBStructuredData &data,
+                                               const char *key) {
+  lldb::SBStructuredData keyValue = data.GetValueForKey(key);
+  if (!keyValue)
+    return std::string();
+
+  size_t size = keyValue.GetStringValue(nullptr, 0);
+  std::cout << "Size for " << key << " " << size << std::endl;
+  std::string stringValue;
+  stringValue.resize(size);
+  keyValue.GetStringValue(&stringValue[0], size + 1);
+  std::cout << "String value after: " << stringValue << std::endl;
+  return stringValue;
+}
+
+static uint64_t GetUintFromStructuredData(lldb::SBStructuredData &data,
+                                          const char *key) {
+  lldb::SBStructuredData keyValue = data.GetValueForKey(key);
+
+  if (!keyValue.IsValid())
----------------
Jlalond wrote:

@clayborg I added -1 here, I think it might just be better to let it fail at 0. That's certainly more succint, thoughts?

https://github.com/llvm/llvm-project/pull/124648


More information about the lldb-commits mailing list