Interface StructuredSleigh.LVal
- All Superinterfaces:
StructuredSleigh.RVal
- All Known Subinterfaces:
StructuredSleigh.Var
- Enclosing class:
StructuredSleigh
-
Method Summary
Modifier and TypeMethodDescriptionaddiTo
(long rhs) Generate in-place integer additionGenerate in-place integer additionCast the value to the given typeGenerate a field offsetinc()
Generate an in-place increment (by 1)index
(long index) Generate an array indexindex
(StructuredSleigh.RVal index) Generate an array indexset
(long rhs) Assign this valueset
(StructuredSleigh.RVal rhs) Assign this valueMethods inherited from interface ghidra.pcode.struct.StructuredSleigh.RVal
addf, addi, addi, andb, andb, andi, andi, deref, deref, divf, divis, divis, diviu, diviu, eq, eq, eqf, getType, gtef, gteis, gteis, gteiu, gteiu, gtf, gtis, gtis, gtiu, gtiu, ltef, lteis, lteis, lteiu, lteiu, ltf, ltis, ltis, ltiu, ltiu, mulf, muli, muli, neq, neq, neqf, notb, noti, orb, orb, ori, ori, remis, remis, remiu, remiu, shli, shli, shris, shris, shriu, shriu, subf, subi, subi, xorb, xorb, xori, xori
-
Method Details
-
cast
Description copied from interface:StructuredSleigh.RVal
Cast the value to the given typeThis functions like a C-style pointer cast. There are no implied operations or conversions. Notably, casting between integers and floats is just a re-interpretation of the underlying bits.
- Specified by:
cast
in interfaceStructuredSleigh.RVal
- Parameters:
type
- the type- Returns:
- a handle to the resulting value
-
field
Generate a field offsetThis departs subtly from expected C semantics. This value's type is assumed to be a pointer to a
Composite
. That type is retrieved and the field located. This then generates unsigned addition of that field offset to this value. The type of the result is a pointer to the type of the field. The C equivalent is "&(val->field)
". Essentially, it's just address computation. Note that this operator will fail if the type is not a pointer. It cannot be used directly on theComposite
type.TODO: Allow direct use on the composite type? Some mechanism for dealing with bitfields? Bitfields cannot really work if this is just pointer manipulation. If it's also allowed to manipulate raw bytes of a composite, then bitfield access could work. Assignment would be odd, but doable. The inputs would be the composite-typed value, the field name, and the desired field value. The output would be the resulting composite-typed value. For large structures, though, we'd like to manipulate the least number of bytes possible, since they'll likely need to be written back out to target memory.
- Parameters:
name
- the name of the field- Returns:
- a handle to the resulting value
-
index
Generate an array indexThis departs subtly from expected C semantics. This value's type is assumed to be a pointer to the element type. The size of the element type is computed, and this generates unsigned multiplcation of the index and size, then addition to this value. The type of the result is the same as this value's type. The C equivalent is "
&(val[index])
". Essentially, it's just address computation. Note that this operator will fail if the type is not a pointer. It cannot be used on anArray
type.TODO: Allow use of
Array
type? While it's possible for authors to specify pointer types for their variables, the types of fields they access may not be under their control. In particular, betweenfield(String)
andindex(RVal)
, we ought to support accessing fixed-length array fields.- Parameters:
index
- the operand to use as the index into the array- Returns:
- a handle to the resulting value
-
index
Generate an array index- Parameters:
index
- the immediate to use as the index into the array- Returns:
- a handle to the resulting value
- See Also:
-
set
Assign this value- Parameters:
rhs
- the value to assign- Returns:
- a handle to the resulting value
-
set
Assign this value- Parameters:
rhs
- the immediate value to assign- Returns:
- a handle to the resulting value
-
addiTo
Generate in-place integer addition- Parameters:
rhs
- the second operand- Returns:
- a handle to the resulting value
-
addiTo
Generate in-place integer addition- Parameters:
rhs
- the second operand- Returns:
- a handle to the resulting value
-
inc
Generate an in-place increment (by 1)- Returns:
- a handle to the resulting value
-