Skip to content

Commit 2e89312

Browse files
authored
[lldb] Removed gdbserver ports map from lldb-server (#104238)
Listen to gdbserver-port, accept the connection and run `lldb-server gdbserver --fd` on all platforms. Parameters --min-gdbserver-port and --max-gdbserver-port are deprecated now. This is the part 2 of #101283. Fixes #97537.
1 parent 00c1989 commit 2e89312

File tree

13 files changed

+361
-739
lines changed

13 files changed

+361
-739
lines changed

lldb/docs/man/lldb-server.rst

+2-15
Original file line numberDiff line numberDiff line change
@@ -147,21 +147,8 @@ GDB-SERVER CONNECTIONS
147147

148148
.. option:: --gdbserver-port <port>
149149

150-
Define a port to be used for gdb-server connections. Can be specified multiple
151-
times to allow multiple ports. Has no effect if --min-gdbserver-port
152-
and --max-gdbserver-port are specified.
153-
154-
.. option:: --min-gdbserver-port <port>
155-
.. option:: --max-gdbserver-port <port>
156-
157-
Specify the range of ports that can be used for gdb-server connections. Both
158-
options need to be specified simultaneously. Overrides --gdbserver-port.
159-
160-
.. option:: --port-offset <offset>
161-
162-
Add the specified offset to port numbers returned by server. This is useful
163-
if the server is running behind a firewall, and a range of ports is redirected
164-
to it with an offset.
150+
Define a port to be used for gdb-server connections. This port is used for
151+
multiple connections.
165152

166153
EXAMPLES
167154
--------

lldb/docs/resources/qemu-testing.rst

+5-14
Original file line numberDiff line numberDiff line change
@@ -149,30 +149,21 @@ to the host (refer to QEMU's manuals for the specific options).
149149
* At least one to connect to the intial ``lldb-server``.
150150
* One more if you want to use ``lldb-server`` in ``platform mode``, and have it
151151
start a ``gdbserver`` instance for you.
152-
* A bunch more if you want to run tests against the ``lldb-server`` platform.
153152

154153
If you are doing either of the latter 2 you should also restrict what ports
155154
``lldb-server tries`` to use, otherwise it will randomly pick one that is almost
156155
certainly not forwarded. An example of this is shown below.
157156

158157
::
159158

160-
$ lldb-server plaform --server --listen 0.0.0.0:54321 \
161-
--min-gdbserver-port 49140 --max-gdbserver-port 49150
159+
$ lldb-server plaform --server --listen 0.0.0.0:54321 --gdbserver-port 49140
162160

163161
The result of this is that:
164162

165163
* ``lldb-server`` platform mode listens externally on port ``54321``.
166164

167-
* When it is asked to start a new gdbserver mode instance, it will use a port
168-
in the range ``49140`` to ``49150``.
165+
* When it is asked to start a new gdbserver mode instance, it will use the port
166+
``49140``.
169167

170-
Your VM configuration should have ports ``54321``, and ``49140`` to ``49150``
171-
forwarded for this to work.
172-
173-
.. note::
174-
These options are used to create a "port map" within ``lldb-server``.
175-
Unfortunately this map is not cleaned up on Windows on connection close,
176-
and across a few uses you may run out of valid ports. To work around this,
177-
restart the platform every so often, especially after running a set of tests.
178-
This is tracked here: https://github.com/llvm/llvm-project/issues/90923
168+
Your VM configuration should have ports ``54321`` and ``49140`` forwarded for
169+
this to work.

0 commit comments

Comments
 (0)