This blog post details how to implement an LLVM Pass that allows for tracing memory access - by modifying binaries to augment each memory access opcode with tracing logic.

Contents

Introducing Memory Access Traces at Compile Time with LLVM Passes

Resources and Setup

Writing the Pass - Planning and Boilerplate

Writing the Pass - Setting Up a Global File Descriptor

Writing the Pass - Implementing the Memory Trace Function

Writing the Pass - Wrapping Each Memory Access Opcode

Running the Pass

Conclusions