Skip to content

[lldb] Removed gdbserver ports map from lldb-server #104238

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Oct 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 2 additions & 15 deletions lldb/docs/man/lldb-server.rst
Original file line number Diff line number Diff line change
Expand Up @@ -147,21 +147,8 @@ GDB-SERVER CONNECTIONS

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

Define a port to be used for gdb-server connections. Can be specified multiple
times to allow multiple ports. Has no effect if --min-gdbserver-port
and --max-gdbserver-port are specified.

.. option:: --min-gdbserver-port <port>
.. option:: --max-gdbserver-port <port>

Specify the range of ports that can be used for gdb-server connections. Both
options need to be specified simultaneously. Overrides --gdbserver-port.

.. option:: --port-offset <offset>

Add the specified offset to port numbers returned by server. This is useful
if the server is running behind a firewall, and a range of ports is redirected
to it with an offset.
Define a port to be used for gdb-server connections. This port is used for
multiple connections.

EXAMPLES
--------
Expand Down
19 changes: 5 additions & 14 deletions lldb/docs/resources/qemu-testing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -149,30 +149,21 @@ to the host (refer to QEMU's manuals for the specific options).
* At least one to connect to the intial ``lldb-server``.
* One more if you want to use ``lldb-server`` in ``platform mode``, and have it
start a ``gdbserver`` instance for you.
* A bunch more if you want to run tests against the ``lldb-server`` platform.

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

::

$ lldb-server plaform --server --listen 0.0.0.0:54321 \
--min-gdbserver-port 49140 --max-gdbserver-port 49150
$ lldb-server plaform --server --listen 0.0.0.0:54321 --gdbserver-port 49140

The result of this is that:

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

* When it is asked to start a new gdbserver mode instance, it will use a port
in the range ``49140`` to ``49150``.
* When it is asked to start a new gdbserver mode instance, it will use the port
``49140``.

Your VM configuration should have ports ``54321``, and ``49140`` to ``49150``
forwarded for this to work.

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