[lldb] [lldb-server] Refactor ConnectToRemote()
authorMichał Górny <mgorny@moritz.systems>
Sun, 17 Oct 2021 14:06:19 +0000 (16:06 +0200)
committerMichał Górny <mgorny@moritz.systems>
Mon, 18 Oct 2021 20:05:01 +0000 (22:05 +0200)
commita229a4aa6418bf34678a32f368324ae2c47051b7
tree030d3d798f89ebbb0620d0949d6b8e1af3925ba9
parent62293e7d33ff0344b767ac66188981774c8b5197
[lldb] [lldb-server] Refactor ConnectToRemote()

Refactor ConnectToRemote() to improve readability and make future
changes easier:

1. Replace static buffers with std::string.
2. When handling errors, prefer reporting the actual error over dumb
   'connection status is not success'.
3. Move host/port parsing directly into reverse_connection condition
   that is its only user, and simplify it to make its purpose (verifying
   that a valid port is provided) clear.
4. Use llvm::errs() and llvm::outs() instead of fprintf().

Differential Revision: https://reviews.llvm.org/D111963
lldb/tools/lldb-server/lldb-gdbserver.cpp