On Wed, 5 May 2021 09:28:23 +0200 Nicolas Sterchele <nicolas@xxxxxxxxxxxxxx> wrote: > 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