<div dir="auto"><div><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, 18 Oct 2021, 04:46 Dongliang Mu, <<a href="mailto:mudongliangabcd@gmail.com">mudongliangabcd@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi all,<br>
<br>
I am writing to kindly ask one question: is there any tracing<br>
mechanism in Linux kernel that can trace all the executed instructions<br>
of a user process? If this user process is run on different<br>
processors, traces of this process on different processors should be<br>
also recorded.<br></blockquote></div></div><div dir="auto"><br></div><div dir="auto">You've not explained in detail what is the purpose of the tracing that you want to do. Missing this information I can only provide you a list of links to various tools and methods. Take a look by yourself and try to figure out what is better suited for your needs...</div><div dir="auto"><br></div><div dir="auto"><a href="https://lwn.net/Kernel/Index/#Development_tools-Kernel_tracing">https://lwn.net/Kernel/Index/#Development_tools-Kernel_tracing</a><br></div><div dir="auto">trace-cmd: <a href="https://trace-cmd.org">https://trace-cmd.org</a></div><div dir="auto">perf ftrace: <Linux source>/tools/perf/Documentation/perf-trace.txt</div><div dir="auto">perf-tools: <a href="https://github.com/brendangregg/perf-tools">https://github.com/brendangregg/perf-tools</a></div><div dir="auto"><br></div><div dir="auto">In particular, the "function_graph" tracer of ftrace seems to be suited for your purposes:</div><div dir="auto"><br></div><div dir="auto"><a href="https://man7.org/linux/man-pages/man1/trace-cmd.1.html">https://man7.org/linux/man-pages/man1/trace-cmd.1.html</a><br></div><div dir="auto"><a href="https://man7.org/linux/man-pages/man1/trace-cmd-record.1.html">https://man7.org/linux/man-pages/man1/trace-cmd-record.1.html</a><br></div><div dir="auto"><a href="https://man7.org/linux/man-pages/man1/trace-cmd-report.1.html">https://man7.org/linux/man-pages/man1/trace-cmd-report.1.html</a><br></div><div dir="auto"><br></div><div dir="auto">Obviously, gdb (and friends) is still invaluable (but it may be difficult to use, depending on your knowledge and experience, so use it if you really know that  you need it):</div><div dir="auto"><br></div><div dir="auto"><a href="https://www.kernel.org/doc/html/latest/dev-tools/gdb-kernel-debugging.html">https://www.kernel.org/doc/html/latest/dev-tools/gdb-kernel-debugging.html</a><br></div><div dir="auto"><a href="https://www.kernel.org/doc/html/latest/dev-tools/kgdb.html">https://www.kernel.org/doc/html/latest/dev-tools/kgdb.html</a><br></div><div dir="auto"><br></div><div dir="auto">Regards,</div><div dir="auto"><br></div><div dir="auto">Fabio M. De Francesco </div><div dir="auto"><br></div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Any comment is welcome.<br>
<br>
--<br>
My best regards to you.<br>
<br>
     No System Is Safe!<br>
     Dongliang Mu<br>
<br>
_______________________________________________<br>
Kernelnewbies mailing list<br>
<a href="mailto:Kernelnewbies@kernelnewbies.org" target="_blank" rel="noreferrer">Kernelnewbies@kernelnewbies.org</a><br>
<a href="https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies" rel="noreferrer noreferrer" target="_blank">https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies</a><br>
</blockquote></div></div></div>