[Lldb-commits] [lldb] [LLDB-DAP] SBDebugger don't prefix title on progress updates (PR #124648)
Jonas Devlieghere via lldb-commits
lldb-commits at lists.llvm.org
Fri Feb 7 13:29:40 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;
----------------
JDevlieghere wrote:
```suggestion
lldb::SBStructuredData keyValue = data.GetValueForKey(key);
if (!keyValue)
return std::string();
const size_t length = keyValue.GetStringValue(nullptr, 0);
std::string str(length + 1, 0);
value.GetStringValue(&str[0], length);
return str;
```
Not really, you can avoid the resize with the ctor but otherwise that's as good as it gets (without the logging).
https://github.com/llvm/llvm-project/pull/124648
More information about the lldb-commits
mailing list