Trace/Retrieve C++ implementations from a single python operation

I am trying to find an easy way to see all the C++ code touched from a python operation.

For example when executing torch.add(x, y), I want to output a single file with either a list of the filenames/function names executed or all the actual C++ backend implementation for that operation.

I have some ideas of how to do this, such as with gdb, llvm-cov, building pytorch with breakpoints, etc. Has anyone done this before? and what tools did you use?