[Lldb-commits] [lldb] [lldb] Fix lldb-server host and port address parsing (PR #191414)

Georgiy Samoylov via lldb-commits lldb-commits at lists.llvm.org
Mon Apr 13 01:23:08 PDT 2026


================
@@ -290,7 +290,12 @@ Socket::UdpConnect(llvm::StringRef host_and_port) {
 
 llvm::Expected<Socket::HostAndPort>
 Socket::DecodeHostAndPort(llvm::StringRef host_and_port) {
-  static llvm::Regex g_regex("([^:]+|\\[[0-9a-fA-F:]+.*\\]):([0-9]+)");
+  // This regex parses host:port combinations, supporting:
+  // - IPv4 sockets (e.g., "127.0.0.1:8080")
+  // - IPv6 sockets with host part in square brackets (e.g., "[::1]:80")
+  // Group 1: Address (IPv4, hostname, or IPv6 in [])
+  // Group 2: Port number (digits only)
+  static llvm::Regex g_regex("([^:]+|\\[[0-9a-fA-F:]+.*\\]):([0-9]+$)");
----------------
sga-sc wrote:

Yes, that's exactly what I meant

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


More information about the lldb-commits mailing list