Elfspy fork using the meson build system.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
sergiotarxz 9368209522 Fixing global mock deletion support. 4 months ago
elfspy Fixing global mock deletion support. 4 months ago
examples added rpath 5 years ago
images cropped 6 years ago
.gitignore Adding meson.build to generate pkg-config. 5 months ago
Call.cpp externing the list correctly 4 months ago
ELFInfo.cpp cache debug directory scans 5 years ago
Error.cpp Initial version 6 years ago
Fail.cpp Initial version 6 years ago
GOTEntry.cpp Moving all headers to elfspy/ 4 months ago
Hook.cpp Fixing global mock deletion support. 4 months ago
LICENSE Create LICENSE 5 years ago
MFile.cpp Minor change 5 years ago
README README change 6 years ago
README.md Update README.md 5 years ago
Report.cpp Initial version 6 years ago
SPY.cpp Initial version 6 years ago
SectionHeader.cpp Support for better syntax 5 years ago
meson.build Fixing global mock deletion support. 4 months ago

README.md

ELFspy is a library for linux for writing tests using fakes and spies in C++. For very large call graphs, the testing of the higher nodes can be difficult due to the sum of dependencies of lower nodes e.g. databases, network connections etc. Adding fakes and spies to the callees of a function allows it to be tested in isolation without the inherited dependencies.

ELFspy works by allowing code to externally modify an existing implementation/library of a program. This is achieved by changing function addresses in the global offset tables of the running program, so that these are redirected to a different function created by ELFspy. This allows new functions to be interjected between the caller and the callee to spy on the arguments and return value. In addition the original function can be replaced with a simulation (fake) of the original. The code under test needs no changes and is unaware of the additional calls that are being made in between a caller and a callee.

Call graph before change

External code:

auto add_spy = SPY(&add);

Call graph after change(the code does not change, but the runtime execution does)

This technique relies on code being compiled as position independent code and uses the Executable and Linking Format(ELF) information found in the executable and its shared libraries to find the global offset table entries and modify them.

To see how ELFspy can be used start by reading this example