[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 2/7] scripts/replay_dump.sh: Update to current rr record format
From: |
Nicholas Piggin |
Subject: |
[PATCH 2/7] scripts/replay_dump.sh: Update to current rr record format |
Date: |
Fri, 23 Jun 2023 22:57:02 +1000 |
This thing seems to have fallen by the wayside. This quick hack gets
it vaguely working with the current format. It was some use in fixing
rr support for ppc, so maybe others will find it useful too.
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
scripts/replay-dump.py | 89 +++++++++++++++++++++++++++++++++++++++---
1 file changed, 83 insertions(+), 6 deletions(-)
diff --git a/scripts/replay-dump.py b/scripts/replay-dump.py
index 3ba97a6d30..c46ff8ffd6 100755
--- a/scripts/replay-dump.py
+++ b/scripts/replay-dump.py
@@ -122,12 +122,19 @@ def swallow_async_qword(eid, name, dumpfile):
print(" %s(%d) @ %d" % (name, eid, step_id))
return True
+def swallow_bytes(eid, name, dumpfile, nr):
+ "Swallow nr bytes of data without looking at it"
+ for x in range(nr):
+ read_byte(dumpfile)
+ return True
+
async_decode_table = [ Decoder(0, "REPLAY_ASYNC_EVENT_BH",
swallow_async_qword),
- Decoder(1, "REPLAY_ASYNC_INPUT", decode_unimp),
- Decoder(2, "REPLAY_ASYNC_INPUT_SYNC", decode_unimp),
- Decoder(3, "REPLAY_ASYNC_CHAR_READ", decode_unimp),
- Decoder(4, "REPLAY_ASYNC_EVENT_BLOCK", decode_unimp),
- Decoder(5, "REPLAY_ASYNC_EVENT_NET", decode_unimp),
+ Decoder(1, "REPLAY_ASYNC_BH_ONESHOT", decode_unimp),
+ Decoder(2, "REPLAY_ASYNC_INPUT", decode_unimp),
+ Decoder(3, "REPLAY_ASYNC_INPUT_SYNC", decode_unimp),
+ Decoder(4, "REPLAY_ASYNC_CHAR_READ", decode_unimp),
+ Decoder(5, "REPLAY_ASYNC_EVENT_BLOCK", decode_unimp),
+ Decoder(6, "REPLAY_ASYNC_EVENT_NET", decode_unimp),
]
# See replay_read_events/replay_read_event
def decode_async(eid, name, dumpfile):
@@ -156,6 +163,13 @@ def decode_audio_out(eid, name, dumpfile):
print_event(eid, name, "%d" % (audio_data))
return True
+def decode_random(eid, name, dumpfile):
+ ret = read_dword(dumpfile)
+ size = read_dword(dumpfile)
+ swallow_bytes(eid, name, dumpfile, size)
+ print_event(eid, name, "%d %d" % (ret, size))
+ return True
+
def decode_checkpoint(eid, name, dumpfile):
"""Decode a checkpoint.
@@ -184,6 +198,24 @@ def decode_interrupt(eid, name, dumpfile):
print_event(eid, name)
return True
+def decode_exception(eid, name, dumpfile):
+ print_event(eid, name)
+ return True
+
+def decode_shutdown(eid, name, dumpfile):
+ print_event(eid, name)
+ return True
+
+def decode_end(eid, name, dumpfile):
+ print_event(eid, name)
+ return False
+
+def decode_char_write(eid, name, dumpfile):
+ res = read_dword(dumpfile)
+ offset = read_dword(dumpfile)
+ print_event(eid, name)
+ return True
+
def decode_clock(eid, name, dumpfile):
clock_data = read_qword(dumpfile)
print_event(eid, name, "0x%x" % (clock_data))
@@ -268,6 +300,48 @@ def decode_clock(eid, name, dumpfile):
Decoder(28, "EVENT_CP_RESET", decode_checkpoint),
]
+v12_event_table = [Decoder(0, "EVENT_INSTRUCTION", decode_instruction),
+ Decoder(1, "EVENT_INTERRUPT", decode_interrupt),
+ Decoder(2, "EVENT_EXCEPTION", decode_exception),
+ Decoder(3, "EVENT_ASYNC_BH", swallow_async_qword),
+ Decoder(4, "EVENT_ASYNC_BH_ONESHOT", decode_unimp),
+ Decoder(5, "EVENT_ASYNC_INPUT", decode_unimp),
+ Decoder(6, "EVENT_ASYNC_INPUT_SYNC", decode_unimp),
+ Decoder(7, "EVENT_ASYNC_CHAR_READ", decode_unimp),
+ Decoder(8, "EVENT_ASYNC_BLOCK", decode_unimp),
+ Decoder(9, "EVENT_ASYNC_NET", decode_unimp),
+ Decoder(10, "EVENT_SHUTDOWN", decode_unimp),
+ Decoder(11, "EVENT_SHUTDOWN_HOST_ERR", decode_shutdown),
+ Decoder(12, "EVENT_SHUTDOWN_HOST_QMP_QUIT", decode_shutdown),
+ Decoder(13, "EVENT_SHUTDOWN_HOST_QMP_RESET",
decode_shutdown),
+ Decoder(14, "EVENT_SHUTDOWN_HOST_SIGNAL", decode_shutdown),
+ Decoder(15, "EVENT_SHUTDOWN_HOST_UI", decode_shutdown),
+ Decoder(16, "EVENT_SHUTDOWN_GUEST_SHUTDOWN",
decode_shutdown),
+ Decoder(17, "EVENT_SHUTDOWN_GUEST_RESET", decode_shutdown),
+ Decoder(18, "EVENT_SHUTDOWN_GUEST_PANIC", decode_shutdown),
+ Decoder(19, "EVENT_SHUTDOWN_SUBSYS_RESET", decode_shutdown),
+ Decoder(20, "EVENT_SHUTDOWN_SNAPSHOT_LOAD", decode_shutdown),
+ Decoder(21, "EVENT_SHUTDOWN___MAX", decode_shutdown),
+ Decoder(22, "EVENT_CHAR_WRITE", decode_char_write),
+ Decoder(23, "EVENT_CHAR_READ_ALL", decode_unimp),
+ Decoder(24, "EVENT_CHAR_READ_ALL_ERROR", decode_unimp),
+ Decoder(25, "EVENT_AUDIO_OUT", decode_audio_out),
+ Decoder(26, "EVENT_AUDIO_IN", decode_unimp),
+ Decoder(27, "EVENT_RANDOM", decode_random),
+ Decoder(28, "EVENT_CLOCK_HOST", decode_clock),
+ Decoder(29, "EVENT_CLOCK_VIRTUAL_RT", decode_clock),
+ Decoder(30, "EVENT_CP_CLOCK_WARP_START", decode_checkpoint),
+ Decoder(31, "EVENT_CP_CLOCK_WARP_ACCOUNT",
decode_checkpoint),
+ Decoder(32, "EVENT_CP_RESET_REQUESTED", decode_checkpoint),
+ Decoder(33, "EVENT_CP_SUSPEND_REQUESTED", decode_checkpoint),
+ Decoder(34, "EVENT_CP_CLOCK_VIRTUAL", decode_checkpoint),
+ Decoder(35, "EVENT_CP_CLOCK_HOST", decode_checkpoint),
+ Decoder(36, "EVENT_CP_CLOCK_VIRTUAL_RT", decode_checkpoint),
+ Decoder(37, "EVENT_CP_INIT", decode_checkpoint_init),
+ Decoder(38, "EVENT_CP_RESET", decode_checkpoint),
+ Decoder(39, "EVENT_END", decode_end),
+]
+
def parse_arguments():
"Grab arguments for script"
parser = argparse.ArgumentParser()
@@ -285,7 +359,10 @@ def decode_file(filename):
print("HEADER: version 0x%x" % (version))
- if version == 0xe02007:
+ if version == 0xe0200c:
+ event_decode_table = v12_event_table
+ replay_state.checkpoint_start = 12
+ elif version == 0xe02007:
event_decode_table = v7_event_table
replay_state.checkpoint_start = 12
elif version == 0xe02006:
--
2.40.1
- [PATCH 0/7] ppc: fix larx migration, fix record-replay, Nicholas Piggin, 2023/06/23
- [PATCH 1/7] target/ppc: Fix CPU reservation migration for record-replay, Nicholas Piggin, 2023/06/23
- [PATCH 2/7] scripts/replay_dump.sh: Update to current rr record format,
Nicholas Piggin <=
- [PATCH 3/7] spapr: Fix machine reset deadlock from replay-record, Nicholas Piggin, 2023/06/23
- [PATCH 4/7] spapr: Fix record-replay machine reset consuming too many events, Nicholas Piggin, 2023/06/23
- [PATCH 5/7] target/ppc: Fix timebase reset with record-replay, Nicholas Piggin, 2023/06/23
- [PATCH 6/7] tests/avocado: boot ppc64 pseries replay-record test to Linux VFS mount, Nicholas Piggin, 2023/06/23
- [PATCH 7/7] tests/avocado: ppc64 pseries reverse debugging test, Nicholas Piggin, 2023/06/23