The Slick/Simple Debugger
Project description
Installation
From PyPI
pip install sdb-debugger
From Source
Ensure you have the following dependencies:
- Python 3.10 or newer
- libkdumpfile (optional - needed for kdump-compressed crash dumps)
- drgn
Note that in order for drgn to support kdump files it needs to be compiled with libkdumpfile. Unfortunately that means that users should always install libkdumpfile first before installing drgn.
Then install sdb:
git clone https://github.com/sdimitro/sdb.git
cd sdb
pip install .
For development installation (editable mode with dev dependencies):
pip install -e ".[dev]"
Quickstart
Running sudo sdb attaches sdb to the running kernel by default.
To debug a running program, run sudo sdb -p <PID>.
For post-mortem debugging (either a kernel crash dump or a userland core dump), use sudo sdb <vmlinux path|userland binary path> <dump>.
$ sudo sdb
sdb> find_task 1 | member comm
(char [16])"systemd"
sdb> find_task 1 | stack
TASK_STRUCT STATE COUNT
==========================================
0xffff89cea441dd00 INTERRUPTIBLE 1
__schedule+0x2e5
schedule+0x33
schedule_hrtimeout_range_clock+0xfd
schedule_hrtimeout_range+0x13
ep_poll+0x40a
do_epoll_wait+0xb7
__x64_sys_epoll_wait+0x1e
do_syscall_64+0x57
entry_SYSCALL_64+0x7c
sdb> addr modules | lxlist "struct module" list | member name ! sort | head -n 3
(char [56])"aesni_intel"
(char [56])"async_memcpy"
(char [56])"async_pq"
Developer Testing
First, install the development dependencies:
pip install -e ".[dev]"
# Or using requirements file:
pip install -r requirements-dev.txt
Linting
pylint -d duplicate-code -d invalid-name sdb
pylint -d duplicate-code -d invalid-name tests
Ruff (Fast Linting and Formatting)
Ruff is a fast Python linter and formatter that combines multiple tools:
ruff check sdb tests
Type Checking
mypy --strict --show-error-codes -p sdb
mypy --strict --ignore-missing-imports --show-error-codes -p tests
Note: pytest is required for mypy to properly type-check test decorators.
Style Checks
yapf --diff --style google --recursive sdb
yapf --diff --style google --recursive tests
If yapf has suggestions you can apply them automatically by substituting
--diff with -i like this:
yapf -i --style google --recursive sdb
yapf -i --style google --recursive tests
Unit Testing
Unit tests don't require crash dumps and can be run quickly:
pytest -v --cov sdb --cov-report xml tests/unit
Integration Testing
Integration tests require crash/core dumps to test against live debugging scenarios:
.github/scripts/download-dumps-from-gdrive.sh
.github/scripts/extract-dump.sh dump.201912060006.tar.lzma
.github/scripts/extract-dump.sh dump.202303131823.tar.gz
pytest -v --cov sdb --cov-report xml tests/integration
To run all tests (unit + integration):
pytest -v --cov sdb --cov-report xml tests
If you want pytest to stop on the first failure it encounters add
-x/--exitfirst to the command.
If you've added new test commands or found mistakes in the current reference output and you want to (re)generate reference output, download all crash/core dumps (or the specific one you want to correct) and run the following:
PYTHONPATH=$(pwd) python3 tests/integration/gen_regression_output.py
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sdb_debugger-0.6.0.tar.gz.
File metadata
- Download URL: sdb_debugger-0.6.0.tar.gz
- Upload date:
- Size: 790.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f56604971b7453b4c3c88ea22271c127e30d8261cfda50aab4691903d228e896
|
|
| MD5 |
b4a72364e668627d26662dd752a8b596
|
|
| BLAKE2b-256 |
3f931e1d02b833102bd2615939e6acc3a5d9ff2c10886cd21d66fab65a41c5f4
|
Provenance
The following attestation bundles were made for sdb_debugger-0.6.0.tar.gz:
Publisher:
release.yml on sdimitro/sdb
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sdb_debugger-0.6.0.tar.gz -
Subject digest:
f56604971b7453b4c3c88ea22271c127e30d8261cfda50aab4691903d228e896 - Sigstore transparency entry: 1066686361
- Sigstore integration time:
-
Permalink:
sdimitro/sdb@348f7d6e2989e6585fb621588f78c30e940cf013 -
Branch / Tag:
refs/heads/develop - Owner: https://github.com/sdimitro
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@348f7d6e2989e6585fb621588f78c30e940cf013 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file sdb_debugger-0.6.0-py3-none-any.whl.
File metadata
- Download URL: sdb_debugger-0.6.0-py3-none-any.whl
- Upload date:
- Size: 152.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fdb00ccf42cceef17d81e096ee5e9293dfef83695ba2cb1a6002f46ef8864b06
|
|
| MD5 |
7ce7e75dc78c481b08336e486647323d
|
|
| BLAKE2b-256 |
9b2e4a065861d8e25e591ecef9382c2872aa6424289e6595c29f869794bca2d6
|
Provenance
The following attestation bundles were made for sdb_debugger-0.6.0-py3-none-any.whl:
Publisher:
release.yml on sdimitro/sdb
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sdb_debugger-0.6.0-py3-none-any.whl -
Subject digest:
fdb00ccf42cceef17d81e096ee5e9293dfef83695ba2cb1a6002f46ef8864b06 - Sigstore transparency entry: 1066686364
- Sigstore integration time:
-
Permalink:
sdimitro/sdb@348f7d6e2989e6585fb621588f78c30e940cf013 -
Branch / Tag:
refs/heads/develop - Owner: https://github.com/sdimitro
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@348f7d6e2989e6585fb621588f78c30e940cf013 -
Trigger Event:
workflow_dispatch
-
Statement type: