Version 4 (modified by ChrisJohns, on Mar 22, 2010 at 3:25:39 AM) (diff)

Devel and GSoC

GDB Python

ThHis? project add support for RTEMS in GDB using Python.

Recent versions of GDB ship with Python embedded as a scripting language. This was added so GDB could be extended using a fully featured scripting language. The embedding of Python into GDB currently provides Pretty Printing hooks. Pretty printing allows GDB to be extended to provide human readable output for complex structures that do not print clearly using the actual type structure. The first use was to hide the C++ STD details.

Python in GFB allow the RTEMS project to extend GDB so RTEMS's various data types can be presented in a human readable manner or made accessible to GDB.


The RTEMS Pretty Printer can be downloaded from

Contact Chris Johns? if you are interested in helping with this work.


This project is on going. There are large number of types and structures in RTEMS and having them all accessible from GDB is a large undertaking. The initial phase is to support the basic types needed by RTEMS users to debug RTEMS applications. They are:

# Objects # Objects_Control # Objects_Name

  • Classic

# Attributes # Tasks # Semaphores # Message Queues # Paritions # Regions # Periods # Extensions # Barriers


# Threads # Keys # Message queue Fds # Message Queues # Mutexes # Semaphores # Condition Variables # Timers # Barriers # Semaphores # Read/Write? Locks

Various pretty printers have been added to help improve looking at RTEMS internal structures.

A RTEMS command call 'rtems' has been added that have sub-commands added. The sub-commands are:

# object

RTEMS Object Command

The command takes a single parameter an object id and prints the object details it references. The object id can be a number or a variable that contains a valid id. For example:

Breakpoint 6, rtems_semaphore_obtain (id= = {...}, option_set=0, timeout=0) at \


(gdb) rtems object id API:classic Class:semaphores Node:1 Index:18 Id:1A010012

Name: DDEV Attr: 0x00000010,local,fifo,bin-sema,no-inherit-pri,no-pri-ceiling Lock: unlocked

Nesting: 0 Blocked: 0

Holder: unlocked

Queue: len = 0, state = waiting-for-mutex

You could look at the object with <tt>rtems object 0x1a010012</tt> or <tt>rtems object 436273170</tt>. For a task you can do:

(gdb) rtems object _Thread_Executing-> API:classic Class:tasks Node:1 Index:7 Id:0A010007

Name: fsts

State: ready

Current: 160

Real: 160

Suspends: 65536 Post Ext: false

Preempt: true

T Budget: 48


This project is currently in development. Please contribute.


The project is suitable as a GSoC project. The project requires a student that:

# Has completed the hello world demo required by all RTEMS GSoC strudent # Knowledge of Python and using classes in Python plus a willingness to learn Python # Ability to code in C. We may require changes to GDB. I suppose this may require paperwork with the FSF to assign copyright.

The major focus of the GSoC work is to look at threading and to teach GDB about the RTEMS threads. The may require GDB having to thread information added to the 'gdb' package exported from GDB to Python as well as hooks for calls when a break point is hit so the RTEMS Python code can read the thread information into GDB.