1

TLDR; Does ftrace have a function similiar to trace_printk() which can print out the current function's call stack?

I know how to print out the function or function graph trace using ftrace, but sometimes I want to check one place's function call trace without touching others, that's to say, keep the other place's tracer as nop so the trace_printk() function will only output one line log and the place I'm curious of as function tracer, so I can go deep in what has happened in that place, it that feasible?

tristone
  • 95
  • 6
  • Roughly (as a first step): https://elixir.bootlin.com/linux/v6.2-rc6/source/Documentation/core-api/printk-formats.rst#L107. But what you need is to modify, **for your CPU**, the respective `show_stack()` call. – 0andriy Feb 03 '23 at 18:58
  • @0andriy Thanks, but this will show the stack in dmesg, is there any method to show the it in the ftrace? – tristone Feb 05 '23 at 09:25
  • I didn't get what you referring to: the fisrt or the last senstence in my comment? If the first, it's just about specifier which you put to `trace_printk()` call. If about second, I clearly said that you have to modify existing code to move from dmesg to trace buffer. You maybe can clone it and call something like `trace_show_stack()` and use whenever you need. – 0andriy Feb 06 '23 at 21:15
  • @0andriy I also didn't get what you mean: Do you mean `trace_printk()` has a "specifier" which can make it output call stack to the trace buffer? If so, why do I need to modify the existing code of dmesg? – tristone Feb 07 '23 at 01:19
  • There are **two** sentences in my **first** comment. **1st** is about specifier that you may use in `trace_printk()`. The **2nd** is about **existing** code that you need to clone to have a trace compatible version. Sorry, I have no idea how to explain it better. I suggest you to read documentation and code, really. It will help much better and quickier to understand. – 0andriy Feb 07 '23 at 12:17

0 Answers0