2021-11-21 23:59:44 +00:00
|
|
|
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
2022-11-02 00:05:16 +00:00
|
|
|
// SPDX-License-Identifier: LGPL-2.1-or-later
|
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-03-22 23:27:46 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @file
|
|
|
|
*
|
|
|
|
* Language support.
|
|
|
|
*
|
|
|
|
* See @ref Languages.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef DRGN_LANGUAGE_H
|
|
|
|
#define DRGN_LANGUAGE_H
|
|
|
|
|
2020-04-23 00:23:26 +01:00
|
|
|
#include "drgn.h"
|
|
|
|
|
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-03-22 23:27:46 +00:00
|
|
|
/**
|
|
|
|
* @ingroup Internals
|
|
|
|
*
|
2022-02-16 20:43:36 +00:00
|
|
|
* @defgroup LanguageInternals Languages
|
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-03-22 23:27:46 +00:00
|
|
|
*
|
|
|
|
* Language support.
|
|
|
|
*
|
|
|
|
* This defines the interface which support for a language must implement,
|
|
|
|
* including operators and parsing.
|
|
|
|
*
|
2022-02-16 20:43:36 +00:00
|
|
|
* To add a new language:
|
|
|
|
* - Add a @ref drgn_language_number for it.
|
|
|
|
* - Define a @ref drgn_language for it, and set @ref drgn_language::number to
|
|
|
|
* the corresponding @ref drgn_language_number.
|
2022-02-16 21:05:28 +00:00
|
|
|
* - Add it to drgn.h.
|
2022-02-16 20:43:36 +00:00
|
|
|
* - Add it to @ref drgn_languages.
|
|
|
|
* - Add it to add_languages() in the Python bindings.
|
|
|
|
* - Add it to _drgn.pyi.
|
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-03-22 23:27:46 +00:00
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
2022-02-16 20:43:36 +00:00
|
|
|
/**
|
|
|
|
* Language numbers.
|
|
|
|
*
|
|
|
|
* These can be used as indices for storing language-specific data in an array.
|
|
|
|
*/
|
|
|
|
enum drgn_language_number {
|
|
|
|
DRGN_LANGUAGE_C,
|
|
|
|
DRGN_LANGUAGE_CPP,
|
|
|
|
DRGN_NUM_LANGUAGES,
|
|
|
|
};
|
|
|
|
|
2020-02-21 22:55:52 +00:00
|
|
|
typedef struct drgn_error *drgn_format_type_fn(struct drgn_qualified_type,
|
|
|
|
char **);
|
|
|
|
typedef struct drgn_error *drgn_format_object_fn(const struct drgn_object *,
|
|
|
|
size_t,
|
|
|
|
enum drgn_format_object_flags,
|
|
|
|
char **);
|
2022-02-18 06:18:53 +00:00
|
|
|
typedef struct drgn_error *drgn_find_type_fn(const struct drgn_language *lang,
|
|
|
|
struct drgn_program *prog,
|
2020-02-21 22:55:52 +00:00
|
|
|
const char *name,
|
|
|
|
const char *filename,
|
|
|
|
struct drgn_qualified_type *ret);
|
|
|
|
typedef struct drgn_error *drgn_bit_offset_fn(struct drgn_program *prog,
|
|
|
|
struct drgn_type *type,
|
|
|
|
const char *member_designator,
|
|
|
|
uint64_t *ret);
|
|
|
|
typedef struct drgn_error *drgn_integer_literal_fn(struct drgn_object *res,
|
|
|
|
uint64_t uvalue);
|
|
|
|
typedef struct drgn_error *drgn_bool_literal_fn(struct drgn_object *res,
|
|
|
|
bool bvalue);
|
|
|
|
typedef struct drgn_error *drgn_float_literal_fn(struct drgn_object *res,
|
|
|
|
double fvalue);
|
|
|
|
typedef struct drgn_error *
|
|
|
|
drgn_cast_op(struct drgn_object *res, struct drgn_qualified_type qualified_type,
|
|
|
|
const struct drgn_object *obj);
|
|
|
|
typedef struct drgn_error *drgn_bool_op(const struct drgn_object *obj, bool *ret);
|
|
|
|
typedef struct drgn_error *drgn_cmp_op(const struct drgn_object *lhs,
|
|
|
|
const struct drgn_object *rhs, int *ret);
|
|
|
|
|
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-03-22 23:27:46 +00:00
|
|
|
/**
|
|
|
|
* Language implementation.
|
|
|
|
*
|
|
|
|
* This mainly provides callbacks used to implement the higher-level libdrgn
|
|
|
|
* helpers. These callbacks handle the language-specific parts of the helpers.
|
|
|
|
*
|
|
|
|
* In particular, the operator callbacks should do appropriate type checking for
|
|
|
|
* the language and call the implementation in @ref ObjectInternals.
|
|
|
|
*/
|
|
|
|
struct drgn_language {
|
|
|
|
/** Name of this programming language. */
|
|
|
|
const char *name;
|
2022-02-16 20:43:36 +00:00
|
|
|
/** Number of this programming language. */
|
|
|
|
enum drgn_language_number number;
|
2020-12-16 00:38:21 +00:00
|
|
|
/** Whether this language has namespaces. */
|
|
|
|
bool has_namespaces;
|
2019-11-28 03:27:14 +00:00
|
|
|
/** Implement @ref drgn_format_type_name(). */
|
2020-02-21 22:55:52 +00:00
|
|
|
drgn_format_type_fn *format_type_name;
|
2019-11-28 03:27:14 +00:00
|
|
|
/** Implement @ref drgn_format_type(). */
|
2020-02-21 22:55:52 +00:00
|
|
|
drgn_format_type_fn *format_type;
|
2019-11-28 03:27:14 +00:00
|
|
|
/** Implement @ref drgn_format_object(). */
|
2020-02-21 22:55:52 +00:00
|
|
|
drgn_format_object_fn *format_object;
|
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-03-22 23:27:46 +00:00
|
|
|
/**
|
2020-04-23 00:23:26 +01:00
|
|
|
* Implement @ref drgn_program_find_type().
|
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-03-22 23:27:46 +00:00
|
|
|
*
|
|
|
|
* This should parse @p name and call @ref
|
2020-04-23 00:23:26 +01:00
|
|
|
* drgn_program_find_type_impl().
|
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-03-22 23:27:46 +00:00
|
|
|
*/
|
2020-02-21 22:55:52 +00:00
|
|
|
drgn_find_type_fn *find_type;
|
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-03-22 23:27:46 +00:00
|
|
|
/**
|
|
|
|
* Get the offset of a member in a type.
|
|
|
|
*
|
|
|
|
* This should parse @p member_designator (which may include one or more
|
|
|
|
* member references and zero or more array subscripts) and calculate
|
|
|
|
* the offset, in bits, of that member from the beginning of @p type.
|
|
|
|
*/
|
2020-02-21 22:55:52 +00:00
|
|
|
drgn_bit_offset_fn *bit_offset;
|
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-03-22 23:27:46 +00:00
|
|
|
/**
|
|
|
|
* Set an object to an integer literal.
|
|
|
|
*
|
|
|
|
* This should set @p res to the given value and appropriate type for an
|
|
|
|
* integer literal in the language.
|
|
|
|
*/
|
2020-02-21 22:55:52 +00:00
|
|
|
drgn_integer_literal_fn *integer_literal;
|
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-03-22 23:27:46 +00:00
|
|
|
/**
|
|
|
|
* Set an object to a boolean literal.
|
|
|
|
*
|
|
|
|
* This should set @p res to the given value and the boolean type in the
|
|
|
|
* language.
|
|
|
|
*/
|
2020-02-21 22:55:52 +00:00
|
|
|
drgn_bool_literal_fn *bool_literal;
|
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-03-22 23:27:46 +00:00
|
|
|
/**
|
|
|
|
* Set an object to a floating-point literal.
|
|
|
|
*
|
|
|
|
* This should set @p res to the given value and appropriate type for a
|
|
|
|
* floating-point literal in the language.
|
|
|
|
*/
|
2020-02-21 22:55:52 +00:00
|
|
|
drgn_float_literal_fn *float_literal;
|
|
|
|
drgn_cast_op *op_cast;
|
|
|
|
drgn_bool_op *op_bool;
|
|
|
|
drgn_cmp_op *op_cmp;
|
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-03-22 23:27:46 +00:00
|
|
|
drgn_binary_op *op_add;
|
|
|
|
drgn_binary_op *op_sub;
|
|
|
|
drgn_binary_op *op_mul;
|
|
|
|
drgn_binary_op *op_div;
|
|
|
|
drgn_binary_op *op_mod;
|
|
|
|
drgn_binary_op *op_lshift;
|
|
|
|
drgn_binary_op *op_rshift;
|
|
|
|
drgn_binary_op *op_and;
|
|
|
|
drgn_binary_op *op_or;
|
|
|
|
drgn_binary_op *op_xor;
|
|
|
|
drgn_unary_op *op_pos;
|
|
|
|
drgn_unary_op *op_neg;
|
|
|
|
drgn_unary_op *op_not;
|
|
|
|
};
|
|
|
|
|
2022-02-16 20:43:36 +00:00
|
|
|
/** Mapping from @ref drgn_language_number to @ref drgn_language. */
|
|
|
|
extern const struct drgn_language * const drgn_languages[];
|
2020-02-21 22:55:52 +00:00
|
|
|
|
2021-01-08 18:46:35 +00:00
|
|
|
/** Language to be used when actual language is unknown. */
|
|
|
|
#define drgn_default_language drgn_language_c
|
|
|
|
|
2019-12-12 22:30:04 +00:00
|
|
|
/**
|
|
|
|
* Return flags that should be passed through when formatting an object
|
|
|
|
* recursively.
|
|
|
|
*/
|
|
|
|
static inline enum drgn_format_object_flags
|
|
|
|
drgn_passthrough_format_object_flags(enum drgn_format_object_flags flags)
|
|
|
|
{
|
2019-12-06 18:59:31 +00:00
|
|
|
return (flags & (DRGN_FORMAT_OBJECT_SYMBOLIZE |
|
2019-12-06 19:17:43 +00:00
|
|
|
DRGN_FORMAT_OBJECT_STRING |
|
2019-12-06 19:40:13 +00:00
|
|
|
DRGN_FORMAT_OBJECT_CHAR |
|
|
|
|
DRGN_FORMAT_OBJECT_MEMBER_TYPE_NAMES |
|
2019-12-09 20:52:05 +00:00
|
|
|
DRGN_FORMAT_OBJECT_ELEMENT_TYPE_NAMES |
|
|
|
|
DRGN_FORMAT_OBJECT_MEMBERS_SAME_LINE |
|
2019-12-10 00:22:24 +00:00
|
|
|
DRGN_FORMAT_OBJECT_ELEMENTS_SAME_LINE |
|
2019-12-10 00:35:33 +00:00
|
|
|
DRGN_FORMAT_OBJECT_MEMBER_NAMES |
|
2019-12-10 09:36:45 +00:00
|
|
|
DRGN_FORMAT_OBJECT_ELEMENT_INDICES |
|
2019-12-10 09:48:06 +00:00
|
|
|
DRGN_FORMAT_OBJECT_IMPLICIT_MEMBERS |
|
|
|
|
DRGN_FORMAT_OBJECT_IMPLICIT_ELEMENTS));
|
2019-12-06 19:40:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/** Return flags that should be passed when formatting object members. */
|
|
|
|
static inline enum drgn_format_object_flags
|
|
|
|
drgn_member_format_object_flags(enum drgn_format_object_flags flags)
|
|
|
|
{
|
|
|
|
return (drgn_passthrough_format_object_flags(flags) |
|
|
|
|
(flags & DRGN_FORMAT_OBJECT_MEMBER_TYPE_NAMES) >> 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Return flags that should be passed when formatting object elements. */
|
|
|
|
static inline enum drgn_format_object_flags
|
|
|
|
drgn_element_format_object_flags(enum drgn_format_object_flags flags)
|
|
|
|
{
|
|
|
|
return (drgn_passthrough_format_object_flags(flags) |
|
|
|
|
(flags & DRGN_FORMAT_OBJECT_ELEMENT_TYPE_NAMES) >> 2);
|
2019-12-12 22:30:04 +00:00
|
|
|
}
|
|
|
|
|
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-03-22 23:27:46 +00:00
|
|
|
/** @} */
|
|
|
|
|
|
|
|
#endif /* DRGN_LANGUAGE_H */
|