[Lldb-commits] [lldb] [lldb-dap] Validate utf8 protocol messages. (PR #181261)
John Harrison via lldb-commits
lldb-commits at lists.llvm.org
Fri Feb 13 10:27:44 PST 2026
================
@@ -188,31 +202,46 @@ bool operator==(const Response &a, const Response &b) {
json::Value toJSON(const ErrorMessage &EM) {
json::Object Result{{"id", EM.id}, {"format", EM.format}};
- if (EM.variables) {
+ if (!EM.variables.empty()) {
json::Object variables;
- for (auto &var : *EM.variables)
- variables[var.first] = var.second;
+ for (auto &var : EM.variables)
+ variables[var.first.str()] = var.second;
Result.insert({"variables", std::move(variables)});
}
if (EM.sendTelemetry)
Result.insert({"sendTelemetry", EM.sendTelemetry});
if (EM.showUser)
Result.insert({"showUser", EM.showUser});
- if (EM.url)
+ if (!EM.url.empty())
Result.insert({"url", EM.url});
- if (EM.urlLabel)
+ if (!EM.urlLabel.empty())
Result.insert({"urlLabel", EM.urlLabel});
return std::move(Result);
}
+bool fromJSON(json::Value const &Params, std::map<String, String> &M,
+ json::Path P) {
+ const auto *const O = Params.getAsObject();
+ if (!O) {
+ P.report("expected object");
+ return false;
+ }
+ for (auto [k, v] : *O) {
+ auto str = v.getAsString();
+ if (str)
+ M[k.str()] = *str;
----------------
ashgti wrote:
Done.
https://github.com/llvm/llvm-project/pull/181261
More information about the lldb-commits
mailing list