diff mbox series

[6/7] devtool: ide-sdk: honour --gdbserver-port-start for all debug servers

Message ID 20260917183832.998361-7-adrian.freihofer@siemens.com
State New
Headers show
Series oe-selftest: devtool ide-sdk: make slirp tests port collision proof | expand

Commit Message

AdrianF Sept. 17, 2026, 6:37 p.m. UTC
From: Adrian Freihofer <adrian.freihofer@siemens.com>

The value was stored in RecipeGdbCross.gdbserver_port_next, which nothing
ever read. The ports actually handed out come from the class wide counter
DebuggerCrossConfig._port_next, which is shared by the gdbserver and
lldb-server configurations and always started at its hardcoded 1234, so
-G had no effect at all.

Seed that counter instead, which also makes the option a way to move all
debug servers of one invocation out of the way of another one running
concurrently on the same host.

Signed-off-by: Adrian Freihofer <adrian.freihofer@siemens.com>
---
 scripts/lib/devtool/ide_sdk.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/scripts/lib/devtool/ide_sdk.py b/scripts/lib/devtool/ide_sdk.py
index a987c37f06..e1a9d1774e 100755
--- a/scripts/lib/devtool/ide_sdk.py
+++ b/scripts/lib/devtool/ide_sdk.py
@@ -123,7 +123,6 @@  class RecipeGdbCross(RecipeNative):
         super().__init__('gdb-cross-' + target_arch, target_arch)
         self.target_device = target_device
         self.gdb = None
-        self.gdbserver_port_next = int(args.gdbserver_port_start)
         self.config_db = {}
 
     def __find_gdbserver(self, config, tinfoil):
@@ -1856,6 +1855,7 @@  def ide_setup(args, config, basepath, workspace):
         if args.mode == DevtoolIdeMode.modified:
             logger.info("Setting up workspaces for modified recipe: %s" %
                         str(recipes_modified_names))
+            DebuggerCrossConfig._port_next = int(args.gdbserver_port_start)
             debuggers = {}
             for recipe_name in recipes_modified_names:
                 recipe_modified = RecipeModified(
@@ -2049,7 +2049,9 @@  def register_commands(subparsers, context):
         '-t', '--target', default='root@192.168.7.2',
         help='Live target machine running an ssh server: user@hostname.')
     parser_ide_sdk.add_argument(
-        '-G', '--gdbserver-port-start', default="1234", help='port where gdbserver is listening.')
+        '-G', '--gdbserver-port-start', default="1234",
+        help='First port used by the debug servers on the target. Each debug '
+             'configuration consumes one port, counting up from here.')
     parser_ide_sdk.add_argument(
         '-c', '--no-host-check', help='Disable ssh host key checking', action='store_true')
     parser_ide_sdk.add_argument(