This is an archive of the discontinued LLVM Phabricator instance.

[lldb] [lldb-server] Refactor ConnectToRemote()
ClosedPublic

Authored by mgorny on Oct 17 2021, 7:11 AM.

Details

Summary

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.

Diff Detail

Event Timeline

mgorny requested review of this revision.Oct 17 2021, 7:11 AM
mgorny created this revision.
labath accepted this revision.Oct 18 2021, 12:50 AM
labath added inline comments.
lldb/tools/lldb-server/lldb-gdbserver.cpp
216–220

maybe replace with llvm::errs(), while you're in there?

This revision is now accepted and ready to land.Oct 18 2021, 12:50 AM
mgorny marked an inline comment as done.Oct 18 2021, 3:13 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptOct 18 2021, 1:06 PM