diff options
| author | Theofilos Augoustis <theofilos.augoustis@gmail.com> | 2025-11-24 15:06:15 +0000 |
|---|---|---|
| committer | Theofilos Augoustis <theofilos.augoustis@gmail.com> | 2025-11-24 15:06:15 +0000 |
| commit | 272f780033107960cb144302f64bb7504c45ea07 (patch) | |
| tree | e1b14662893f4fb811b9061e3e87c84346133b59 /src | |
| parent | 49994253056655faa86ed3d29cbf0b85859bcb9c (diff) | |
| download | focaccia-272f780033107960cb144302f64bb7504c45ea07.tar.gz focaccia-272f780033107960cb144302f64bb7504c45ea07.zip | |
Make running Focaccia with multithreading possible
Diffstat (limited to 'src')
| -rw-r--r-- | src/focaccia/qemu/target.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/focaccia/qemu/target.py b/src/focaccia/qemu/target.py index c934b42..3877bcc 100644 --- a/src/focaccia/qemu/target.py +++ b/src/focaccia/qemu/target.py @@ -1,5 +1,6 @@ import re import gdb +import socket import logging from typing import Optional @@ -24,6 +25,8 @@ debug = logger.debug info = logger.info warn = logger.warning +DEST = "/tmp/memcached_scheduler.sock" + def match_event(event: Event, target: ReadableProgramState) -> bool: # Match just on PC debug(f'Matching for PC {hex(target.read_pc())} with event {hex(event.pc)}') @@ -218,6 +221,8 @@ class GDBServerConnector: class GDBServerStateIterator(GDBServerConnector): def __init__(self, remote: str, deterministic_log: DeterministicLog): + self.sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) + self.sock.connect(DEST) super().__init__(remote) self._deterministic_log = deterministic_log @@ -328,7 +333,7 @@ class GDBServerStateIterator(GDBServerConnector): self._thread_context[self._current_event_id] = event self._current_event_id = post_event.tid tid, num = self._thread_map[self._current_event_id] - self.context_switch(num) + self.context_switch(tid) state = self.current_state() debug(f'Scheduled {hex(tid)} that corresponds to native {hex(post_event.tid)}') @@ -402,5 +407,5 @@ class GDBServerStateIterator(GDBServerConnector): return GDBProgramState(self._process, gdb.selected_frame(), self.arch) def context_switch(self, thread_number: int) -> None: - gdb.execute(f'thread {thread_number}') + self.sock.send(bytes([thread_number])) |