diff --git a/python/qemu/machine/machine.py b/python/qemu/machine/machine.py index 18ee5ec014..3670c8cd39 100644 --- a/python/qemu/machine/machine.py +++ b/python/qemu/machine/machine.py @@ -308,12 +308,15 @@ class QEMUMachine: 'chardev=mon,mode=control']) return args - @property - def _console_args(self) -> List[str]: + def _console_args(self, interactive: bool = False) -> List[str]: args: List[str] = [] + # redirect pre_console_index serials to null for _ in range(self._console_index): args.extend(['-serial', 'null']) - if self._console_set: + + if interactive: + args.extend(['-serial', 'mon:stdio']) + elif self._console_set: assert self._cons_sock_pair is not None fd = self._cons_sock_pair[0].fileno() chardev = f"socket,id=console,fd={fd}" @@ -376,7 +379,7 @@ class QEMUMachine: self._wrapper, [self._binary], self._harness_args, - self._console_args, + self._console_args(), self._base_args, self._args )) @@ -485,6 +488,14 @@ class QEMUMachine: """ self._pre_launch() LOG.debug('VM launch command: %r', ' '.join(self._qemu_full_args)) + # Log a simplified, developer-runnable command: + # Exclude harness-managed infrastructure args (harness_args) + # and wrapper. + debug_cmd = [self._binary] + debug_cmd.extend(self._console_args(interactive=True)) + debug_cmd.extend(self._base_args) + debug_cmd.extend(self._args) + LOG.debug('Developer-runnable command: %r', ' '.join(debug_cmd)) # Cleaning up of this subprocess is guaranteed by _do_shutdown. # pylint: disable=consider-using-with