about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorTheofilos Augoustis <theofilos.augoustis@gmail.com>2025-11-19 09:14:00 +0000
committerTheofilos Augoustis <theofilos.augoustis@gmail.com>2025-11-20 09:46:17 +0000
commit533fedb9093323594cac81a4ed3c3873a575c468 (patch)
tree9b04bbf609c95783d905e239e6018cdc7981ed0b
parentefecd89158cfd0e7ba34cee9d70fd24849d7c533 (diff)
downloadfocaccia-533fedb9093323594cac81a4ed3c3873a575c468.tar.gz
focaccia-533fedb9093323594cac81a4ed3c3873a575c468.zip
Implement thread switching interface
-rw-r--r--src/focaccia/qemu/_qemu_tool.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/focaccia/qemu/_qemu_tool.py b/src/focaccia/qemu/_qemu_tool.py
index 7ca556b..2d1d144 100644
--- a/src/focaccia/qemu/_qemu_tool.py
+++ b/src/focaccia/qemu/_qemu_tool.py
@@ -145,6 +145,7 @@ class GDBServerStateIterator:
         self._deterministic_log = deterministic_log
         self._process = gdb.selected_inferior()
         self._first_next = True
+        self._thread_num = 1
 
         # Try to determine the guest architecture. This is a bit hacky and
         # tailored to GDB's naming for the x86-64 architecture.
@@ -283,6 +284,10 @@ class GDBServerStateIterator:
     def _step(self):
         gdb.execute('si', to_string=True)
 
+    def context_switch(self, thread_number: int) -> None:
+        gdb.execute(f'thread {thread_number}')
+        self._thread_num = thread_number
+
     def get_sections(self) -> list[MemoryMapping]:
         mappings = []