mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 07:43:54 -06:00
qemu-iotests: add option to attach gdbserver
Define -gdb flag and GDB_OPTIONS environment variable to python tests to attach a gdbserver to each qemu instance. This patch only adds and parses this flag, it does not yet add the implementation for it. if -gdb is not provided but $GDB_OPTIONS is set, ignore the environment variable. Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com> Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Reviewed-by: Max Reitz <mreitz@redhat.com> Message-Id: <20210809090114.64834-6-eesposit@redhat.com> Signed-off-by: Hanna Reitz <hreitz@redhat.com>
This commit is contained in:
parent
0193767b25
commit
cfb9b0b731
3 changed files with 25 additions and 3 deletions
|
@ -27,6 +27,7 @@ import subprocess
|
|||
import glob
|
||||
from typing import List, Dict, Any, Optional, ContextManager
|
||||
|
||||
DEF_GDB_OPTIONS = 'localhost:12345'
|
||||
|
||||
def isxfile(path: str) -> bool:
|
||||
return os.path.isfile(path) and os.access(path, os.X_OK)
|
||||
|
@ -72,7 +73,8 @@ class TestEnv(ContextManager['TestEnv']):
|
|||
'QEMU_NBD_OPTIONS', 'IMGOPTS', 'IMGFMT', 'IMGPROTO',
|
||||
'AIOMODE', 'CACHEMODE', 'VALGRIND_QEMU',
|
||||
'CACHEMODE_IS_DEFAULT', 'IMGFMT_GENERIC', 'IMGOPTSSYNTAX',
|
||||
'IMGKEYSECRET', 'QEMU_DEFAULT_MACHINE', 'MALLOC_PERTURB_']
|
||||
'IMGKEYSECRET', 'QEMU_DEFAULT_MACHINE', 'MALLOC_PERTURB_',
|
||||
'GDB_OPTIONS']
|
||||
|
||||
def prepare_subprocess(self, args: List[str]) -> Dict[str, str]:
|
||||
if self.debug:
|
||||
|
@ -178,7 +180,8 @@ class TestEnv(ContextManager['TestEnv']):
|
|||
imgopts: Optional[str] = None,
|
||||
misalign: bool = False,
|
||||
debug: bool = False,
|
||||
valgrind: bool = False) -> None:
|
||||
valgrind: bool = False,
|
||||
gdb: bool = False) -> None:
|
||||
self.imgfmt = imgfmt
|
||||
self.imgproto = imgproto
|
||||
self.aiomode = aiomode
|
||||
|
@ -186,6 +189,15 @@ class TestEnv(ContextManager['TestEnv']):
|
|||
self.misalign = misalign
|
||||
self.debug = debug
|
||||
|
||||
if gdb:
|
||||
self.gdb_options = os.getenv('GDB_OPTIONS', DEF_GDB_OPTIONS)
|
||||
if not self.gdb_options:
|
||||
# cover the case 'export GDB_OPTIONS='
|
||||
self.gdb_options = DEF_GDB_OPTIONS
|
||||
elif 'GDB_OPTIONS' in os.environ:
|
||||
# to not propagate it in prepare_subprocess()
|
||||
del os.environ['GDB_OPTIONS']
|
||||
|
||||
if valgrind:
|
||||
self.valgrind_qemu = 'y'
|
||||
|
||||
|
@ -285,6 +297,7 @@ PLATFORM -- {platform}
|
|||
TEST_DIR -- {TEST_DIR}
|
||||
SOCK_DIR -- {SOCK_DIR}
|
||||
SOCKET_SCM_HELPER -- {SOCKET_SCM_HELPER}
|
||||
GDB_OPTIONS -- {GDB_OPTIONS}
|
||||
"""
|
||||
|
||||
args = collections.defaultdict(str, self.get_env())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue