Skip to main content

Another GDB stub implemented in Python3

Project description

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
    

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pygdbstub_neo-0.0.1.2.tar.gz (18.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pygdbstub_neo-0.0.1.2-py3-none-any.whl (18.7 kB view details)

Uploaded Python 3

File details

Details for the file pygdbstub_neo-0.0.1.2.tar.gz.

File metadata

  • Download URL: pygdbstub_neo-0.0.1.2.tar.gz
  • Upload date:
  • Size: 18.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for pygdbstub_neo-0.0.1.2.tar.gz
Algorithm Hash digest
SHA256 75dd3a4a733d5d4ffd17475745cc438882fac29c256e79adc6742f66f5b9784e
MD5 33d06141acaeebbb5833b7d39e16b721
BLAKE2b-256 636d429859d27b9b3614cd891a22e5fb17976b6f11a203b9702a28bfbf11b214

See more details on using hashes here.

Provenance

The following attestation bundles were made for pygdbstub_neo-0.0.1.2.tar.gz:

Publisher: publish.yml on XuNeo/pygdbstub

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pygdbstub_neo-0.0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for pygdbstub_neo-0.0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a813fde91ef476eef0c37ff259718c7af40c07b332086ad659d069fe2f8a8e36
MD5 6f20392da0935ddc550a5522b6bff0fe
BLAKE2b-256 0465fd2a82d0851374a7a69a47346223cc70bcad4f5a76103ec4ee3583d437e4

See more details on using hashes here.

Provenance

The following attestation bundles were made for pygdbstub_neo-0.0.1.2-py3-none-any.whl:

Publisher: publish.yml on XuNeo/pygdbstub

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page