target/mips: Remove XBurst Media eXtension Unit dead code
[qemu/ar7.git] / scripts / qemugdb / aio.py
blobd7c1ba0c2866ecb73d04f0dfc4e15bf885041156
2 # GDB debugging support: aio/iohandler debug
4 # Copyright (c) 2015 Red Hat, Inc.
6 # Author: Dr. David Alan Gilbert <dgilbert@redhat.com>
8 # This work is licensed under the terms of the GNU GPL, version 2 or
9 # later. See the COPYING file in the top-level directory.
12 import gdb
13 from qemugdb import coroutine
15 def isnull(ptr):
16 return ptr == gdb.Value(0).cast(ptr.type)
18 def dump_aiocontext(context, verbose):
19 '''Display a dump and backtrace for an aiocontext'''
20 cur = context['aio_handlers']['lh_first']
21 # Get pointers to functions we're going to process specially
22 sym_fd_coroutine_enter = gdb.parse_and_eval('fd_coroutine_enter')
24 while not isnull(cur):
25 entry = cur.dereference()
26 gdb.write('----\n%s\n' % entry)
27 if verbose and cur['io_read'] == sym_fd_coroutine_enter:
28 coptr = (cur['opaque'].cast(gdb.lookup_type('FDYieldUntilData').pointer()))['co']
29 coptr = coptr.cast(gdb.lookup_type('CoroutineUContext').pointer())
30 coroutine.bt_jmpbuf(coptr['env']['__jmpbuf'])
31 cur = cur['node']['le_next'];
33 gdb.write('----\n')
35 class HandlersCommand(gdb.Command):
36 '''Display aio handlers'''
37 def __init__(self):
38 gdb.Command.__init__(self, 'qemu handlers', gdb.COMMAND_DATA,
39 gdb.COMPLETE_NONE)
41 def invoke(self, arg, from_tty):
42 verbose = False
43 argv = gdb.string_to_argv(arg)
45 if len(argv) > 0 and argv[0] == '--verbose':
46 verbose = True
47 argv.pop(0)
49 if len(argv) > 1:
50 gdb.write('usage: qemu handlers [--verbose] [handler]\n')
51 return
53 if len(argv) == 1:
54 handlers_name = argv[0]
55 else:
56 handlers_name = 'qemu_aio_context'
57 dump_aiocontext(gdb.parse_and_eval(handlers_name), verbose)