/call-stack-logger

Call Stack Logger uses function instrumentation to facilitate logging of every function call. Each nesting adds an ident, whereas returning from a function removes it. As the result call stack tree is produced at the runtime giving knowledge of the actual program's flow of execution.

Primary LanguageC++

Call Stack Logger

Call Stack Logger uses function instrumentation to facilitate logging of every function call. Each nesting adds an ident, whereas returning from a function removes it. As the result call stack tree is produced at the runtime giving knowledge of the actual program's flow of execution.

🌱 Outcome

Call Stack logger capture

📖 Article

Here is the article on dev.to describing the details of the project, its aim and motivation behind it:
Call Stack Logger - Function instrumentation as a way to trace program’s flow of execution

📜 Requirements

GNU Binutils

It is required in order to get access to BFD (Binary File Descriptor library) necessary to get information about object files and manipulate them.

sudo apt-get install binutils-dev

🔧 Building and running

git clone https://github.com/TomaszAugustyn/call-stack-logger.git
cd call-stack-logger

# Create build folder and go there
mkdir build && cd build

# Configure cmake with default logging
cmake ..
# or for extended logging you can play with these flags
cmake -DLOG_ADDR=ON -DLOG_NOT_DEMANGLED=ON ..
# or to compile your application with disabled instrumentation (no logging)
cmake -DDISABLE_INSTRUMENTATION=ON ..

# Build
make

# Build and Run (as the result trace.out file will be generated)
make run

🔧 Building and running - legacy (Makefiles)

git clone https://github.com/TomaszAugustyn/call-stack-logger.git
cd call-stack-logger

mv Makefile_legacy Makefile
mv src/Makefile_legacy src/Makefile

# Build with default logging
make
# or for extended logging you can play with these flags
make log_with_addr=1 log_not_demangled=1
# or to compile your application with disabled instrumentation (no logging)
make disable_instrumentation=1

# Build and Run (as the result trace.out file will be generated)
make run