drgn 0.0.24
This release adds a few helpers, performance improvements, more C++ lookup support, split DWARF object file support, bug fixes, and more.
New features:
- The
drgn.helpers.linux.sched.cpu_curr()
helper was added. It returns the task running on a CPU. - The
drgn.helpers.linux.list.list_count_nodes()
helper was added. It returns the length of a list. - The
drgn.helpers.linux.net.netdev_priv()
helper was added. It returns the private data of a network device. - The
drgn.helpers.linux.net.skb_shinfo()
helper was added. It returns the shared info for a socket buffer. - The Linux kernel's
VMCOREINFO
can now be accessed withprog["VMCOREINFO"]
. Contributed by Stephen Brennan. - The
class
/struct
/union
/enum
keyword is no longer required for C++ type lookups. E.g.,prog.type("Foo")
will findclass Foo
orstruct Foo
, etc. - Nested classes/structures/unions in C++ can now be looked up with
drgn.Program.type()
(e.g.,prog.type("Foo::Bar")
). - C++ methods can now be looked up with
drgn.Program.function()
ordrgn.Program[]
(e.g.,prog.function("Foo::method")
orprog["Foo::method"]
). - Split DWARF object (.dwo) files are now supported when built with elfutils >= 0.171. (Split DWARF package files (.dwp) are not yet supported.)
Bug fixes:
- An ".orc_unwind_ip is not sufficiently aligned" error when getting a stack trace was fixed. This only happens on x86-64 when the stack contains a function written in assembly from a kernel module. This was a regression in drgn 0.0.23.
- Storing and printing integers larger than 64 bits was implemented. Most notably, this fixes printing
struct task_struct
on ARM64. - Local variable lookups that used to fail with "unknown DWARF expression opcode 0xf3" or "unknown DWARF expression opcode 0xa3" are now returned as absent instead. It may be possible to recover a value for some of these in the future.
drgn.Program.crashed_thread()
was fixed for s390x. Previously it would return the wrong thread.- A segfault if the definition of
main()
couldn't be found in a userspace program was fixed. - When an incomplete type is found (e.g., pointed to by a structure member), resolving it to the complete type no longer checks whether the name may be ambiguous based on the paths of the files that defined it. This sometimes caused such lookups to spuriously fail in the presence of out of tree Linux kernel modules and other similar situations that caused the same file to have multiple paths. Unfortunately, this means that if there really are multiple types with the same name, the wrong one may be used, but it can be manually casted.
- Looking up the definition of a nested incomplete type in C++ was fixed.
drgn.Object.to_bytes_()
of a bit field was fixed to not return stray bits.- Creating a structure value with a 32-bit float member (e.g.,
Object(prog, "struct foo", value={"f": 1.0})
) on a big-endian host was fixed. - The
drgn.helpers.linux.printk
helpers were fixed to work reliably on kernels between v3.18 and v4.15 with BPF enabled (due to a global variable name conflict). - Error messages about debugging information now have a path instead of
(null)
.
Other improvements:
- Support for Linux 6.5 was tested; no changes were required.
- Stack tracing was made almost twice as fast thanks to an internal optimization in function lookups. Contributed by Thierry Treyer.
- Indexing debugging information when it is loaded (either at startup or manually) was reimplemented.
- It now uses less memory (~30% less) and starts up much faster (~3x as fast) for large C++ applications.
- It no longer uses hyperthreads by default, which uses fewer system resources and results in up to 2x faster startup for the Linux kernel.
- It may use slightly (~10%) more memory for the Linux kernel.
- The Python GIL is now released while loading debugging information.
NULL
function pointer calls can now be unwound in stack traces on x86-64. Contributed by JP Kobryn.- The
drgn.helpers.linux.printk
helpers now work on RHEL 7 (Linux kernel 3.10). Contributed by Oleksandr Natalenko. - Vmcores in the makedumpfile flattened format are now detected and diagnosed with instructions for how to convert to a format supported by drgn. Contributed by Stephen Brennan.
- drgn now logs using the standard Python
logging
module to a logger named"drgn"
.
contrib
directory:
contrib/ps.py
was extended with many more options. Contributed by Jay Patel, Sourabh Jain, Aditya Gupta, and Piyush Sachdeva.contrib/ptdrgn.py
was added. It runs drgn in ptpython. Contributed by Stephen Brennan.
Documentation:
- Supported architectures and kernel versions are now documented.
- Thread-safety requirements are now documented.
- Guidelines for contributing Linux kernel helpers were added.
Internals:
- drgn now uses the
__attribute__((__cleanup__))
extension in GCC/Clang for resource cleanup. - The internal generic vector implementation was reworked.
- drgn now uses the system's
elf.h
header instead of its own copy. - Experimental scripts for building root filesystems and testing different architectures were added to
vmtest
. - More checks were added to
pre-commit
.