DynamoRIO / DynamoRIO/dynamorio

Add test to automate validation of memory operands

Open
#6,392 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
3.2k
Forks
629
Avg merge
2d 15h
Merged PRs (30d)
31

Description

PR #6390 highlighted the need for a test that checks the correctness of memory operands in the IR.
The existing IR and disassembly tests work by comparing the disassembly of an instruction to a golden reference. This works well enough if the reference is correct but we currently just rely on human inspection to determine that the references are correct.

If we can create a test to automatically validate memory operands against the hardware it can help stop mistakes slipping through.

One way this could work would be to encode the instruction and execute it, then check the address that was accessed against the address calculated by `drutil_insert_get_mem_addr()`. If the addresses agree then the IR memory operand is a correct representation of the instruction operand.

For example, to test a given load instruction:

Call drutil_insert_get_mem_addr(...) to emit code to set `addr_reg` to the address of a memory operand.
emit a store that writes a value to `addr_reg`
emit load instruction under test
emit code to compare the value loaded to the value stored to in step 2.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.