~pmdj/ubuntu/trusty/qemu/2.9+applesmc+fadtv3

« back to all changes in this revision

Viewing changes to scripts/qemugdb/mtree.py

  • Committer: Phil Dennis-Jordan
  • Date: 2017-07-21 08:03:43 UTC
  • mfrom: (1.1.1)
  • Revision ID: phil@philjordan.eu-20170721080343-2yr2vdj7713czahv
New upstream release 2.9.0.

Show diffs side-by-side

added added

removed removed

Lines of Context:
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)