Skip to main content

Freertos-gdb

Python module for user-friendly view freeRTOS-kernel objects in GDB

Requirements

GDB must built with python 3.6+ support

Check your GDB with command:

gdb -q -ex "python print('OK' if sys.version_info.major==3 and sys.version_info.minor>=6 else 'NOT SUPPORTED')" -ex "quit"

develop

sudo python setup.py develop

publish

python setup.py sdist bdist_wheel
twine upload dist/*

Install

  1. Install the distro using pip
pip install wqtool_gdb

Run

Start GDB and run the command

python import wqtool_gdb

Also, you could just update .gdbinit with this command

Possible problems and solutions

ModuleNotFoundError

Traceback (most recent call last):
  File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'freertos_gdb'
Error while executing Python code.

Solution

Check your sys.path inside GDB shell

python import sys; print(sys.path)

Append sys.path with a path to directory which contains freertos_gdb module. Or execute GDB with right PYTHONPATH env variable

Commands

You have freertos command with subcommands inside:

(gdb) freertos 
"freertos" must be followed by the name of a subcommand.
List of freertos subcommands:

freertos heap -- Generate a print out of the current heap info.
freertos queue --  Generate a print out of the current queues info.
freertos semaphore --  Generate a print out of the current semaphores info.
freertos task --  Generate a print out of the current tasks and their states.
freertos timer --  Generate a print out of the current timers info.
....

Examples

Tasks

(gdb) freertos task
CPU	 - Processing on CPU number
ID	 - TCB_t task memory address
PRI	 - Task priority
B_PRI	 - Base priority.
SS	 - Stack size.
SL	 - Stack limit (available space left).

CPU    ID          NAME       STATUS       PRI    B_PRI    MUTEXES_HELD    SS    SL
-----  ----------  ---------  ---------  -----  -------  --------------  ----  ----
CPU0   0x3ffb6674  IDLE       ready          0        0               0  1104   428
       0x3ffb6dd4  IDLE       ready          0        0               0  1104   428
CPU1   0x3ffbb724  SEM_RECUR  ready          6        6               1  1680   364
       0x3ffafd14  ipc0       suspended     24       24               0   564   456
       0x3ffb4db4  esp_timer  suspended     22       22               0  3648   444
       0x3ffb3c54  ipc1       suspended     24       24               0   592   428
       0x3ffb7734  Tmr Svc    delayed_1      1        1               0  1584   460
       0x3ffaf83c  SENDER1    delayed_1      6        6               0  1600   444
       0x3ffaf998  SENDER2    delayed_1      6        6               0  1548   496
       0x3ffb909c  READER1    delayed_1      6        6               0  1608   436
       0x3ffb99fc  READER2    delayed_1      6        6               0  1608   436
       0x3ffba35c  SEM_BIN1   delayed_1      6        6               0  1624   420
       0x3ffbacbc  SEM_BIN2   delayed_1      6        6               0  1592   452

Queues, Semafores (and mutexes)

To watch queues you must add them to registry via vQueueAddToRegistry

(gdb) freertos queue 
COUNT	 - Number of items currently in the queue.
I_LEN	 - Length of the queue (number of items could hold, not the number of bytes).
I_SIZE	 - Size of each item that the queue will hold.
TASKS_WAITING_TO_SEND	 - Tasks that are blocked waiting to post onto this queue.
TASKS_WAITING_TO_RECEIVE	 - Tasks that are blocked waiting to read from this queue.
RX_LCK	 - Number of items received from the queue (removed from the queue) while the queue was locked. Set to queueUNLOCKED when the queue is not locked.
TX_LCK	 - Number of items transmitted to the queue (added to the queue) while the queue was locked. Set to queueUNLOCKED when the queue is not locked.

NAME    COUNT    I_LEN    I_SIZE    TASKS_WAITING_TO_SEND    TASKS_WAITING_TO_RECEIVE    RX_LCK    TX_LCK
------  -------  -------  --------  -----------------------  --------------------------  --------  --------
TmrQ    0        10       16                                 0x3ffb7734 Tmr Svc          -1        -1
queue1  10       10       4         0x3ffaf83c SENDER1                                   -1        -1
                                    0x3ffaf998 SENDER2
queue2  0        10       4                                  0x3ffb909c READER1          -1        -1
                                                             0x3ffb99fc READER2
(gdb) freertos semaphore 
COUNT	 - Number of items currently in the queue.
I_LEN	 - Length of the queue (number of items could hold, not the number of bytes).
MUTEX_HOLDER	 - The handle of the task that holds the lock.
RCALLCOUNT	 - Number of times a recursive mutex has been recursively "taken".
TASKS_WAITING_TO_GIVE	 - Tasks that are blocked waiting to release a lock.
TASKS_WAITING_TO_TAKE	 - Tasks that are blocked waiting to take a lock.

NAME             COUNT    I_LEN    MUTEX_HOLDER          RCALLCOUNT    TASKS_WAITING_TO_GIVE    TASKS_WAITING_TO_TAKE
---------------  -------  -------  --------------------  ------------  -----------------------  -----------------------
BINARY           0        1                                                                     0x3ffba35c SEM_BIN1
                                                                                                0x3ffbacbc SEM_BIN2
COUNTING         5        10
MUTEX            1        1                              0
RECURSIVE_MUTEX  0        1        0x3ffbb724 SEM_RECUR  1628326

Timers

(gdb) freertos timer 
TIMER_ID	 - An ID to identify the timer.
OVERFLOW	 - True if timer has been overflow
PERIOD_IN_TICKS	 - How quickly and often the timer expires.
STATUS	 - Holds bits to say if the timer was statically allocated or not, and if it is active or not.

TIMER_ID    NAME      OVERFLOW    PERIOD_IN_TICKS    STATUS  CALLBACK_FN
----------  ------  ----------  -----------------  --------  ---------------------------
0x2         TIMER3           0                400         5  0x400d490c <vTimerCallback>
0x3         TIMER2           0                300         5  0x400d490c <vTimerCallback>
0x5         TIMER1           0                200         5  0x400d490c <vTimerCallback>
0x2         TIMER4           0                500         5  0x400d490c <vTimerCallback>

Heap

(gdb) freertos heap 
{pxNextFreeBlock = 0x2013238, xBlockSize = 32}
{pxNextFreeBlock = 0x2013278, xBlockSize = 32}
{pxNextFreeBlock = 0x2013368, xBlockSize = 32}
{pxNextFreeBlock = 0x2013670, xBlockSize = 56}
{pxNextFreeBlock = 0x20136f8, xBlockSize = 16}
{pxNextFreeBlock = 0x2013820, xBlockSize = 264}
{pxNextFreeBlock = 0x2013df0, xBlockSize = 760}
{pxNextFreeBlock = 0x2028f98, xBlockSize = 1168}
{pxNextFreeBlock = 0x2029188, xBlockSize = 232}
{pxNextFreeBlock = 0x2034258, xBlockSize = 32}
{pxNextFreeBlock = 0x20342f0, xBlockSize = 32}
{pxNextFreeBlock = 0x2034338, xBlockSize = 24}
{pxNextFreeBlock = 0x20491f8, xBlockSize = 32}
{pxNextFreeBlock = 0x2049448, xBlockSize = 32}
{pxNextFreeBlock = 0x204a940, xBlockSize = 24}
{pxNextFreeBlock = 0x204aa38, xBlockSize = 24}

Metadata

Release files for wqtool-gdb 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for wqtool-gdb 1.0.0
File Size Uploaded Provenance Actions
wqtool_gdb-1.0.0.tar.gz 14.7 kB Without provenance Details for wqtool_gdb-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for wqtool-gdb 1.0.0
File Interpreter ABI Platform Actions
wqtool_gdb-1.0.0-py3-none-any.whl Python 3 none any Details for wqtool_gdb-1.0.0-py3-none-any.whl

Total release size: 30.0 kB

Release files / wqtool_gdb-1.0.0.tar.gz

Download URL wqtool_gdb-1.0.0.tar.gz
Size 14.7 kB
Tags Source
SHA-256 checksum
How to use checksums
3b9f6cfece4abff9e6dbc8615cc46aa7e09e454320d337521bc9d5419b872d5d
BLAKE2b-256 checksum
How to use checksums
023453c7aebdc18ef3653bc659462b6e0a5b7f1e0bc36d8a4e07e31f898092b5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.10.12

Release files / wqtool_gdb-1.0.0-py3-none-any.whl

Download URL wqtool_gdb-1.0.0-py3-none-any.whl
Size 15.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
910e97adeea7a0703c09631ae12ec59cfd9685028e52a68ee1afdfd1a91228b7
BLAKE2b-256 checksum
How to use checksums
c409fb9dc6829f39fd487efea2afd8189bd44fe1fdfeb5015d2d2db07e69e540
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.10.12

Security for wqtool-gdb 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page