Skip to content

Commit 30a20bf

Browse files
committed
Merge remote-tracking branch 'origin/upstreams/develop' into develop
2 parents 3bd539f + 93c5df3 commit 30a20bf

File tree

213 files changed

+28966
-5816
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

213 files changed

+28966
-5816
lines changed

.github/workflows/ci.yml

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,12 @@ concurrency:
3535

3636
jobs:
3737
test:
38-
# We're stuck on Ubuntu 20.04 as long as we want to keep testing on Python
39-
# 3.6 due to actions/setup-python#544.
40-
runs-on: ubuntu-20.04
38+
runs-on: ubuntu-22.04
4139
strategy:
4240
matrix:
4341
python-version: ${{ (github.event_name == 'push' || inputs.test_all_python_versions)
44-
&& fromJSON('["3.13", "3.12", "3.11", "3.10", "3.9", "3.8", "3.7", "3.6"]')
45-
|| fromJSON('["3.12", "3.6"]')}}
42+
&& fromJSON('["3.14", "3.13", "3.12", "3.11", "3.10", "3.9", "3.8"]')
43+
|| fromJSON('["3.13", "3.8"]')}}
4644
cc: [gcc, clang]
4745
fail-fast: false
4846
env:
@@ -55,21 +53,18 @@ jobs:
5553
with:
5654
python-version: ${{ matrix.python-version }}
5755
allow-prereleases: true
58-
- name: Check Python version for pre-commit
59-
# Only run pre-commit / mypy on upstream supported Python versions
60-
run: |
61-
if [[ "${{ matrix.python-version }}" =~ ^3\.([89]|[0-9][0-9])$ ]]; then
62-
echo USE_PRE_COMMIT=1 >> $GITHUB_ENV
63-
fi
6456
- name: Install dependencies
6557
run: |
6658
sudo apt-get update -y
6759
sudo apt-get install -y btrfs-progs check dwarves libelf-dev libdw-dev qemu-kvm zstd ${{ matrix.cc == 'clang' && 'libomp-$(clang --version | sed -rn "s/.*clang version ([0-9]+).*/\\1/p")-dev' || '' }}
68-
pip install pyroute2 setuptools ${USE_PRE_COMMIT/1/pre-commit}
60+
# pyroute2 0.9.1 dropped support for Python < 3.9.
61+
if [[ "${{ matrix.python-version }}" =~ ^3\.[678]$ ]]; then
62+
pyroute2_version="<0.9.1"
63+
fi
64+
pip install "pyroute2$pyroute2_version" setuptools pre-commit
6965
- name: Generate version.py
7066
run: python setup.py --version
7167
- name: Check with mypy
72-
if: ${{ env.USE_PRE_COMMIT == '1' }}
7368
run: pre-commit run --all-files mypy
7469
- name: Build and test with ${{ matrix.cc }}
7570
run: CONFIGURE_FLAGS="--enable-compiler-warnings=error" python setup.py test -K ${{ inputs.test_all_kernel_flavors && '-F' || '' }}

.github/workflows/dco-check.yml

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,22 @@ jobs:
1818
git init
1919
git fetch --filter=blob:none "$GITHUB_SERVER_URL/$GITHUB_REPOSITORY" "$GITHUB_BASE_REF" "$GITHUB_REF"
2020
- name: Check for DCO sign-offs
21+
shell: bash
2122
run: |
22-
no_sign_off="$(git log --no-merges --grep=Signed-off-by --invert-grep "FETCH_HEAD..$GITHUB_SHA")"
23-
if [ -z "$no_sign_off" ]; then
23+
status=0
24+
while read -r commit; do
25+
author="$(git show --no-patch --pretty='format:%an <%ae>' "$commit")"
26+
if ! git show --no-patch --pretty='format:%(trailers:key=Signed-off-by,valueonly)' "$commit" | grep -Fxq "$author"; then
27+
if [ $status -eq 0 ]; then
28+
echo "The following commits are missing a Developer Certificate of Origin sign-off;"
29+
echo "see https://github.com/osandov/drgn/blob/main/CONTRIBUTING.rst#signing-off"
30+
echo
31+
fi
32+
status=1
33+
git show --no-patch "$commit"
34+
fi
35+
done < <(git rev-list --no-merges "FETCH_HEAD..$GITHUB_SHA")
36+
if [ $status -eq 0 ]; then
2437
echo "All commits have a Developer Certificate of Origin sign-off"
25-
else
26-
echo "The following commits are missing a Developer Certificate of Origin sign-off;"
27-
echo "see https://github.com/osandov/drgn/blob/main/CONTRIBUTING.rst#signing-off"
28-
echo
29-
echo "$no_sign_off"
30-
exit 1
3138
fi
39+
exit $status

.github/workflows/vmtest-build.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@ jobs:
1313
arch: [x86_64, aarch64, ppc64, s390x, arm]
1414
fail-fast: false
1515
max-parallel: 5
16-
# Build on 20.04 so that we don't get host binaries (e.g., objtool) that
17-
# depend on libraries too new for other distros.
18-
runs-on: ubuntu-20.04
16+
runs-on: ubuntu-22.04
1917
permissions:
2018
contents: write
2119
env:

.pre-commit-config.yaml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
exclude: ^contrib/
2+
repos:
3+
- repo: https://github.com/pycqa/isort
4+
rev: 5.13.2
5+
hooks:
6+
- id: isort
7+
name: isort (python)
8+
- repo: https://github.com/psf/black
9+
rev: 24.8.0
10+
hooks:
11+
- id: black
12+
exclude: ^docs/exts/details\.py$
13+
- repo: https://github.com/pycqa/flake8
14+
rev: 7.1.2
15+
hooks:
16+
- id: flake8
17+
- repo: https://github.com/pre-commit/mirrors-mypy
18+
rev: v1.14.1
19+
hooks:
20+
- id: mypy
21+
args: [--show-error-codes, --strict, --no-warn-return-any]
22+
files: ^(drgn/.*\.py|_drgn.pyi|_drgn_util/.*\.py|tools/.*\.py)$
23+
- repo: https://github.com/pre-commit/pre-commit-hooks
24+
rev: v5.0.0
25+
hooks:
26+
- id: trailing-whitespace
27+
exclude_types: [diff]
28+
- id: end-of-file-fixer
29+
exclude_types: [diff]
30+
- id: check-yaml
31+
- id: check-added-large-files
32+
- id: debug-statements
33+
- id: check-merge-conflict
34+
- repo: https://github.com/netromdk/vermin
35+
rev: v1.6.0
36+
hooks:
37+
- id: vermin
38+
args: ['-t=3.8-', '--violations', '--eval-annotations']

.readthedocs.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ build:
33
os: ubuntu-22.04
44
tools:
55
python: "3"
6+
apt_packages:
7+
- graphviz
68
sphinx:
79
configuration: docs/conf.py
810
python:

CONTRIBUTING.rst

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,11 @@ instructions <README.rst#from-source>`_, then run:
1818
$ CONFIGURE_FLAGS="--enable-compiler-warnings=error" python3 setup.py build_ext -i
1919
$ python3 -m drgn --help
2020
21-
Drgn can build, run, and pass its test suite on Python 3.6 or later. However,
21+
Drgn can build, run, and pass its test suite on Python 3.8 or later. However,
2222
many of the tools used as part of the development workflow do not support Python
2323
versions once they have reached their end-of-life. Thus, your main drgn
2424
development environment should use a Python version which is actively supported
25-
upstream. In particular, the drgn development workflow no longer supported on
26-
Python 3.6.
25+
upstream.
2726

2827
Testing
2928
-------
@@ -74,9 +73,6 @@ Or you can run them manually:
7473
7574
$ pre-commit run --all-files
7675
77-
Please remember that these pre-commit hooks do not support Python 3.6; they
78-
require a Python major version which is actively supported upstream.
79-
8076
Coding Guidelines
8177
-----------------
8278

@@ -189,7 +185,7 @@ drgn assumes some `implementation-defined behavior
189185
Python
190186
^^^^^^
191187

192-
Python code in drgn should be compatible with Python 3.6 and newer.
188+
Python code in drgn should be compatible with Python 3.8 and newer.
193189

194190
Python code is formatted with `Black <https://github.com/psf/black>`_ and
195191
`isort <https://github.com/PyCQA/isort>`_.

README.rst

Lines changed: 37 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -66,17 +66,17 @@ Package Manager
6666

6767
drgn can be installed using the package manager on some Linux distributions.
6868

69-
.. image:: https://repology.org/badge/vertical-allrepos/drgn.svg
69+
.. image:: https://repology.org/badge/vertical-allrepos/drgn.svg?exclude_unsupported=1
7070
:target: https://repology.org/project/drgn/versions
7171
:alt: Packaging Status
7272

73-
* Fedora >= 32
73+
* Fedora, RHEL/CentOS Stream >= 9
7474

7575
.. code-block:: console
7676
7777
$ sudo dnf install drgn
7878
79-
* RHEL/CentOS >= 8
79+
* RHEL/CentOS < 9
8080

8181
`Enable EPEL <https://docs.fedoraproject.org/en-US/epel/#_quickstart>`_. Then:
8282

@@ -86,32 +86,35 @@ drgn can be installed using the package manager on some Linux distributions.
8686
8787
* Oracle Linux >= 8
8888

89-
Enable the ``ol8_addons`` or ``ol9_addons`` repository and install drgn:
89+
Enable the ``ol8_addons`` or ``ol9_addons`` repository. Then:
9090

9191
.. code-block:: console
9292
9393
$ sudo dnf config-manager --enable ol8_addons # OR: ol9_addons
9494
$ sudo dnf install drgn
9595
96-
Drgn is also available for Python versions in application streams. For
96+
drgn is also available for Python versions in application streams. For
9797
example, use ``dnf install python3.12-drgn`` to install drgn for Python 3.12.
9898
See the documentation for drgn in `Oracle Linux 9
9999
<https://docs.oracle.com/en/operating-systems/oracle-linux/9/drgn/how_to_install_drgn.html>`_
100100
and `Oracle Linux 8
101101
<https://docs.oracle.com/en/operating-systems/oracle-linux/8/drgn/how_to_install_drgn.html>`_
102102
for more information.
103103

104-
* Arch Linux
104+
* Debian >= 12 (Bookworm)/Ubuntu >= 24.04 (Noble Numbat)
105105

106106
.. code-block:: console
107107
108-
$ sudo pacman -S drgn
108+
$ sudo apt install python3-drgn
109109
110-
* Debian >= 12 (Bookworm)
110+
To get the latest version on Ubuntu, enable the `michel-slm/kernel-utils PPA
111+
<https://launchpad.net/~michel-slm/+archive/ubuntu/kernel-utils>`_ first.
112+
113+
* Arch Linux
111114

112115
.. code-block:: console
113116
114-
$ sudo apt install python3-drgn
117+
$ sudo pacman -S drgn
115118
116119
* Gentoo
117120

@@ -125,15 +128,6 @@ drgn can be installed using the package manager on some Linux distributions.
125128
126129
$ sudo zypper install python3-drgn
127130
128-
* Ubuntu
129-
130-
Enable the `michel-slm/kernel-utils PPA <https://launchpad.net/~michel-slm/+archive/ubuntu/kernel-utils>`_.
131-
Then:
132-
133-
.. code-block:: console
134-
135-
$ sudo apt install python3-drgn
136-
137131
pip
138132
^^^
139133

@@ -152,27 +146,29 @@ This will install a binary wheel by default. If you get a build error, then pip
152146
wasn't able to use the binary wheel. Install the dependencies listed `below
153147
<#from-source>`_ and try again.
154148

155-
Note that RHEL/CentOS 6, Debian Stretch, Ubuntu Trusty, and Ubuntu Xenial (and
156-
older) ship Python versions which are too old. Python 3.6 or newer must be
157-
installed.
149+
Note that RHEL/CentOS 7, Debian 10 ("buster"), and Ubuntu 18.04 ("Bionic
150+
Beaver") (and older) ship Python versions which are too old. Python 3.8 or
151+
newer must be installed.
152+
153+
.. _installation-from-source:
158154

159155
From Source
160156
^^^^^^^^^^^
161157

162158
To get the development version of drgn, you will need to build it from source.
163159
First, install dependencies:
164160

165-
* Fedora
161+
* Fedora, RHEL/CentOS Stream >= 9
166162

167163
.. code-block:: console
168164
169-
$ sudo dnf install autoconf automake check-devel elfutils-devel gcc git libkdumpfile-devel libtool make pkgconf python3 python3-devel python3-pip python3-setuptools
165+
$ sudo dnf install autoconf automake check-devel elfutils-debuginfod-client-devel elfutils-devel gcc git libkdumpfile-devel libtool make pkgconf python3 python3-devel python3-pip python3-setuptools xz-devel
170166
171-
* RHEL/CentOS/Oracle Linux
167+
* RHEL/CentOS < 9, Oracle Linux
172168

173169
.. code-block:: console
174170
175-
$ sudo dnf install autoconf automake check-devel elfutils-devel gcc git libtool make pkgconf python3 python3-devel python3-pip python3-setuptools
171+
$ sudo dnf install autoconf automake check-devel elfutils-devel gcc git libtool make pkgconf python3 python3-devel python3-pip python3-setuptools xz-devel
176172
177173
Optionally, install ``libkdumpfile-devel`` from EPEL on RHEL/CentOS >= 8 or
178174
install `libkdumpfile <https://github.com/ptesarik/libkdumpfile>`_ from
@@ -191,28 +187,29 @@ First, install dependencies:
191187

192188
.. code-block:: console
193189
194-
$ sudo apt install autoconf automake check gcc git liblzma-dev libelf-dev libdw-dev libtool make pkgconf python3 python3-dev python3-pip python3-setuptools zlib1g-dev
190+
$ sudo apt install autoconf automake check gcc git libdebuginfod-dev libkdumpfile-dev liblzma-dev libelf-dev libdw-dev libtool make pkgconf python3 python3-dev python3-pip python3-setuptools zlib1g-dev
195191
196-
Optionally, install libkdumpfile from source if you want support for the
197-
makedumpfile format.
192+
On Debian <= 11 (Bullseye) and Ubuntu <= 22.04 (Jammy Jellyfish),
193+
``libkdumpfile-dev`` is not available, so you must install libkdumpfile from
194+
source if you want support for the makedumpfile format.
198195

199196
* Arch Linux
200197

201198
.. code-block:: console
202199
203-
$ sudo pacman -S --needed autoconf automake check gcc git libelf libkdumpfile libtool make pkgconf python python-pip python-setuptools
200+
$ sudo pacman -S --needed autoconf automake check gcc git libelf libkdumpfile libtool make pkgconf python python-pip python-setuptools xz
204201
205202
* Gentoo
206203

207204
.. code-block:: console
208205
209-
$ sudo emerge --noreplace --oneshot dev-build/autoconf dev-build/automake dev-libs/check dev-libs/elfutils sys-devel/gcc dev-vcs/git dev-libs/libkdumpfile dev-build/libtool dev-build/make dev-python/pip virtual/pkgconfig dev-lang/python dev-python/setuptools
206+
$ sudo emerge --noreplace --oneshot dev-build/autoconf dev-build/automake dev-libs/check dev-libs/elfutils sys-devel/gcc dev-vcs/git dev-libs/libkdumpfile dev-build/libtool dev-build/make dev-python/pip virtual/pkgconfig dev-lang/python dev-python/setuptools app-arch/xz-utils
210207
211208
* openSUSE
212209

213210
.. code-block:: console
214211
215-
$ sudo zypper install autoconf automake check-devel gcc git libdw-devel libelf-devel libkdumpfile-devel libtool make pkgconf python3 python3-devel python3-pip python3-setuptools
212+
$ sudo zypper install autoconf automake check-devel gcc git libdebuginfod-devel libdw-devel libelf-devel libkdumpfile-devel libtool make pkgconf python3 python3-devel python3-pip python3-setuptools xz-devel
216213
217214
Then, run:
218215

@@ -233,20 +230,20 @@ Quick Start
233230

234231
.. start-quick-start
235232
236-
drgn debugs the running kernel by default; run ``sudo drgn``. To debug a
237-
running program, run ``sudo drgn -p $PID``. To debug a core dump (either a
238-
kernel vmcore or a userspace core dump), run ``drgn -c $PATH``. Make sure to
239-
`install debugging symbols
233+
drgn debugs the running kernel by default; simply run ``drgn``. To debug a
234+
running program, run ``drgn -p $PID``. To debug a core dump (either a kernel
235+
vmcore or a userspace core dump), run ``drgn -c $PATH``. Make sure to `install
236+
debugging symbols
240237
<https://drgn.readthedocs.io/en/latest/getting_debugging_symbols.html>`_ for
241238
whatever you are debugging.
242239

243-
Then, you can access variables in the program with ``prog['name']`` and access
240+
Then, you can access variables in the program with ``prog["name"]`` and access
244241
structure members with ``.``:
245242

246243
.. code-block:: pycon
247244
248-
$ sudo drgn
249-
>>> prog['init_task'].comm
245+
$ drgn
246+
>>> prog["init_task"].comm
250247
(char [16])"swapper/0"
251248
252249
You can use various predefined helpers:
@@ -260,14 +257,14 @@ You can use various predefined helpers:
260257
[b'findmnt', b'-p']
261258
262259
You can get stack traces with ``stack_trace()`` and access parameters or local
263-
variables with ``trace['name']``:
260+
variables with ``trace["name"]``:
264261

265262
.. code-block:: pycon
266263
267264
>>> trace = stack_trace(task)
268265
>>> trace[5]
269266
#5 at 0xffffffff8a5a32d0 (do_sys_poll+0x400/0x578) in do_poll at ./fs/select.c:961:8 (inlined)
270-
>>> poll_list = trace[5]['list']
267+
>>> poll_list = trace[5]["list"]
271268
>>> file = fget(task, poll_list.entries[0].fd)
272269
>>> d_path(file.f_path.address_of_())
273270
b'/proc/115/mountinfo'

0 commit comments

Comments
 (0)