[lldb] Use llvm::Optional for port in LaunchGDBServer
authorDavid Spickett <david.spickett@linaro.org>
Tue, 24 Nov 2020 14:01:29 +0000 (14:01 +0000)
committerDavid Spickett <david.spickett@linaro.org>
Mon, 30 Nov 2020 11:20:39 +0000 (11:20 +0000)
commita7f8d96b16a394a87230d592c727906f67a4ba07
treedf37f881d835e62c9f2bb04c4cc7bfe2ddda9fce
parent83d79ca5bf13ca37f4ab69f24004ca83c1d03ea4
[lldb] Use llvm::Optional for port in LaunchGDBServer

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)

Reviewed By: labath

Differential Revision: https://reviews.llvm.org/D92035
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.h
lldb/tools/lldb-server/lldb-platform.cpp