I have ~10k independent and relatively simple .cpp files (let's assume only one 30-line main() function). I want to understand how each of them runs with many different sets of inputs (which they get via cin
). In particular, I want to do the following procedure thousands of times:
- Pick one of the files
- Give it a set of inputs
- Select a chunk of lines in the .cpp file
- Obtain which variables have changed and from what values to what values.
Alternatively, selecting a line and getting all the values for each declared variable is also good enough for me.
I'm trying to code this in Python, but I'm open for other languages as well. Looking at related questions and generic googling I've run into libclang (but seems mostly to look at Abstract Syntax Trees at compile time), gdb (may fit the bill, but not sure exactly how), and pybind11 (seems mostly tuned towards integrating one C++ package at a time and not running line by line).
In case of multiple alternatives, I care more about ease of code than compute efficiency when running the analysis.
How would you approach this task?