Skip to content

Commit

Permalink
debugging: labs: fix vmlinux path
Browse files Browse the repository at this point in the history
Signed-off-by: Alexis Lothoré <[email protected]>
  • Loading branch information
Tropicao committed Nov 21, 2024
1 parent c8dcfd3 commit 0b73b2f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions labs/debugging-ebpf/debugging-ebpf.tex
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ \section{libbpf}
\end{itemize}
\item You will first need to generate the vmlinux header used in the eBPF program. You can use bpftool to do so:
\begin{bashinput}
$ bpftool btf dump file /home/<user>/debugging-labs/buildroot/output/linux-6.6.21/vmlinux format c > vmlinux.h
$ bpftool btf dump file /home/<user>/debugging-labs/buildroot/output/linux-6.6/vmlinux format c > vmlinux.h
\end{bashinput}
\item Next you need to build your eBPF program into a loadable object:
\begin{bashinput}
Expand Down Expand Up @@ -124,7 +124,7 @@ \section{Improving our program}
Now that we have a working base for our custom tracing tool, we will improve it
to make it more useful.
In the labs directory, go to \path{ebpf/libbpf_advanced}. Copy the \path{trace_programs.c} and \path{trace_programs.bpf.c} from the previous part in this directory, as you will iterate on it. The directory provides a makefile which automates all build steps performed manually earlier. To use this makefile, make sure to have your \code{CROSS_COMPILE} variable properly set, as well as a \code{KDIR} variable pointing to \path{/home/<user>/debugging-labs/buildroot/output/build/linux-6.6.21} (needed to generate the \path{vmlinux.h} header)
In the labs directory, go to \path{ebpf/libbpf_advanced}. Copy the \path{trace_programs.c} and \path{trace_programs.bpf.c} from the previous part in this directory, as you will iterate on it. The directory provides a makefile which automates all build steps performed manually earlier. To use this makefile, make sure to have your \code{CROSS_COMPILE} variable properly set, as well as a \code{KDIR} variable pointing to \path{/home/<user>/debugging-labs/buildroot/output/build/linux-6.6} (needed to generate the \path{vmlinux.h} header)
Having to open ftrace to display the logs is cumbersome, we would like to get the trace directly in the console in which we have started the tool. We will use the opportunity to switch our program output from a log line in ftrace to events pushed in a \href{https://docs.kernel.org/6.6/bpf/ringbuf.html}{perf ring buffer}. A perf ring buffer is a kind of map which can be used in eBPF programs to stream data to userspace in a very efficient way. To use a perf ring buffer, perform the following steps:
\begin{itemize}
Expand Down

0 comments on commit 0b73b2f

Please sign in to comment.