Elfspy fork using the meson build system.
Go to file
2016-10-09 15:40:07 +02:00
examples moved examples 2016-10-09 15:39:53 +02:00
images cropped 2016-10-09 13:57:12 +02:00
Arg.h Initial version 2016-09-16 17:45:35 +02:00
Call.cpp Initial version 2016-09-16 17:45:35 +02:00
Call.h Initial version 2016-09-16 17:45:35 +02:00
Capture.h Initial version 2016-09-16 17:45:35 +02:00
ELFInfo.cpp Initial version 2016-09-16 17:45:35 +02:00
ELFInfo.h Initial version 2016-09-16 17:45:35 +02:00
ELFObject.h Initial version 2016-09-16 17:45:35 +02:00
Error.cpp Initial version 2016-09-16 17:45:35 +02:00
Error.h Initial version 2016-09-16 17:45:35 +02:00
Fail.cpp Initial version 2016-09-16 17:45:35 +02:00
Fail.h Initial version 2016-09-16 17:45:35 +02:00
Fake.h Initial version 2016-09-16 17:45:35 +02:00
Function.h Initial version 2016-09-16 17:45:35 +02:00
GOTEntry.cpp Started testing virtual inheritance 2016-09-17 22:46:34 +02:00
GOTEntry.h Started testing virtual inheritance 2016-09-17 22:46:34 +02:00
Hook.h Started testing virtual inheritance 2016-09-17 22:46:34 +02:00
HookBase.h Initial version 2016-09-16 17:45:35 +02:00
HookImpl.h Initial version 2016-09-16 17:45:35 +02:00
Lambda.h Initial version 2016-09-16 17:45:35 +02:00
makefile moved examples 2016-10-09 15:40:07 +02:00
makefile.inc Moved examples to separate dir 2016-10-09 15:37:55 +02:00
Method.h Initial version 2016-09-16 17:45:35 +02:00
MethodInfo.h Initial version 2016-09-16 17:45:35 +02:00
MethodPointer.h Initial version 2016-09-16 17:45:35 +02:00
MFile.cpp Initial version 2016-09-16 17:45:35 +02:00
MFile.h Initial version 2016-09-16 17:45:35 +02:00
Profiler.h Initial version 2016-09-16 17:45:35 +02:00
README README change 2016-09-30 18:32:32 +02:00
README.md Fixed link 2016-10-09 14:16:24 +02:00
Report.cpp Initial version 2016-09-16 17:45:35 +02:00
Report.h Initial version 2016-09-16 17:45:35 +02:00
Result.h Initial version 2016-09-16 17:45:35 +02:00
SPY.cpp Initial version 2016-09-16 17:45:35 +02:00
SPY.h Started testing virtual inheritance 2016-09-17 22:46:34 +02:00
Thunk.h Initial version 2016-09-16 17:45:35 +02:00
ThunkHandle.h Initial version 2016-09-16 17:45:35 +02:00
Variadic.h Initial version 2016-09-16 17:45:35 +02:00

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 the program to change 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

Call graph after change

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.

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