[Lldb-commits] [lldb] [lldb] generalize the GDBRemoteCommunicationClient::GetVContSupported method (PR #182287)

David Spickett via lldb-commits lldb-commits at lists.llvm.org
Thu Feb 19 08:57:38 PST 2026


================
@@ -491,17 +493,18 @@ bool GDBRemoteCommunicationClient::GetVContSupported(char flavor) {
     m_supports_vCont_S = eLazyBoolNo;
     if (SendPacketAndWaitForResponse("vCont?", response) ==
         PacketResult::Success) {
-      const char *response_cstr = response.GetStringRef().data();
-      if (::strstr(response_cstr, ";c"))
+      std::string response_str(response.GetStringRef());
+      response_str += ';';
----------------
DavidSpickett wrote:

This can be done with stringrefs and you don't need to modify the string:
```
llvm::StringRef response_ref = response.GetStringRef();
while (response_ref.size) {
  auto [left, right] = response_ref.split(';');
  if (left == "c")
    m_supports_vCont_c = eLazyBoolYes;
  else if (.... <and so on>)
  
  response_ref = right;
}
```

However, you probably know that because you said:
> This is a conservative generalization

And the repeated find calls are very close to the original code. So I understand that choice.

Also with the size of the string involved, and the fact that either way, people have to realise that the list does not always end with a `;`, it comes out to the same thing.

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


More information about the lldb-commits mailing list