From 3de4acd67efce35d64e21c46f584db3f707deaeb Mon Sep 17 00:00:00 2001 From: Luca Ceresoli Date: Fri, 17 Jan 2025 17:28:01 +0100 Subject: [PATCH] debugging: labs: OOPS: swap decode_stacktrace and gdb disas sections This makes the flow more logical, keeping decode_stacktrace immediately after addr2line. It also makes the workding make more sense. Signed-off-by: Luca Ceresoli --- .../debugging-kernel-debugging-kgdb.tex | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/labs/debugging-kernel-debugging-kgdb/debugging-kernel-debugging-kgdb.tex b/labs/debugging-kernel-debugging-kgdb/debugging-kernel-debugging-kgdb.tex index 03cd1ad184..cfaf2d9042 100644 --- a/labs/debugging-kernel-debugging-kgdb/debugging-kernel-debugging-kgdb.tex +++ b/labs/debugging-kernel-debugging-kgdb/debugging-kernel-debugging-kgdb.tex @@ -54,14 +54,6 @@ \subsection{Locating the exact line where the error happens} -a \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-%\workingkernel%/vmlinux -(gdb) disassemble -\end{bashinput} - This can also be done automatically using \code{decode_stacktrace.sh}. First, copy/paste the OOPS message into the \code{~/debugging-labs/oops.txt} file. Then, using the script provided by the kernel, execute the following command: @@ -73,6 +65,14 @@ \subsection{Locating the exact line where the error happens} $ ./scripts/decode_stacktrace.sh vmlinux < ~/debugging-labs/oops.txt \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-%\workingkernel%/vmlinux +(gdb) disassemble +\end{bashinput} + \section{KGDB debugging} In order to debug this OOPS, we'll use KGDB which is an in-kernel debugger. The provided image already contains the necessary KGDB support and the watchdog