patterns: Fixed pointers not working correctly

This commit is contained in:
WerWolv 2021-09-25 18:45:23 +02:00
parent 9dc62e1469
commit ba97573f93
1 changed files with 16 additions and 2 deletions

View File

@ -943,15 +943,29 @@ namespace hex::pl {
}, offset->getValue()); }, offset->getValue());
} }
auto offset = evaluator->dataOffset();
auto sizePattern = this->m_sizeType->createPatterns(evaluator).front(); auto sizePattern = this->m_sizeType->createPatterns(evaluator).front();
ON_SCOPE_EXIT { delete sizePattern; }; ON_SCOPE_EXIT { delete sizePattern; };
auto pattern = new PatternDataPointer(evaluator->dataOffset(), sizePattern->getSize()); auto pattern = new PatternDataPointer(offset, sizePattern->getSize());
pattern->setPointedAtPattern(this->m_type->createPatterns(evaluator).front()); offset = evaluator->dataOffset();
{
auto pointedAtPattern = this->m_type->createPatterns(evaluator).front();
u128 pointerAddress = 0;
evaluator->getProvider()->read(pattern->getOffset(), &pointerAddress, pattern->getSize());
pointedAtPattern->setOffset(pointerAddress);
pattern->setPointedAtPattern(pointedAtPattern);
}
pattern->setVariableName(this->m_name); pattern->setVariableName(this->m_name);
applyVariableAttributes(evaluator, this, pattern); applyVariableAttributes(evaluator, this, pattern);
evaluator->dataOffset() = offset;
return { pattern }; return { pattern };
} }