summaryrefslogtreecommitdiffstats
path: root/tools/gdb/python/helper.py
blob: dfd01ebfb26fa9726347ec9c9e6452f1220c4da9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#
# RTEMS GDB support helper routins.

import gdb

def tasks_printer_routine(wait_queue):
    tasks = wait_queue.tasks()
    print '    Queue: len = %d, state = %s' % (len(tasks),wait_queue.state())
    for t in range(0, len(tasks)):
        print '      ', tasks[t].brief(), ' (%08x)' % (tasks[t].id())

def type_from_value(val):
    type = val.type;
    # If it points to a reference, get the reference.
    if type.code == gdb.TYPE_CODE_REF:
        type = type.target ()
    # Get the unqualified type
    return type.unqualified ()

def test_bit(val, pos):
    return bool(val & (1 << (pos-1)))