diff --git a/lldb/source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp b/lldb/source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp --- a/lldb/source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp +++ b/lldb/source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp @@ -92,9 +92,8 @@ uint16_t local_port = 0; const char *gdbstub_port = std::getenv("ANDROID_PLATFORM_LOCAL_GDB_PORT"); - if (gdbstub_port) { + if (gdbstub_port) local_port = std::stoi(gdbstub_port); - } auto error = MakeConnectURL(pid, local_port, remote_port, socket_name.c_str(), connect_url); @@ -134,9 +133,8 @@ uint16_t local_port = 0; const char *platform_local_port = std::getenv("ANDROID_PLATFORM_LOCAL_PORT"); - if (platform_local_port) { + if (platform_local_port) local_port = std::stoi(platform_local_port); - } std::string connect_url; auto error = MakeConnectURL(g_remote_platform_pid, local_port, @@ -201,9 +199,8 @@ return error; }; - if (local_port != 0) { + if (local_port != 0) return forward(local_port, remote_port); - } // There is a race possibility that somebody will occupy a port while we're // in between FindUnusedPort and ForwardPortWithAdb - adding the loop to @@ -214,9 +211,8 @@ if (error.Fail()) return error; - if (forward(local_port, remote_port).Success()) { + if (forward(local_port, remote_port).Success()) break; - } } return error;