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.1.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.1-py3-none-any.whl (18.7 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for pygdbstub_neo-0.0.1.1.tar.gz
Algorithm Hash digest
SHA256 e200e504ea26d8451317435426b68177e52625e52032cbf94b9d367011037543
MD5 de62ad48cfc9ad88b7ca53167431d7b5
BLAKE2b-256 e523b111dfd8d1ddba7a239f40eb1768eb2c3803d8ed2fa20eca16056cc984cd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pygdbstub_neo-0.0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 640be576d59ac30bf07f60c25b00799c9b3aea184aa6733e9a9b103c1f9b3231
MD5 cbee627a513572d5887c025048365bbf
BLAKE2b-256 45517e5179d73c4f123217da48ef79d186e690b5b922032523a23686c12a64bf

See more details on using hashes here.

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