Search code examples
visual-studiofunctiondebuggingruntimecall

How to list all calls of a function at runtime?


Is there any way to list (show in VS, write to file) all callers (objects, functions) of a function while the program is running? Possibly using the debugger?

I need to record all calls (including callers) of a function from the launch of the program to its termination.

A simple scan of the source code or the binary does not do the job because the program could operate as a server which receives requests to call the desired function.

If Visual Studio does not provide this feature, are there any other solutions to this problem?


Solution

  • VS profiler tool also would be helpful for you, you could select the method "CPU sampling".

    enter image description here

    After it finished, you could select "Caller/Callee".

    enter image description here

    Reference:

    https://learn.microsoft.com/en-us/visualstudio/profiling/caller-callee-view

    Update: We can export the report: enter image description here