================
@@ -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
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits