summaryrefslogtreecommitdiffstats
path: root/qemu/scripts/qemugdb/mtree.py
diff options
context:
space:
mode:
authorRajithaY <rajithax.yerrumsetty@intel.com>2017-04-25 03:31:15 -0700
committerRajitha Yerrumchetty <rajithax.yerrumsetty@intel.com>2017-05-22 06:48:08 +0000
commitbb756eebdac6fd24e8919e2c43f7d2c8c4091f59 (patch)
treeca11e03542edf2d8f631efeca5e1626d211107e3 /qemu/scripts/qemugdb/mtree.py
parenta14b48d18a9ed03ec191cf16b162206998a895ce (diff)
Adding qemu as a submodule of KVMFORNFV
This Patch includes the changes to add qemu as a submodule to kvmfornfv repo and make use of the updated latest qemu for the execution of all testcase Change-Id: I1280af507a857675c7f81d30c95255635667bdd7 Signed-off-by:RajithaY<rajithax.yerrumsetty@intel.com>
Diffstat (limited to 'qemu/scripts/qemugdb/mtree.py')
-rw-r--r--qemu/scripts/qemugdb/mtree.py82
1 files changed, 0 insertions, 82 deletions
diff --git a/qemu/scripts/qemugdb/mtree.py b/qemu/scripts/qemugdb/mtree.py
deleted file mode 100644
index cc8131c2e..000000000
--- a/qemu/scripts/qemugdb/mtree.py
+++ /dev/null
@@ -1,82 +0,0 @@
-#!/usr/bin/python
-
-# GDB debugging support
-#
-# Copyright 2012 Red Hat, Inc. and/or its affiliates
-#
-# Authors:
-# Avi Kivity <avi@redhat.com>
-#
-# This work is licensed under the terms of the GNU GPL, version 2. See
-# the COPYING file in the top-level directory.
-#
-# Contributions after 2012-01-13 are licensed under the terms of the
-# GNU GPL, version 2 or (at your option) any later version.
-
-# 'qemu mtree' -- display the memory hierarchy
-
-import gdb
-
-def isnull(ptr):
- return ptr == gdb.Value(0).cast(ptr.type)
-
-def int128(p):
- return int(p['lo']) + (int(p['hi']) << 64)
-
-class MtreeCommand(gdb.Command):
- '''Display the memory tree hierarchy'''
- def __init__(self):
- gdb.Command.__init__(self, 'qemu mtree', gdb.COMMAND_DATA,
- gdb.COMPLETE_NONE)
- self.queue = []
- def invoke(self, arg, from_tty):
- self.seen = set()
- self.queue_root('address_space_memory')
- self.queue_root('address_space_io')
- self.process_queue()
- def queue_root(self, varname):
- ptr = gdb.parse_and_eval(varname)['root']
- self.queue.append(ptr)
- def process_queue(self):
- while self.queue:
- ptr = self.queue.pop(0)
- if int(ptr) in self.seen:
- continue
- self.print_item(ptr)
- def print_item(self, ptr, offset = gdb.Value(0), level = 0):
- self.seen.add(int(ptr))
- addr = ptr['addr']
- addr += offset
- size = int128(ptr['size'])
- alias = ptr['alias']
- klass = ''
- if not isnull(alias):
- klass = ' (alias)'
- elif not isnull(ptr['ops']):
- klass = ' (I/O)'
- elif bool(ptr['ram']):
- klass = ' (RAM)'
- gdb.write('%s%016x-%016x %s%s (@ %s)\n'
- % (' ' * level,
- int(addr),
- int(addr + (size - 1)),
- ptr['name'].string(),
- klass,
- ptr,
- ),
- gdb.STDOUT)
- if not isnull(alias):
- gdb.write('%s alias: %s@%016x (@ %s)\n' %
- (' ' * level,
- alias['name'].string(),
- ptr['alias_offset'],
- alias,
- ),
- gdb.STDOUT)
- self.queue.append(alias)
- subregion = ptr['subregions']['tqh_first']
- level += 1
- while not isnull(subregion):
- self.print_item(subregion, addr, level)
- subregion = subregion['subregions_link']['tqe_next']
-