Skip to main content

Another GDB stub implemented in Python3

Setup

# Install and compile urjtag (for Microwatt)
apt install libusb-1.0-0-dev libftdi1-dev python3-dev
git clone -b ftdi-arty https://github.com/shingarov/urjtag.git
cd urjtag/urjtag
PYTHON=python3 ./configure --enable-python --without-ftd2xx
make -j$(nproc)
cd ../..

# Clone this repository
git clone https://github.com/janvrany/pygdbstub.git
cd pygdbstub

# Create virtual environment for pygdbstub
virtualenv --prompt "pygdbstub" .venv
echo "export LD_LIBRARY_PATH=$(realpath ../urjtag/urjtag/src/.libs)" >> .venv/bin/activate
source .venv/bin/activate

# Install dependencies
pip3 install -r requirements-dev.txt
pip3 install ../urjtag/urjtag/bindings/python

# Setup pre-commit and pre-push hooks (if you want)
pre-commit install -t pre-commit
pre-commit install -t pre-push

Usage examples

Using TCP port

.venv/bin/python -m pygdbstub -t microwatt -b Genesys2 -p 7000
  • run pygdbstub (-m pygdbstub)
  • connect to Microwatt on Digilent Genesys2 FPGA boatd (-t microwatt -b Genesys2)
  • listen on localhost, port 7000 (-p 7000)

Then in GDB, connect to stub like:

(gdb) set arch powerpc:common64
(gdb) target remote :7000

Starting pygdbstub directly from GDB

(gdb) set arch powerpc:common64
(gdb) target remote | .venv/bin/python -m pygdbstub -t microwatt
  • run pygdbstub (-m pygdbstub)
  • connect to Microwatt on Arty FPGA (-t microwatt, Arty is default board for Microwatt target)
  • use stdio to communicate with GDB (default)

For developers

Running tests

To run tests, just run:

pytest

Debugging communication

Some hints to help debugging communication between GDB and pygdbstub:

  • In GDB, turn on remote protocol debugging:

    set debug remote 1
    
  • If you really want to see the exact bytes going back and forth, run stub using socat:

    socat -v tcp4-listen:7007,reuseaddr,fork 'exec:python3 -m pygdbstub'
    

    and then in GDB, connect to port 7007:

    target remote :7007
    

Metadata

Release files for pygdbstub-neo 0.0.1.2

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

Source distribution (sdist)

Source distribution for pygdbstub-neo 0.0.1.2
File Size Uploaded
pygdbstub_neo-0.0.1.2.tar.gz 18.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pygdbstub-neo 0.0.1.2
File Interpreter ABI Platform
pygdbstub_neo-0.0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 37.4 kB

Release files / pygdbstub_neo-0.0.1.2.tar.gz

Download URL pygdbstub_neo-0.0.1.2.tar.gz
Size 18.8 kB
Tags Source
SHA-256 checksum
How to use checksums
75dd3a4a733d5d4ffd17475745cc438882fac29c256e79adc6742f66f5b9784e
BLAKE2b-256 checksum
How to use checksums
636d429859d27b9b3614cd891a22e5fb17976b6f11a203b9702a28bfbf11b214
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.0.1 CPython/3.12.8

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 30, 2024.

Transparency log

Release files / pygdbstub_neo-0.0.1.2-py3-none-any.whl

Download URL pygdbstub_neo-0.0.1.2-py3-none-any.whl
Size 18.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a813fde91ef476eef0c37ff259718c7af40c07b332086ad659d069fe2f8a8e36
BLAKE2b-256 checksum
How to use checksums
0465fd2a82d0851374a7a69a47346223cc70bcad4f5a76103ec4ee3583d437e4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.0.1 CPython/3.12.8

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 30, 2024.

Transparency log

Release history Release notifications | RSS feed

This release

0.0.1.2 This release

2 release files

0.0.1

2 release files

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