Commit Graph

917 Commits

Author SHA1 Message Date
Omar Sandoval
3c7c5f0035 dwarf: add optimized index by name 2018-02-20 21:55:59 -08:00
Omar Sandoval
c1671d6ae7 dwarf: merge dwarfdefs into drgn.dwarf 2018-02-20 20:28:38 -08:00
Omar Sandoval
c19f5d90cc dwarf: use flat array for abbreviation codes 2018-02-19 20:25:14 -08:00
Omar Sandoval
16c5cff47c Prototype of "crash" utility 2018-02-19 00:46:39 -08:00
Omar Sandoval
a04e7c7bbe cli/probe: implement struct member fetching
The parser is minimal and kinda jank, but it works. With a real parser
this could be extended to do pointer dereferencing, array subscripting,
and casting.
2017-09-05 00:27:14 -07:00
Omar Sandoval
89c2861e2b cli/probe: for filename:lineno, probe all matching addresses
Instead of just the first one. Also omit variables that cannot be
fetched instead of erroring out.
2017-09-04 23:15:17 -07:00
Omar Sandoval
0013015f2c cli/probe: better error messages 2017-09-04 22:35:59 -07:00
Omar Sandoval
c677749bcb cli/probe: implement variable fetching by name
This supports fetching both at a function and at an arbitrary
filename:lineno. It still needs better error messages and some other
extras.
2017-09-04 22:17:23 -07:00
Omar Sandoval
ccc9cbc862 dwarfdefs: add DW_ATE_* and move *_name() functions 2017-09-03 19:57:09 -07:00
Omar Sandoval
5f84ccfa1c drgn.dwarf: allow some DWARF sections to be missing
Not all files will have every DWARF section.
2017-09-03 09:23:27 -07: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
bb5881243f Get rid of spurious commas in DW_* enums 2017-08-25 22:39:15 -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