qemu with hax to log dma reads & writes jcs.org/2018/11/12/vfio

scripts/qemugdb/mtree.py: fix up mtree dump

Since QEMU has been able to build with native Int128 support this was
broken as it attempts to fish values out of the non-existent
structure. Also the alias print was trying to make a %x out of
gdb.ValueType directly which didn't seem to work.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>

+10 -2
+10 -2
scripts/qemugdb/mtree.py
··· 21 21 return ptr == gdb.Value(0).cast(ptr.type) 22 22 23 23 def int128(p): 24 - return int(p['lo']) + (int(p['hi']) << 64) 24 + '''Read an Int128 type to a python integer. 25 + 26 + QEMU can be built with native Int128 support so we need to detect 27 + if the value is a structure or the native type. 28 + ''' 29 + if p.type.code == gdb.TYPE_CODE_STRUCT: 30 + return int(p['lo']) + (int(p['hi']) << 64) 31 + else: 32 + return int(("%s" % p), 16) 25 33 26 34 class MtreeCommand(gdb.Command): 27 35 '''Display the memory tree hierarchy''' ··· 69 77 gdb.write('%s alias: %s@%016x (@ %s)\n' % 70 78 (' ' * level, 71 79 alias['name'].string(), 72 - ptr['alias_offset'], 80 + int(ptr['alias_offset']), 73 81 alias, 74 82 ), 75 83 gdb.STDOUT)