emrekultursay created this revision.
emrekultursay added a reviewer: LLDB.
Herald added a project: LLDB.

When using IPv6 host:port pairs, typically the host is put inside
brackets, such as [2601:1234:...:0213]:5555, and the UriParser
can handle this format.

However, the Android infrastructure in LLDB assumes an additional
brackets around the host:port pair, such that the entire host:port
string can be treated as the host (which is used as an Android Serial
Number), and UriParser cannot handle multiple brackets. Parsing
inputs with such extra backets requires searching the closing bracket
from the right.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D76736

Files:
  lldb/source/Utility/UriParser.cpp


Index: lldb/source/Utility/UriParser.cpp
===================================================================
--- lldb/source/Utility/UriParser.cpp
+++ lldb/source/Utility/UriParser.cpp
@@ -42,7 +42,7 @@
   // Extract hostname
   if (!host_port.empty() && host_port[0] == '[') {
     // hostname is enclosed with square brackets.
-    pos = host_port.find(']');
+    pos = host_port.rfind(']');
     if (pos == std::string::npos)
       return false;
 


Index: lldb/source/Utility/UriParser.cpp
===================================================================
--- lldb/source/Utility/UriParser.cpp
+++ lldb/source/Utility/UriParser.cpp
@@ -42,7 +42,7 @@
   // Extract hostname
   if (!host_port.empty() && host_port[0] == '[') {
     // hostname is enclosed with square brackets.
-    pos = host_port.find(']');
+    pos = host_port.rfind(']');
     if (pos == std::string::npos)
       return false;
 
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to