[bootlin/training-materials updates] master: kernel: split KGDB slides (82b4939e)
Clément Léger
clement.leger at bootlin.com
Tue Oct 25 10:52:27 CEST 2022
Repository : https://github.com/bootlin/training-materials
On branch : master
Link : https://github.com/bootlin/training-materials/commit/82b4939e7abb4b6658203a5fba1c64c757f6add5
>---------------------------------------------------------------
commit 82b4939e7abb4b6658203a5fba1c64c757f6add5
Author: Clément Léger <clement.leger at bootlin.com>
Date: Tue May 31 15:56:17 2022 +0200
kernel: split KGDB slides
These slides are going to be reused in debugging course
Signed-off-by: Clément Léger <clement.leger at bootlin.com>
>---------------------------------------------------------------
82b4939e7abb4b6658203a5fba1c64c757f6add5
common/kgdb.tex | 53 ++++++++++++++++++++++
.../kernel-driver-development-debugging.tex | 53 +---------------------
2 files changed, 54 insertions(+), 52 deletions(-)
diff --git a/common/kgdb.tex b/common/kgdb.tex
new file mode 100644
index 00000000..8baa9192
--- /dev/null
+++ b/common/kgdb.tex
@@ -0,0 +1,53 @@
+
+\begin{frame}
+ \frametitle{kgdb - A kernel debugger}
+ \begin{itemize}
+ \item \kconfig{CONFIG_KGDB} in {\em Kernel hacking}.
+ \item The execution of the kernel is fully controlled by \code{gdb}
+ from another machine, connected through a serial line.
+ \item Can do almost everything, including inserting breakpoints in
+ interrupt handlers.
+ \item Feature supported for the most popular CPU architectures
+ \end{itemize}
+\end{frame}
+
+\begin{frame}
+ \frametitle{Using kgdb 1/2}
+ \begin{itemize}
+ \item Details available in the kernel documentation:
+ \kdochtml{dev-tools/kgdb}
+ \item Recommended to turn on \kconfig{CONFIG_FRAME_POINTER} to aid in
+ producing more reliable stack backtraces in \code{gdb}.
+ \item You must include a kgdb I/O driver. One of them is \code{kgdb} over
+ serial console (\code{kgdboc}: \code{kgdb} over console, enabled by
+ \kconfig{CONFIG_KGDB_SERIAL_CONSOLE})
+ \item Configure \code{kgdboc} at boot time by passing to the kernel:
+ \begin{itemize}
+ \item \code{kgdboc=<tty-device>,<bauds>}.
+ \item For example: \code{kgdboc=ttyS0,115200}
+ \end{itemize}
+ \item Or at runtime using sysfs:
+ \begin{itemize}
+ \item \code{echo ttyS0 > /sys/module/kgdboc/parameters/kgdboc}
+ \end{itemize}
+ \end{itemize}
+\end{frame}
+
+\begin{frame}
+ \frametitle{Using kgdb 2/2}
+ \begin{itemize}
+ \item Then also pass \code{kgdbwait} to the kernel: it makes
+ \code{kgdb} wait for a debugger connection.
+ \item Boot your kernel, and when the console is initialized,
+ interrupt the kernel with a break character and then \code{g}
+ in the serial console (see our {\em Magic SysRq} explanations).
+ \item On your workstation, start \code{gdb} as follows:
+ \begin{itemize}
+ \item \code{arm-linux-gdb ./vmlinux}
+ \item \code{(gdb) set remotebaud 115200}
+ \item \code{(gdb) target remote /dev/ttyS0}
+ \end{itemize}
+ \item Once connected, you can debug a kernel the way you would debug
+ an application program.
+ \end{itemize}
+\end{frame}
\ No newline at end of file
diff --git a/slides/kernel-driver-development-debugging/kernel-driver-development-debugging.tex b/slides/kernel-driver-development-debugging/kernel-driver-development-debugging.tex
index 6cdeffa5..2e38fbeb 100644
--- a/slides/kernel-driver-development-debugging/kernel-driver-development-debugging.tex
+++ b/slides/kernel-driver-development-debugging/kernel-driver-development-debugging.tex
@@ -97,58 +97,7 @@
\end{itemize}
\end{frame}
-\begin{frame}
- \frametitle{kgdb - A kernel debugger}
- \begin{itemize}
- \item \kconfig{CONFIG_KGDB} in {\em Kernel hacking}.
- \item The execution of the kernel is fully controlled by \code{gdb}
- from another machine, connected through a serial line.
- \item Can do almost everything, including inserting breakpoints in
- interrupt handlers.
- \item Feature supported for the most popular CPU architectures
- \end{itemize}
-\end{frame}
-
-\begin{frame}
- \frametitle{Using kgdb 1/2}
- \begin{itemize}
- \item Details available in the kernel documentation:
- \kdochtml{dev-tools/kgdb}
- \item Recommended to turn on \kconfig{CONFIG_FRAME_POINTER} to aid in
- producing more reliable stack backtraces in \code{gdb}.
- \item You must include a kgdb I/O driver. One of them is \code{kgdb} over
- serial console (\code{kgdboc}: \code{kgdb} over console, enabled by
- \kconfig{CONFIG_KGDB_SERIAL_CONSOLE})
- \item Configure \code{kgdboc} at boot time by passing to the kernel:
- \begin{itemize}
- \item \code{kgdboc=<tty-device>,<bauds>}.
- \item For example: \code{kgdboc=ttyS0,115200}
- \end{itemize}
- \item Or at runtime using sysfs:
- \begin{itemize}
- \item \code{echo ttyS0 > /sys/module/kgdboc/parameters/kgdboc}
- \end{itemize}
- \end{itemize}
-\end{frame}
-
-\begin{frame}
- \frametitle{Using kgdb 2/2}
- \begin{itemize}
- \item Then also pass \code{kgdbwait} to the kernel: it makes
- \code{kgdb} wait for a debugger connection.
- \item Boot your kernel, and when the console is initialized,
- interrupt the kernel with a break character and then \code{g}
- in the serial console (see our {\em Magic SysRq} explanations).
- \item On your workstation, start \code{gdb} as follows:
- \begin{itemize}
- \item \code{arm-linux-gdb ./vmlinux}
- \item \code{(gdb) set remotebaud 115200}
- \item \code{(gdb) target remote /dev/ttyS0}
- \end{itemize}
- \item Once connected, you can debug a kernel the way you would debug
- an application program.
- \end{itemize}
-\end{frame}
+\input{../common/kgdb.tex}
\begin{frame}
\frametitle{Debugging with a JTAG interface}
More information about the training-materials-updates
mailing list