This is an archive of the discontinued LLVM Phabricator instance.

[lldb] Use llvm::Optional for port in LaunchGDBServer
ClosedPublic

Authored by DavidSpickett on Nov 24 2020, 7:48 AM.

Details

Summary

Previously we used UINT16_MAX to mean no port/no specifc
port. This leads to confusion because 65535 is a valid
port number.

Instead use an optional. If you want a specific port call
LaunchGDBServer as normal, otherwise pass an empty optional
and it will be set to the port that gets chosen.
(or left empty in the case where we fail to find a port)

Diff Detail

Event Timeline

DavidSpickett created this revision.Nov 24 2020, 7:48 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 24 2020, 7:48 AM
DavidSpickett requested review of this revision.Nov 24 2020, 7:48 AM
DavidSpickett added inline comments.Nov 24 2020, 7:54 AM
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
197

I know this is a bit unorthodox but things got messy trying to pass an Optional into StartDebugServerProcess. So I figured it's better to keep StartDebugServerProcess the same for now and limit the scope of any mistakes. (the logic gets quite hard to follow)

labath accepted this revision.Nov 25 2020, 4:49 AM
labath added inline comments.
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
197

I think that's fine.

This revision is now accepted and ready to land.Nov 25 2020, 4:49 AM
  • Reformat GDBRemoteCommunicationServerPlatform.h to fix include order.
This revision was landed with ongoing or failed builds.Nov 30 2020, 3:20 AM
This revision was automatically updated to reflect the committed changes.