analyze-migration.py: Fix instance_id signedness
PATCH 1/1 analyze-migration.py: Fix instance_id signedness
The instance_id field is uint32_t in the migration code, however the script currently handles it as a signed integer:
$ ./scripts/analyze-migration.py -f mig
Traceback (most recent call last):
File "./scripts/analyze-migration.py", line 605, in <module>
dump.read(dump_memory = args.memory)
File "./scripts/analyze-migration.py", line 539, in read
classdesc = self.section_classes[section_key]
KeyError: ('spapr_iommu', -2147483648)Signed-off-by Fabiano Rosas <[email protected]>
--- scripts/analyze-migration.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
scripts/analyze-migration.py +3 -3
@@ -40,8 +40,8 @@ def __init__(self, filename): def read64(self): return int.from_bytes(self.file.read(8), byteorder='big', signed=True) - def read32(self): - return int.from_bytes(self.file.read(4), byteorder='big', signed=True) + def read32(self, signed=True): + return int.from_bytes(self.file.read(4), byteorder='big', signed=signed) def read16(self): return int.from_bytes(self.file.read(2), byteorder='big', signed=True)
@@ -533,7 +533,7 @@ def read(self, desc_only = False, dump_memory = False, write_memory = False): elif section_type == self.QEMU_VM_SECTION_START or section_type == self.QEMU_VM_SECTION_FULL: section_id = file.read32() name = file.readstr() - instance_id = file.read32() + instance_id = file.read32(signed=False) version_id = file.read32() section_key = (name, instance_id) classdesc = self.section_classes[section_key]
Signature · 1 line
2.34.1
Quoted 11 lines · Fabiano Rosas
The
instance_idfield isuint32_tin the migration code, however the script currently handles it as a signed integer:$ ./scripts/analyze-migration.py -f mig Traceback (most recent call last): File "./scripts/analyze-migration.py", line 605, in <module> dump.read(dump_memory = args.memory) File "./scripts/analyze-migration.py", line 539, in read classdesc = self.section_classes[section_key] KeyError: ('spapr_iommu', -2147483648)
Quoted 4 lines
Signed-off-by Fabiano Rosas <[email protected]>--- scripts/analyze-migration.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
Reviewed-by Philippe Mathieu-Daudé <[email protected]>