Skip to content

Commit

Permalink
debugging: labs: fix a few incorrect paths
Browse files Browse the repository at this point in the history
After having updated the kernel for the debugging training, a few paths
have been missed and so are still pointing to the old kernel version which
is not used anymore

Signed-off-by: Alexis Lothoré <[email protected]>
  • Loading branch information
Tropicao committed Jul 9, 2024
1 parent 2d8ecc3 commit 241c436
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ \section{Perf}
\begin{bashinput}
$ sudo chown $USER:$USER perf.data
$ perf report --symfs=/home/$USER/debugging-labs/buildroot/output/staging/
-k /home/$USER/debugging-labs/buildroot/output/build/linux-5.13/vmlinux
-k /home/$USER/debugging-labs/buildroot/output/build/linux-6.6/vmlinux
\end{bashinput}
You will quickly notice that the output is not the same as valgrind because it
Expand Down
20 changes: 10 additions & 10 deletions labs/debugging-kernel-debugging/debugging-kernel-debugging.tex
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ \section{Locking and sleeps problems}
$ cd /home/$USER/debugging-labs/nfsroot/root/locking
$ export CROSS_COMPILE=/home/$USER/debugging-labs/buildroot/output/host/bin/arm-linux-
$ export ARCH=arm
$ export KDIR=/home/$USER/debugging-labs/buildroot/output/build/linux-5.13/
$ export KDIR=/home/$USER/debugging-labs/buildroot/output/build/linux-6.6/
$ make
\end{bashinput}

Expand Down Expand Up @@ -55,7 +55,7 @@ \section{Kmemleak}
$ cd /home/$USER/debugging-labs/nfsroot/root/kmemleak
$ export CROSS_COMPILE=/home/$USER/debugging-labs/buildroot/output/host/bin/arm-linux-
$ export ARCH=arm
$ export KDIR=/home/$USER/debugging-labs/buildroot/output/build/linux-5.13/
$ export KDIR=/home/$USER/debugging-labs/buildroot/output/build/linux-6.6/
$ make
\end{bashinput}

Expand Down Expand Up @@ -136,15 +136,15 @@ \subsection{Locating the exact line where the error happens}
For that, you can use the following command on your development host:
\begin{bashinput}
$ addr2line -e /home/$USER/debugging-labs/buildroot/output/build/linux-5.13/vmlinux
$ addr2line -e /home/$USER/debugging-labs/buildroot/output/build/linux-6.6/vmlinux
-a <crash_address>
\end{bashinput}
We can even go a step further and use the cross GDB to open vmlinux and
locate the function and corresponding offset in assembly
\begin{bashinput}
$ ${CROSS_COMPILE}gdb /home/$USER/debugging-labs/buildroot/output/build/linux-5.13/vmlinux
$ ${CROSS_COMPILE}gdb /home/$USER/debugging-labs/buildroot/output/build/linux-6.6/vmlinux
(gdb) disassemble <function>
\end{bashinput}

Expand All @@ -153,7 +153,7 @@ \subsection{Locating the exact line where the error happens}
Then, using the script provided by the kernel, execute the following command:

\begin{bashinput}
$ cd /home/$USER/debugging-labs/buildroot/output/build/linux-5.13/
$ cd /home/$USER/debugging-labs/buildroot/output/build/linux-6.6/
$ export ARCH=arm
$ export CROSS_COMPILE=/home/$USER/debugging-labs/buildroot/output/host/bin/arm-linux-
$ ./scripts/decode_stacktrace.sh vmlinux < ~/debugging-labs/oops.txt
Expand Down Expand Up @@ -196,7 +196,7 @@ \section{KGDB debugging}
attach a gdb process to KGDB with the following command:
\begin{bashinput}
$ ${CROSS_COMPILE}gdb ${HOME}/debugging-labs/buildroot/output/build/linux-5.13/vmlinux
$ ${CROSS_COMPILE}gdb ${HOME}/debugging-labs/buildroot/output/build/linux-6.6/vmlinux
(gdb) target remote /dev/pts/8
\end{bashinput}

Expand All @@ -221,7 +221,7 @@ \section{KGDB debugging}
used:

\begin{bashinput}
$ ${CROSS_COMPILE}gdb /home/$USER/debugging-labs/buildroot/output/build/linux-5.13/vmlinux
$ ${CROSS_COMPILE}gdb /home/$USER/debugging-labs/buildroot/output/build/linux-6.6/vmlinux
(gdb) target remote /dev/pts/8
\end{bashinput}
Expand Down Expand Up @@ -273,7 +273,7 @@ \subsection{Debugging a module}
$ cd /home/$USER/debugging-labs/nfsroot/root/kgdb
$ export CROSS_COMPILE=/home/$USER/debugging-labs/buildroot/output/host/bin/arm-linux-
$ export ARCH=arm
$ export KDIR=/home/$USER/debugging-labs/buildroot/output/build/linux-5.13/
$ export KDIR=/home/$USER/debugging-labs/buildroot/output/build/linux-6.6/
$ make
\end{bashinput}
Expand All @@ -296,7 +296,7 @@ \subsection{Debugging a module}
development platform, start it and attach to the target:
\begin{bashinput}$
$ ${CROSS_COMPILE}gdb /home/$USER/debugging-labs/buildroot/output/build/linux-5.13/vmlinux
$ ${CROSS_COMPILE}gdb /home/$USER/debugging-labs/buildroot/output/build/linux-6.6/vmlinux
(gdb) target remote /dev/pts/8
\end{bashinput}
Expand Down Expand Up @@ -418,6 +418,6 @@ \subsection{Configuring kexec}
You can load the \code{vmcore} file using cross GDB:
\begin{bashinput}
$ ${CROSS_COMPILE}gdb /home/$USER/debugging-labs/buildroot/output/build/linux-5.13/vmlinux \
$ ${CROSS_COMPILE}gdb /home/$USER/debugging-labs/buildroot/output/build/linux-6.6/vmlinux \
vmcore
\end{bashinput}
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ \section{(Bonus) System profiling with {\em perf} and FlameGraphs}
\code{chown}:

\begin{bashinput}
$ cd /home/$USER/debugging-labs/buildroot/output/build/linux-5.13/
$ cd /home/$USER/debugging-labs/buildroot/output/build/linux-6.6/
$ sudo cp /home/$USER/debugging-labs/nfsroot/root/system_profiling/perf.data .
$ sudo chown $USER:$USER perf.data
\end{bashinput}
Expand All @@ -229,7 +229,7 @@ \section{(Bonus) System profiling with {\em perf} and FlameGraphs}
\begin{bashinput}
$ perf report --symfs=/home/$USER/debugging-labs/buildroot/output/staging/
-k /home/$USER/debugging-labs/buildroot/output/build/linux-5.13/vmlinux
-k /home/$USER/debugging-labs/buildroot/output/build/linux-6.6/vmlinux
\end{bashinput}

Another useful tool for performance analysis is flamegraphs. Latest perf
Expand Down

0 comments on commit 241c436

Please sign in to comment.