about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorTheofilos Augoustis <theofilos.augoustis@gmail.com>2025-11-24 17:06:42 +0000
committerTheofilos Augoustis <theofilos.augoustis@gmail.com>2025-11-25 15:19:12 +0000
commitc14e444b15c32dd8304f91134f6a090dd2cf5300 (patch)
tree39189596882361a6dea641ff85ee543c12691c37
parenta8052d7acbcc357d47404a7be222f32aee92fad5 (diff)
downloadfocaccia-c14e444b15c32dd8304f91134f6a090dd2cf5300.tar.gz
focaccia-c14e444b15c32dd8304f91134f6a090dd2cf5300.zip
Correctly communicate TIDs to run.py
-rw-r--r--run.py5
-rw-r--r--src/focaccia/qemu/target.py3
2 files changed, 4 insertions, 4 deletions
diff --git a/run.py b/run.py
index d8cedcd..82be8e3 100644
--- a/run.py
+++ b/run.py
@@ -2,7 +2,6 @@ import os
 import signal
 import socket
 import subprocess
-import sys
 import select
 
 import ptrace.debugger
@@ -33,12 +32,12 @@ def schedule_next_nonblocking(sock, processes, current_proc):
     if not r:
         return current_proc  # no input → continue with current
 
-    data = sock.recv(64)
+    data = sock.recv(8)
     if not data:
         return current_proc
 
     try:
-        tid = int(data.strip())
+        tid = int.from_bytes(data, byteorder='little', signed=False)
     except ValueError:
         print(f"Scheduler: invalid data {data!r}")
         return current_proc
diff --git a/src/focaccia/qemu/target.py b/src/focaccia/qemu/target.py
index a62f297..f324cdf 100644
--- a/src/focaccia/qemu/target.py
+++ b/src/focaccia/qemu/target.py
@@ -412,5 +412,6 @@ class GDBServerStateIterator(GDBServerConnector):
     def context_switch(self, thread_number: int) -> None:
         if self.sock is None:
             raise NotImplementedError('Scheduling disabled')
-        self.sock.send(bytes([thread_number]))
+        data = thread_number.to_bytes(8, byteorder='little', signed=False)
+        self.sock.send(data)