This release adds helpers all over the place, Linux 6.3 and 6.4 support, Python 3.12 support, full s390x support, bug fixes, and lots of new scripts in `contrib`.
New features:
- `follow_page()`, `follow_pfn()`, and `follow_phys()` helpers were added to `drgn.helpers.linux.mm`. These translate an arbitrary virtual address in an address space.
- `vmalloc_to_page()` and `vmalloc_to_pfn()` helpers were added to `drgn.helpers.linux.mm`. These translate a vmalloc/vmap address.
- The `drgn.helpers.linux.mm.totalram_pages()` helper was added. It returns the number of pages of RAM. Contributed by Martin Liška.
- The `drgn.helpers.linux.sched.loadavg()` helper was added. It returns the load average as a tuple. Contributed by Martin Liška.
- The `drgn.helpers.common.format.number_in_binary_units()` helper was added. It formats a number as a human-readable size (e.g., 2G, 1.5M).
- `drgn.cli.run_interactive()` was added. It can be used to embed drgn's interactive mode in other applications. Contributed by Stephen Brennan.
- The `jiffies` variable in the Linux kernel is now handled specially so that it can be accessed on all kernel versions and architectures.
- Virtual address translation was implemented for s390x. Contributed by Sven Schnelle.
- The `page_to_pfn()`, `page_to_phys()`, `pfn_to_page()`, and `phys_to_page()` helpers in `drgn.helpers.linux.mm` now work on architectures using `CONFIG_FLATMEM` (e.g., Arm and i386).
- Types can now be looked up in C++ namespaces. Contributed by Kevin Svetlitski.
- drgn will now use GNU-style compressed sections (`.zdebug_*`) when available.
Bug fixes:
- A crash when constructing objects on Python 3.12 was fixed. Contributed by Stephen Brennan.
- A bug that caused the ORC stack unwinder to stop prematurely or return the wrong result for IRQ stacks was fixed.
- `drgn.Program.crashed_thread()` was fixed for non-x86 architectures. Previously it always returned the thread on CPU 0.
- `drgn.helpers.linux.fs.for_each_file()` now handles tasks with `NULL` `files` (e.g., zombie tasks). Contributed by Stephen Brennan.
- The `drgn.helpers.linux.cgroup.sock_cgroup_ptr()` helper was fixed to work on Linux 5.15 and newer. Contributed by Martin Liška.
- The `drgn.helpers.linux.slab` helpers were fixed to handle older stable kernels without the patch "slub: improve bit diffusion for freelist ptr obfuscation". Contributed by Stephen Brennan.
- The `slab_object_info()` and `find_containing_slab_cache()` helpers in `drgn.helpers.linux.slab` were fixed to ignore high memory.
- A workaround for weird DWARF generated by GCC for zero-length arrays in C++ was added. Contributed by Jay Kamat.
- A memory leak in an error case when pretty-printing compound (structure/class/union) objects was fixed. Contributed by Kevin Svetlitski.
`contrib` directory:
- `contrib/btrfs_tree.py` and `contrib/btrfs_tree_mod_log.py` were added. They contain work-in-progress helpers for Btrfs data structures. Contributed by Boris Burkov.
- `contrib/dump_btrfs_bgs.py` was added. It prints information about block groups in a Btrfs filesystem. Contributed by Johannes Thumshirn.
- `contrib/kcore_list.py` was added. It prints the list of memory regions registered in `/proc/kcore`.
- `contrib/kernel_sys.py` was added. It prints system information similar to the crash `sys` command. Contributed by Martin Liška.
- `contrib/mount.py` was added. It prints a mount table similar to the crash `mount` command. Contributed by Martin Liška.
- `contrib/platform_drivers.py` was added. It prints all registered platform drivers.
- `contrib/vmmap.py` was added. It prints information about memory mappings in a process, similar to `/proc/$pid/maps`. Note that it only works up to Linux 6.0. Contributed by Martin Liška.
- `contrib/vmstat.py` was added. It prints information about kernel memory usage. Contributed by Martin Liška.
- `contrib/ps.py` was extended to print thread state, whether a thread is a kernel thread, and memory statistics. Contributed by Martin Liška.
- `contrib/fs_inodes.py` was fixed to to handle inodes without a path. Contributed by Martin Liška.
- `contrib/lsmod.py` was fixed to have identical output to `lsmod(8)`. Contributed by Martin Liška.
- `contrib/tcp_sock.py` was fixed to work on Linux 4.9 and newer. Contributed by Martin Liška.
Other improvements:
- Support for Linux 6.3 and 6.4 was added.
- The `compound_order()` and `compound_nr()` helpers in `drgn.helpers.linux.mm` were updated for Linux 6.3.
- ORC unwinder support was updated for Linux 6.3 and 6.4.
- Kernel module detection was updated for Linux 6.4. Contributed by Ido Schimmel.
- The `for_each_disk()` and `for_each_partition()` helpers in `drgn.helpers.linux.block` were updated for Linux 6.4.
- The `drgn.helpers.linux.idr` helpers were extended to work with kernels older than 4.11. Contributed by Imran Khan.
- Documentation was added for special objects that drgn exposes for the Linux kernel. Contributed by Stephen Brennan.
- The example in the documentation for `add_memory_segment()` was fixed. Contributed by Timothée Cocault.
- Immutable attributes were marked with `Final` in type stubs. Contributed by Kevin Svetlitski.
Internals:
- `setup.py` no longer uses distutils (as long as setuptools is new enough).
- Documentation was added for drgn's internal page table iterator interface.
- The virtual machine testing framework now supports AArch64, ppc64, s390x, and Arm. These are not tested automatically yet.
- The virtual machine testing framework now uses compilers from <https://mirrors.kernel.org/pub/tools/crosstool/>.
- The virtual machine testing framework now limits the number of CPUs to 8 to avoid OOMs. Contributed by Martin Liška.
- The pull request CI now only tests the oldest and latest stable Python versions, with the ability to opt into testing all supported versions. Contributed by Stephen Brennan.