source: rtems-tools/tools/gdb/python/supercore.py @ 3162858

4.104.115
Last change on this file since 3162858 was 3162858, checked in by Chris Johns <chrisj@…>, on 08/26/14 at 04:57:57

gdb-python: Update so 'rtems task' lists the classic tasks.

This is a first pass at cleaning up the support. To use:

$ waf configure --prefix=$HOME/development/rtems/4.11
$ waf build install

Start GDB and break at Init:

(gdb) py import rtems
(gdb) rtems task

will list the classic API tasks.

  • Property mode set to 100644
File size: 3.1 KB
Line 
1# RTEMS Tools Project (http://www.rtems.org/)
2# Copyright 2010-2014 Chris Johns (chrisj@rtems.org)
3# All rights reserved.
4#
5# This file is part of the RTEMS Tools package in 'rtems-tools'.
6#
7# Redistribution and use in source and binary forms, with or without
8# modification, are permitted provided that the following conditions are met:
9#
10# 1. Redistributions of source code must retain the above copyright notice,
11# this list of conditions and the following disclaimer.
12#
13# 2. Redistributions in binary form must reproduce the above copyright notice,
14# this list of conditions and the following disclaimer in the documentation
15# and/or other materials provided with the distribution.
16#
17# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
21# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27# POSSIBILITY OF SUCH DAMAGE.
28#
29
30#
31# RTEMS Supercore Objects
32#
33
34import threads
35import helper
36
37class time_of_day:
38    '''Manage time of day object'''
39
40    def __init__(self, tod):
41        self.tod = tod
42
43    def now(self):
44        return self.tod['now']
45
46    def timer(self):
47        return self.tod['uptime']
48
49    def is_set(self):
50        return bool(self.tod['is_set'])
51
52    def show(self):
53        print ' Time Of Day'
54
55        if not self.is_set():
56            print ' Application has not set a TOD'
57
58        print '      Now:', self.now()
59        print '   Uptime:', self.timer()
60
61
62class message_queue:
63    '''Manage a Supercore message_queue'''
64
65    def __init__(self, message_queue):
66        self.queue = message_queue
67        self.wait_queue = threads.queue(self.queue['Wait_queue'])
68        # ToDo: self.attribute =''
69        # self.buffer
70
71    def show(self):
72        helper.tasks_printer_routine(self.wait_queue)
73
74class barrier_attributes:
75    '''supercore bbarrier attribute'''
76
77    def __init__(self,attr):
78        self.attr = attr
79
80    def max_count(self):
81        c = self.attr['maximum_count']
82        return c
83
84    def discipline(self):
85        d = self.attr['discipline']
86        return d
87
88class barrier_control:
89    '''Manage a Supercore barrier'''
90
91    def __init__(self, barrier):
92        self.barrier = barrier
93        self.wait_queue = threads.queue(self.barrier['Wait_queue'])
94        self.attr = barrier_attributes(self.barrier['Attributes'])
95
96    def waiting_threads(self):
97        wt = self.barrier['number_of_waiting_threads']
98        return wt
99
100    def max_count(self):
101        return self.attr.max_count()
102
103    def discipline(self):
104        return self.attr.discipline()
105
106    def tasks(self):
107        return self.wait_queue
Note: See TracBrowser for help on using the repository browser.