target/arm/vfp_helper: Extract vfp_set_fpscr_to_host()
[qemu/ar7.git] / scripts / qemugdb / timers.py
blobf0e132d27a77ff01d2fec5321b0404b1172efe74
1 #!/usr/bin/python
2 # -*- coding: utf-8 -*-
3 # GDB debugging support
5 # Copyright 2017 Linaro Ltd
7 # Author: Alex Bennée <alex.bennee@linaro.org>
9 # This work is licensed under the terms of the GNU GPL, version 2 or later.
10 # See the COPYING file in the top-level directory.
12 # SPDX-License-Identifier: GPL-2.0-or-later
14 # 'qemu timers' -- display the current timerlists
16 import gdb
18 class TimersCommand(gdb.Command):
19 '''Display the current QEMU timers'''
21 def __init__(self):
22 'Register the class as a gdb command'
23 gdb.Command.__init__(self, 'qemu timers', gdb.COMMAND_DATA,
24 gdb.COMPLETE_NONE)
26 def dump_timers(self, timer):
27 "Follow a timer and recursively dump each one in the list."
28 # timer should be of type QemuTimer
29 gdb.write(" timer %s/%s (cb:%s,opq:%s)\n" % (
30 timer['expire_time'],
31 timer['scale'],
32 timer['cb'],
33 timer['opaque']))
35 if int(timer['next']) > 0:
36 self.dump_timers(timer['next'])
39 def process_timerlist(self, tlist, ttype):
40 gdb.write("Processing %s timers\n" % (ttype))
41 gdb.write(" clock %s is enabled:%s, last:%s\n" % (
42 tlist['clock']['type'],
43 tlist['clock']['enabled'],
44 tlist['clock']['last']))
45 if int(tlist['active_timers']) > 0:
46 self.dump_timers(tlist['active_timers'])
49 def invoke(self, arg, from_tty):
50 'Run the command'
51 main_timers = gdb.parse_and_eval("main_loop_tlg")
53 # This will break if QEMUClockType in timer.h is redfined
54 self.process_timerlist(main_timers['tl'][0], "Realtime")
55 self.process_timerlist(main_timers['tl'][1], "Virtual")
56 self.process_timerlist(main_timers['tl'][2], "Host")
57 self.process_timerlist(main_timers['tl'][3], "Virtual RT")