Struct haybale_pitchfork::AbstractData [−][src]
pub struct AbstractData(_);
Expand description
An abstract description of a value: its size, whether it is a pointer or not, whether it is public or secret (or maybe it’s a struct with some public and some secret fields, or maybe it’s a public pointer that points to some secret data), etc.
Unlike CompleteAbstractData
, these may be “underspecified”: parts of the
value (or the whole value) may be marked
default()
, meaning to just use
the default based on the LLVM type.
Implementations
an 8-bit public value
a 16-bit public value
a 32-bit public value
a 64-bit public value
a public value with the given number of bits
a secret value with the given number of bits
A (public) pointer to something - another value, an array, etc
A (public) pointer which may either point to the given data or be NULL
a (public) pointer to the LLVM Function
with the given name
a (public) pointer to the hook registered for the given name
A (public) pointer to this struct itself. E.g., in the C code
struct Foo {
int x;
Foo* f;
};
you could use this for Foo* f
to indicate it should point to
this exact Foo
itself.
A (public) pointer to this struct’s parent. E.g., in the C code
struct Foo {
int x;
Bar* bar1;
Bar* bar2;
...
};
struct Bar {
int y;
Foo* parent; // pointer to the Foo containing this Bar
};
you could use this for Foo* parent
to indicate it should point to the
Foo
containing this Bar
.
Like pub_pointer_to_parent()
, but if the parent is not the correct type
(or if there is no parent, i.e., we are directly initializing this)
then pointer to the given AbstractData
instead
A (first-class) array of values
A (first-class) structure of values
(_struct
used instead of struct
to avoid collision with the Rust keyword)
Just use the default structure based on the LLVM type and/or the StructDescriptions
.
(The StructDescriptions
override the LLVM type when they apply.)
The default structure based on the LLVM type is:
- for LLVM integer type: public unconstrained value of the appropriate size
- for LLVM pointer type (except function pointer): public concrete pointer value to allocated memory, depending on pointer type:
- pointee is an integer type: pointer to allocated array of
DEFAULT_ARRAY_LENGTH
pointees (e.g., default forchar*
is pointer to array of 1024 chars) - pointee is an array type with 0 elements: pointer to allocated array of
DEFAULT_ARRAY_LENGTH
elements - pointee is any other type: pointer to one of that other type
- (then in any case, apply these rules recursively to each pointee type)
- pointee is an integer type: pointer to allocated array of
- for LLVM function pointer type: concrete function pointer value which, when called, will raise an error
- for LLVM vector or array type: array of the appropriate length, containing public values
- (then apply these rules recursively to each element)
- for LLVM structure type:
- if this struct is one of those named in the
StructDescriptions
, then use the appropriate struct description - if the structure type is entirely opaque (no definition anywhere in the
Project
), then allocateOPAQUE_STRUCT_SIZE_BYTES
unconstrained bytes for it and assume that’s enough (probably most of that memory will go unused, but that’s fine) - else, apply these rules recursively to each field
- if this struct is one of those named in the
Use the default structure for the given LLVM struct name.
If we are not in the middle of an override, this struct name must match the actual LLVM type’s struct name.
If we are in the middle of an override and therefore don’t have an
LLVM type at the moment, this will act like default()
with the
LLVM type being the one for the given LLVM struct name.
A (public) pointer which may point anywhere, including being NULL
Just fill with the appropriate number of unconstrained bytes based on the LLVM type
When C code uses void*
, this often becomes i8*
in LLVM. However,
within Pitchfork, we may want to specify some type other than i8*
for
the purposes of allocating and analyzing the data behind the void*
.
This says to use the provided AbstractData
even though the LLVM type is
i8
.
Note that the AbstractData
here must actually be fully specified,
perhaps with the help of StructDescriptions
. If it’s not, users of
the AbstractData
may panic.
If the optional llvm_struct_name
is included, it will lookup that
struct’s type and use that both for any underspecified elements in the
AbstractData
, and for sanity typechecking. Otherwise, the
AbstractData
must be fully-specified, and no sanity typechecking will
be performed (the AbstractData
will be assumed correct).
Use a pointer to the given data
, even though the LLVM type will be
a pointer to a different type.
For instance, you could override a u64*
to instead be a pointer to
some struct of your choosing; this would ensure the pointed-to data
is allocated and initialized as if it were that struct.
llvm_struct_name
: see notes on void_override
.
To override a void*
type, you probably want
void_override
; see notes there.
Use the given data
, even though it may not match the LLVM type.
It still needs to be the same size (number of bits) as the LLVM type.
For instance, you could specify that some LLVM pointer-size integer
should actually be initialized to have a pointer value and point to some
specified data.
To override a void*
type, see void_override
- and this probably won’t
work for that anyways because of the same-size restriction. See comments
on void_override
.
Note that the AbstractData
here must actually be fully specified,
perhaps with the help of StructDescriptions
. If it’s not, users of
the AbstractData
may panic.
Use the given data
, but also (during initialization) add a watchpoint
with the given name
to the State
covering the memory region it
occupies.
Trait Implementations
This Display
is not meant to completely replace the derived Debug
representation, but rather be a much more concise pretty representation
(omitting a lot of the data in some cases)
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
This method tests for !=
.
Auto Trait Implementations
impl RefUnwindSafe for AbstractData
impl Send for AbstractData
impl Sync for AbstractData
impl Unpin for AbstractData
impl UnwindSafe for AbstractData
Blanket Implementations
Mutably borrows from an owned value. Read more