Skip to content

Instantly share code, notes, and snippets.

@tbenthompson
tbenthompson / function_serialize.cpp
Last active February 5, 2025 13:05
Serializing functions in C++
#include <iostream>
#include <sstream>
#include <fstream>
/* Serialize a function by writing out a pointer to its location in memory.
* This will only work between two processes running identical binaries.
*
* One difficulty is ASLR:
* Address space layout randomization (ASLR) puts functions in a different
* place in memory everytime a program is loaded. Within a given binary