Search code examples
linuxlinux-kernelftrace

How to get the full call graph starting from a specific function with in ftrace in Linux?


I want to trace specific function with ftrace, but with all further calls from that function.

I've managed to start ftrace with filter on my desired function, but now it only shows me this one specific function called.

So my question is: How to print all functions called from specific function, functions called by those functions, and so on?


Solution

  • I was able to resolve the problem. Here's the solution with kmalloc as example.

    cd /sys/kernel/debug/tracing
    echo kmalloc > set_graph_function
    echo function_graph > current_tracer
    cat trace
    

    Be sure to reset all filters (like set_ftrace_filter) before using function_graph.