[bootlin/training-materials updates] master: gdb: add more command for low-level debug (17a5ac88)

Clément Léger clement.leger at bootlin.com
Tue Oct 25 10:52:04 CEST 2022


Repository : https://github.com/bootlin/training-materials
On branch  : master
Link       : https://github.com/bootlin/training-materials/commit/17a5ac88427f35d0ca06f4c9159dbae9f101b735

>---------------------------------------------------------------

commit 17a5ac88427f35d0ca06f4c9159dbae9f101b735
Author: Clément Léger <clement.leger at bootlin.com>
Date:   Fri Jun 3 10:52:07 2022 +0200

    gdb: add more command for low-level debug
    
    Add commands for instruction level debugging.
    
    Signed-off-by: Clément Léger <clement.leger at bootlin.com>


>---------------------------------------------------------------

17a5ac88427f35d0ca06f4c9159dbae9f101b735
 common/gdb.tex | 33 ++++++++++++++++++++++++++++-----
 1 file changed, 28 insertions(+), 5 deletions(-)

diff --git a/common/gdb.tex b/common/gdb.tex
index ad09422d..3cb46ab9 100644
--- a/common/gdb.tex
+++ b/common/gdb.tex
@@ -25,8 +25,26 @@
   \end{columns}
 \end{frame}
 
+\begin{frame}[fragile]
+  \frametitle{GDB crash course (1/3)}
+  \begin{itemize}
+    \item GDB is used mainly to debug a process by starting it with {\em gdb}
+    \begin{itemize}
+      \item \code{$ gdb <program>}
+    \end{itemize}
+    \item GDB can also be attached to running processes using the program PID
+    \begin{itemize}
+      \item \code{$ gdb -p <pid>}
+    \end{itemize}
+    \item When using GDB to start a program, the program needs to be run with
+    \begin{itemize}
+      \item \code{(gdb) run}
+    \end{itemize}
+  \end{itemize}
+\end{frame}
+
 \begin{frame}
-  \frametitle{GDB crash course (1)}
+  \frametitle{GDB crash course (2/3)}
   \small
   A few useful GDB commands
   \begin{itemize}
@@ -34,14 +52,17 @@
     Put a breakpoint at the entry of function \code{foobar()}
   \item \code{break foobar.c:42}\\
     Put a breakpoint in \code{foobar.c}, line 42
-  \item \code{print var} or \code{print task->files[0].fd} (\code{p})\\
-    Print the variable \code{var}, or a more complicated reference. GDB
-    can also nicely display structures with all their members
+  \item \code{print var}, \code{print $reg} or \code{print task->files[0].fd} (\code{p})\\
+    Print the variable \code{var}, the register \code{$reg} or a more
+    complicated reference. GDB can also nicely display structures with all
+    their members
+  \item \code{info registers} (\code{b})\\
+    Display architecture registers
   \end{itemize}
 \end{frame}
 
 \begin{frame}
-  \frametitle{GDB crash course (2)}
+  \frametitle{GDB crash course (3/3)}
   \small
   \begin{itemize}
   \item \code{continue} (\code{c})\\
@@ -50,6 +71,8 @@
     Continue to the next line, stepping over function calls
   \item \code{step} (\code{s})\\
     Continue to the next line, entering into subfunctions
+  \item \code{stepi} (\code{s})\\
+    Continue to the next instructions
   \item \code{backtrace} (\code{bt})\\
     Display the program stack
   \end{itemize}




More information about the training-materials-updates mailing list