Commit Graph

220 Commits

Author SHA1 Message Date
Omar Sandoval
422c39823f type: allow reading incomplete array types
Just return a zero-length array.
2018-04-06 00:27:17 -07:00
Omar Sandoval
2bd81fd5fc coredump: push ELF/DWARF-specific logic out of Coredump
Instead, take callbacks for looking up variables and reading memory.
While we're at it, get rid of TypeFactory and instead implement its
methods as functions taking a DwarfIndex.
2018-04-05 00:52:00 -07:00
Omar Sandoval
b45e930336 dwarf: rewrite drgn.dwarf in pure Python
Now that DwarfIndex is in C, the rest can be simpler Python rather than
Cython.
2018-03-26 01:51:20 -07:00
Omar Sandoval
acbf14d10c dwarf: rewrite DwarfIndex in pure C
Most of drgn.dwarf is not performance-sensitive, and the part that is
(DwarfIndex) can use some extra tuning which is easier to do in C rather
than Cython.
2018-03-25 02:10:15 -07:00
Omar Sandoval
7ebda948c6 dwarf: fix undefined signed integer overflow in LEB128
And add back the old lldwarf LEB128 tests.
2018-03-13 01:38:52 -07:00
Omar Sandoval
a7309d2a15 elf: support debug sections with relocations 2018-03-09 17:41:54 -08:00
Omar Sandoval
dac4f9156a elf: clean up ElfFile API
Use functions instead of properties to make it clear that they're not
free, and make it possible to construct a DwarfFile directly from an
ElfFile.
2018-03-08 23:31:02 -08:00
Omar Sandoval
aa4d5852b3 type: fix handling of arrays with zero-length elements
Encountered in s_writers_key in struct file_system_type.
2018-03-07 21:20:38 -08:00
Omar Sandoval
7d21255007 type: add format() to type classes
For formatting read values nicely in C syntax.
2018-03-07 02:04:09 -08:00
Omar Sandoval
adeeca927b type: add TypeFactory.from_type_name() 2018-03-07 00:31:00 -08:00
Omar Sandoval
f71d2a8fd9 type: add read() to type classes
For reading a value out of memory.
2018-03-06 01:22:14 -08:00
Omar Sandoval
84e0910342 type: remove all DWARF-specific code from type classes 2018-03-06 00:42:03 -08:00
Omar Sandoval
1717c060cd type: further improve type handling
Make specific type classes which are separate from the type name
classes.
2018-03-03 02:14:09 -08:00
Omar Sandoval
ec75400cc0 type: improve type handling
Add a parser for C type names and push the type logic out of the
CoredumpObject class.
2018-02-24 19:37:51 -08:00
Omar Sandoval
97e604c05c Rewrite in Cython
The lldwarf/drgn.dwarf split wasn't working out too well, and moving all
of drgn.dwarf into lldwarf (by rewriting it into C) would be way too
much work. Instead, use Cython, which results in a parser which is just
as fast but with much cleaner code overall. It also turns out lldwarf
wasn't doing GC right, so the switch also fixed that.
2017-08-28 21:16:43 -07:00
Omar Sandoval
682fd172a4 cli/probe: start implementing variable fetching
Resolving parameters, variables with function scope, and global
variables should work. This is just the variable resolution, no fetching
yet, but a bunch of refactors snuck in here so committing it all now.
2017-08-27 23:56:14 -07:00
Omar Sandoval
e6a58f533a Store CU and parent in DIE
Back-references from the DIE to the CU and the parent DIE will make it
much easier to implement several features.
2017-08-27 11:35:38 -07:00
Omar Sandoval
64f66f747f lldwarf: get rid of explicit offset members
The parsing library shouldn't really care about keeping track of these.
Instead, add __dict__ and getattr()/setattr() to all of the lldwarf
objects so higher layers can store the offset if they want.

DwarfDie is special in two ways:

1. We want to store an offset for the DIE so we know where to parse
   sibling and children entries.
2. For some attributes, we need to store an offset so we know where to
   find them later.

Both of these are changed to be relative to the CU rather than the
buffer.
2017-08-27 10:53:04 -07:00
Omar Sandoval
72b9af2b82 Add address range table parsing 2017-08-25 23:24:38 -07:00
Omar Sandoval
1fc2b6e89b Initial commit
I wrote all of this code a few months back and am just now getting
around to committing it. The low-level DWARF parsing library is pretty
solid, although it only implements a subset of DWARF so far. The CLI and
higher-level interface are experimental.
2017-08-24 22:46:16 -07:00