diff options
| author | Xusheng <xusheng@vector35.com> | 2024-07-26 15:57:14 +0800 |
|---|---|---|
| committer | Xusheng <xusheng@vector35.com> | 2024-08-02 12:17:53 +0800 |
| commit | abbae639d8ba182e8b3cf2d5a9844a9b1f9844a1 (patch) | |
| tree | 272322e3269b09201c12489d93e7fbeb614fb140 /function.cpp | |
| parent | 7a9a2503aae0c2b92b437b2ea7796efaae93a822 (diff) | |
Support setting user global pointer value
Diffstat (limited to 'function.cpp')
| -rw-r--r-- | function.cpp | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/function.cpp b/function.cpp index 8497ccec..033a8453 100644 --- a/function.cpp +++ b/function.cpp @@ -104,6 +104,55 @@ Variable Variable::FromIdentifier(uint64_t id) RegisterValue::RegisterValue() : state(UndeterminedValue), value(0), offset(0), size(0) {} +bool RegisterValue::operator==(const RegisterValue& a) const +{ + switch (a.state) + { + case EntryValue: + return (state == EntryValue) && (a.value == value); + + case ConstantValue: + return (state == ConstantValue) && (a.value == value); + + case ConstantPointerValue: + return (state == ConstantPointerValue) && (a.value == value); + + case ExternalPointerValue: + return (state == ExternalPointerValue) && (a.value == value) && (a.offset == offset); + + case StackFrameOffset: + return (state == StackFrameOffset) && (a.value == value); + + case UndeterminedValue: + return state == UndeterminedValue; + + case ReturnAddressValue: + return state == ReturnAddressValue; + + case ImportedAddressValue: + return (state == ImportedAddressValue) && (a.value == value); + + case ConstantDataZeroExtendValue: + return (state == ConstantDataZeroExtendValue) && (a.value == value) && (a.size == size); + + case ConstantDataSignExtendValue: + return (state == ConstantDataSignExtendValue) && (a.value == value) && (a.size == size); + + case ConstantDataAggregateValue: + return (state == ConstantDataAggregateValue) && (a.value == value) && (a.size == size); + + default: + return false; + } +} + + +bool RegisterValue::operator!=(const RegisterValue& a) const +{ + return !((*this) == a); +} + + bool RegisterValue::IsConstant() const { return (state == ConstantValue) || (state == ConstantPointerValue); |
