drgn/libdrgn/python
Omar Sandoval a97f6c4fa2 Associate types with program
I originally envisioned types as dumb descriptors. This mostly works for
C because in C, types are fairly simple. However, even then the
drgn_program_member_info() API is awkward. You should be able to look up
a member directly from a type, but we need the program for caching
purposes. This has also held me back from adding offsetof() or
has_member() APIs.

Things get even messier with C++. C++ template parameters can be objects
(e.g., template <int N>). Such parameters would best be represented by a
drgn object, which we need a drgn program for. Static members are a
similar case.

So, let's reimagine types as being owned by a program. This has a few
parts:

1. In libdrgn, simple types are now created by factory functions,
   drgn_foo_type_create().
2. To handle their variable length fields, compound types, enum types,
   and function types are constructed with a "builder" API.
3. Simple types are deduplicated.
4. The Python type factory functions are replaced by methods of the
   Program class.
5. While we're changing the API, the parameters to pointer_type() and
   array_type() are reordered to be more logical (and to allow
   pointer_type() to take a default size of None for the program's
   default pointer size).
6. Likewise, the type factory methods take qualifiers as a keyword
   argument only.

A big part of this change is updating the tests and splitting up large
test cases into smaller ones in a few places.

Signed-off-by: Omar Sandoval <osandov@osandov.com>
2020-08-26 17:41:09 -07:00
..
drgnpy.h Associate types with program 2020-08-26 17:41:09 -07:00
error.c Update copyright headers to Facebook and add missing headers 2020-05-15 15:13:02 -07:00
helpers.c Add type annotations to helpers 2020-08-20 16:28:02 -07:00
language.c Update copyright headers to Facebook and add missing headers 2020-05-15 15:13:02 -07:00
module.c Associate types with program 2020-08-26 17:41:09 -07:00
object.c Associate types with program 2020-08-26 17:41:09 -07:00
platform.c Update copyright headers to Facebook and add missing headers 2020-05-15 15:13:02 -07:00
program.c Associate types with program 2020-08-26 17:41:09 -07:00
stack_trace.c Update copyright headers to Facebook and add missing headers 2020-05-15 15:13:02 -07:00
symbol.c Update copyright headers to Facebook and add missing headers 2020-05-15 15:13:02 -07:00
test.c Update copyright headers to Facebook and add missing headers 2020-05-15 15:13:02 -07:00
type.c Associate types with program 2020-08-26 17:41:09 -07:00
util.c Update copyright headers to Facebook and add missing headers 2020-05-15 15:13:02 -07:00