Open jstarink opened 11 months ago
I have a guess as to what's going wrong. When the recording exists, you call run_replay
which runs the replay. Then you still hit the call to run
which will try to resume the emulation from where things left off after the replay which will be something weird. If that's the issue, I think we should raise an error instead of crashing in this strange way.
Does the issue go away if you refactor things to avoid the call to run
after run_replay
, like this:
from pandare import Panda
import os
panda = Panda(generic='x86_64')
recording_name = "linux64recording"
if os.path.isfile(f"{recording_name}-rr-snp"):
print("Replaying")
panda.run_replay(recording_name)
else:
@panda.queue_blocking
def driver():
print("Recording")
panda.revert_sync('root')
panda.record_cmd("whoami", recording_name=recording_name)
panda.stop_run()
panda.run()
Perfect, that seems to have fixed the problem!
This makes me a bit confused about the naming of the available functions though. Considering that there are other run_xxx
methods (such as run_serial_cmd
) provided in the examples folder that are actually put into a panda.queue_blocking
tagged function. Is run_replay
substantially different from these other run methods? When should something be put in a queue and when shouldn't it be queued?
Also, indeed, a more descriptive error would've been nice :).
The run
method runs a live guest while run_replay
runs a replay, generally you want one or the other, not both.
I definitely see what you're saying where it's confusing how the run_serial_cmd
method has a similar style name and being totally different! Open to suggestions for how we could improve these names in the future!
@AndrewFasano Thanks for the explanation, that definitely clears it up!
I definitely see what you're saying where it's confusing how the run_serial_cmd method has a similar style name and being totally different! Open to suggestions for how we could improve these names in the future!
Some ideas come to mind:
run_
and exec_
/execute_
prefixes. run()
to something like run_live_guest()
, to make it more explicit and no confusion can happen.
Description
I am trying to get a basic record new or replay mechanism running. Following the documentation, I believe this should be either just a call to
panda.run_replay
orpanda.record_cmd
. However, there seems to be some nondeterminism in replaying the previously recorded traces with (Py)PANDA when doing so. Recording works fine, but replaying results in either a segfault or other assertion errors. This behavior seems consistent with both i386 and x86_64 images of both Linux and Windows. Am I doing something wrong or is this a bug?How to reproduce
Create a new basic
test.py
file in/local
with the following contents:Interestingly enough, the second output seems to indicate the replay completed successfully, but then still crashes afterwards.
Additional Info
Host OS: MANJARO 23.1.0 Kernel: 6.1.64 Docker Version: 24.0.7 panda-system-x86_64 --version: QEMU emulator version 2.9.1 (-dirty) CPU: Intel i7-11800H RAM: 16GB