Commit Graph

7 Commits

Author SHA1 Message Date
Omar Sandoval
75c3679147 Rewrite drgn core in C
The current mixed Python/C implementation works well, but it has a
couple of important limitations:

- It's too slow for some common use cases, like iterating over large
  data structures.
- It can't be reused in utilities written in other languages.

This replaces the internals with a new library written in C, libdrgn. It
includes Python bindings with mostly the same public interface as
before, with some important improvements:

- Types are now represented by a single Type class rather than the messy
  polymorphism in the Python implementation.
- Qualifiers are a bitmask instead of a set of strings.
- Bit fields are not considered a separate type.
- The lvalue/rvalue terminology is replaced with reference/value.
- Structure, union, and array values are better supported.
- Function objects are supported.
- Program distinguishes between lookups of variables, constants, and
  functions.

The C rewrite is about 6x as fast as the original Python when using the
Python bindings, and about 8x when using the C API directly.

Currently, the exposed API in C is fairly conservative. In the future,
the memory reader, type index, and object index APIs will probably be
exposed for more flexibility.
2019-04-02 14:12:07 -07:00
Omar Sandoval
c2d51fe295 Support userspace program core dumps
We only need to add a little bit of infrastructure to map variable
addresses for ASLR/shared libraries, which we find using the NT_FILE
note.
2018-07-09 22:34:03 -07:00
Omar Sandoval
800ee3ec36 corereader: take fd and list of segments instead of path
Now, we can get rid of the ELF parsing implementation in CoreReader.
Instead, we parse in ElfFile and pass the parsed information to
CoreReader.
2018-07-09 19:12:33 -07:00
Omar Sandoval
3ff1cc185a variableindex: distinguish vmlinux vs modules with ELF e_type
For /boot/vmlinux-$(uname -r) or if passed a vmlinux image with -e, the
basename of vmlinux is not always exactly "vmlinux". Don't rely on the
filename.
2018-07-03 00:27:56 -07:00
Omar Sandoval
263f8c2c4d dwarf: update DWARF constants
Update generate_dwarf_constants.py to parse dwarf.h, and update it with
the dwarf.h on my system.
2018-06-27 22:31:01 -07:00
Omar Sandoval
0adac0747c Bring back ElfFile
Instead of constructing DwarfFile with a dict of sections, pass in an
ElfFile.
2018-06-25 23:43:14 -07:00
Omar Sandoval
76cba644a8 Reorganize packaging 2018-04-07 10:42:48 -07:00