diff --git a/tests/host/__init__.py b/tests/host/__init__.py index 954e9b650..df4570535 100644 --- a/tests/host/__init__.py +++ b/tests/host/__init__.py @@ -203,6 +203,15 @@ class Controller: """ raise NotImplementedError() + def disable_debuginfod(self) -> Awaitable[None]: + """ + Tells the debugger not to use debuginfod (for retrieving + debugging information / symbols). + + This should be called before .launch(). + """ + raise NotImplementedError() + def start(controller: Callable[[Controller], Coroutine[Any, Any, None]]) -> None: """ diff --git a/tests/host/gdb/pytests_launcher.py b/tests/host/gdb/pytests_launcher.py index 4903b5313..a5ebdcc9b 100644 --- a/tests/host/gdb/pytests_launcher.py +++ b/tests/host/gdb/pytests_launcher.py @@ -59,6 +59,10 @@ class _GDBController(host.Controller): async def select_thread(self, tid: int) -> None: gdb.execute(f"thread {tid}") + async def disable_debuginfod(self) -> None: + gdb.execute("set debug-file-directory") + gdb.execute("set debuginfod enabled off") + def _start(outer: Callable[[host.Controller], Coroutine[Any, Any, None]]) -> None: # The GDB controller is entirely synchronous, so keep advancing the diff --git a/tests/host/lldb/launch_guest.py b/tests/host/lldb/launch_guest.py index 78bf9761f..b7b3740c7 100644 --- a/tests/host/lldb/launch_guest.py +++ b/tests/host/lldb/launch_guest.py @@ -58,6 +58,10 @@ async def _run(ctrl: Any, outer: Callable[..., Coroutine[Any, Any, None]]) -> No async def select_thread(self, tid: int) -> None: await self.pc.execute(f"thread select {tid}") + async def disable_debuginfod(self) -> None: + # Could also consider disabling `symbols.enable-external-lookup` + await self.pc.execute("settings set plugin.symbol-locator.debuginfod.server-urls {}") + await outer(_LLDBController(ctrl)) diff --git a/tests/library/dbg/tests/test_mallocng.py b/tests/library/dbg/tests/test_mallocng.py index c48d01b69..b121a480e 100644 --- a/tests/library/dbg/tests/test_mallocng.py +++ b/tests/library/dbg/tests/test_mallocng.py @@ -299,6 +299,9 @@ async def test_mallocng_meta(ctrl: Controller, binary: str): async def test_mallocng_malloc_context(ctrl: Controller, binary: str): import pwndbg.color as color + # Make sure we are not working with symbols when we think we aren't + await ctrl.disable_debuginfod() + await ctrl.launch(binary) # Check that we do not find it at the first program instruction