Skip to content
drgn 0.0.9

This release adds a few methods to make working with type members
easier, support for C++ templates, and fixes for Linux kernel per-CPU
variables, among many other improvements.

New features:

* The Type.member() method was added for looking up a member in a type
  by name.
* The Type.has_member() method was added for checking whether a type has
  a member with a given name.
* The offsetof() function was added for getting the offset of a member
  designator in a type (like the offsetof() macro in C).
* The concept of "absent" objects was added. These are objects whose
  value/address are unknown.
* Variables whose value/address are not found in debugging information
  are now returned as absent objects instead of raising a LookupError.
* Support for C++ template parameters was added. Template parameters of
  a type can be accessed via the new Type.template_parameters attribute,
  which is a sequence of TypeTemplateParameter objects (from Jay Kamat).
* The per_cpu() helper (in drgn.helpers.linux.percpu) was added as a
  shortcut for accessing per-CPU variables (rather than per-CPU
  pointers).
* Support for unwinding stack traces on PowerPC was added (from Kamalesh
  Babulal).

API changes:

* The Type == operator was removed. It was always intended for testing
  and has been replaced by internal functions in the testing code.
* TypeMember.bit_field_size is now None instead of 0 if the member is
  not a bit field.
* The bit_offset parameter to the Object() constructor is now only
  allowed when creating a reference object.
* Object.bit_offset is now always None for value objects.
* cast() now only allows casting to/from scalar types.
* TypeMember.object was added to represent a member's default
  initializer. It can also be passed to the TypeMember() constructor.
* TypeParameter.default_argument was added to represent a parameter's
  default argument (although we don't yet support the DWARF debugging
  information for it because neither GCC nor Clang emits it). It can also
  be passed to the TypeParameter() constructor.
* Register.name was replaced by Register.names.
* Register numbers were removed from the API. (There may be more changes
  in the register API in the next release.)
* prog["THREAD_SIZE"] is no longer available for the Linux kernel.

Fixes:

* Global per-CPU variables in the Linux kernel are now handled correctly
  when KASLR is enabled.
* The top stack frame of x86-64 Linux kernel stack traces is now more
  reliable (previously, it could have invalid values for rip and/or
  rsp).
* for_each_online_cpu(), for_each_possible_cpu(), and
  for_each_present_cpu() were fixed when debugging Linux 4.4 or older.
* for_each_disk(), for_each_partition(), part_devt(), and part_name()
  were updated for Linux 5.11.
* Reading from an unmapped address when debugging the Linux kernel on an
  architecture other than x86-64 now correctly raises a FaultError
  instead of a ValueError.
* Zero-length array types are now distinguished from incomplete array
  types in debugging information generated by GCC < 9.0 even if the type
  is qualified.
* The language of a type is now set to the global default (C) if it
  cannot be determined from the debugging information rather than the
  program default.
* A reference leak when the same object is passed multiple times to a
  type constructor, Program.add_memory_segment(),
  Program.add_type_finder(), or Program.add_object_finder() was fixed.
* A use-after-free when Type.members and Type.parameters are accessed
  after the Type they came from has been garbage collected was fixed.
* A possible use-after-free after shrinking internal vectors was fixed.
* Errors while setting up the Python bindings are now checked and
  handled.

Miscellaneous improvements:

* Errors while parsing DWARF debugging information while loading symbols
  now include details of where the error happened.
* Object instances were made more space-efficient.
* More types are now deduplicated internally when possible.
* Type annotations for the Object() constructor were refined.

Project:

* Python 3.9 was added to the test matrix.
* Linux kernel 5.11 was added to the test matrix.
* Guidelines for writing commit messages and separating commits was
  added to CONTRIBUTING.rst.
* Migrated to GitHub Actions from Travis CI.