Skip to contentSkip to conversation

Record until a function call

DISCUSSION Nicolas Sterchele 2 participants 2 messages May 5, 2021

lore
Share & tools
lore
#0 lore raw

Hi there,

I did not find any options permitting to record a trace until a function has been called.

For instance, you want to record every function calls of a specific process until a specific function has been called.
Before doing this development, I would like to have your thoughts on this use case? Or if it is already possible?

thx.

Signature · 3 lines
Nicolas Sterchele
/ni.kɔ.lɑ/ /stɛrʃɛl/
@sterchelen
#1 lore raw
Quoted 11 lines · On Wed, 5 May 2021 09:28:23 +0200 Nicolas Sterchele <[email protected]>…

Hi there,

I did not find any options permitting to record a trace until a function has been called.

For instance, you want to record every function calls of a specific process until a specific function has been called.
Before doing this development, I would like to have your thoughts on this use case? Or if it is already possible?

thx.

# trace-cmd start -p function -l '<stop-func>:traceoff '

Where "<stop-func>" is the function you want to stop at.

Note, when trying this out, I realized that there's a bug in the kernel that it will ignore the "<stop-func>:traceoff" command if it doesn't have a white space at the end. That's because its been tested with:

 # echo "<stop-func>:traceoff" > /sys/kernel/tracing/set_ftrace_filter

and the above command will write just the string, which the kernel will think there's more to come, but not finish it if the file is closed. That is:

 # echo -n "<stop-func>:traceoff" > /sys/kernel/tracing/set_ftrace_filter

will not work (the -n tells echo to not add a new line).

I'll have to fix that.

To clear it:

  # trace-cmd reset

-- Steve