[bootlin/training-materials updates] master: debugging: labs: 07: use the cross GDB from the toolchain, not gdb-multiarch (85deacf8)

Luca Ceresoli luca.ceresoli at bootlin.com
Mon Aug 28 17:52:50 CEST 2023


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

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

commit 85deacf8c17c5b7bb0e0f7e0a9fabfd7923a8702
Author: Luca Ceresoli <luca.ceresoli at bootlin.com>
Date:   Mon Aug 28 17:52:50 2023 +0200

    debugging: labs: 07: use the cross GDB from the toolchain, not gdb-multiarch
    
    gdb-multiarch is known to not working for our labs in Ubuntu 20.04,
    possibly other distros. Even though the one provided bu Ununtu 22.04 which
    we support is supposed to be working, nevertheless switch to the cross GDB
    from the toolchain for better reproducibility across trainees
    distributions.
    
    Signed-off-by: Luca Ceresoli <luca.ceresoli at bootlin.com>


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

85deacf8c17c5b7bb0e0f7e0a9fabfd7923a8702
 .../debugging-kernel-debugging.tex                 | 23 +++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/labs/debugging-kernel-debugging/debugging-kernel-debugging.tex b/labs/debugging-kernel-debugging/debugging-kernel-debugging.tex
index bc7ef66d..a614792a 100644
--- a/labs/debugging-kernel-debugging/debugging-kernel-debugging.tex
+++ b/labs/debugging-kernel-debugging/debugging-kernel-debugging.tex
@@ -139,11 +139,11 @@ $ addr2line -e /home/$USER/debugging-labs/buildroot/output/build/linux-5.13/vmli
   -a <crash_address>
 \end{bashinput}
 
-We can even go a step further and use \code{gdb-multiarch} to open vmlinux and
+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}
-$ gdb-multiarch /home/$USER/debugging-labs/buildroot/output/build/linux-5.13/vmlinux
+$ ${CROSS_COMPILE}gdb /home/$USER/debugging-labs/buildroot/output/build/linux-5.13/vmlinux
 (gdb) disassemble <function>
 \end{bashinput}
 
@@ -190,11 +190,11 @@ $ echo ttySTM0 > /sys/module/kgdboc/parameters/kgdboc
 \end{bashinput}
 
 Once done, trigger the crash by running the watchdog command, the system will
-automatically wait for a debugger to be attached. Run \code{gdb-multiarch} and
+automatically wait for a debugger to be attached. Run the cross GDB and
 attach a gdb process to KGDB with the following command:
 
 \begin{bashinput}
-$ gdb-multiarch /home/$USER/debugging-labs/buildroot/output/build/linux-5.13/vmlinux
+$ ${CROSS_COMPILE}gdb ${HOME}/debugging-labs/buildroot/output/build/linux-5.13/vmlinux
 (gdb) target remote /dev/pts/8
 \end{bashinput}
 
@@ -219,13 +219,14 @@ Attach gdb client from your development host using the same command that was pre
 used:
 
 \begin{bashinput}
-$ gdb-multiarch /home/$USER/debugging-labs/buildroot/output/build/linux-5.13/vmlinux
+$ ${CROSS_COMPILE}gdb /home/$USER/debugging-labs/buildroot/output/build/linux-5.13/vmlinux
 (gdb) target remote /dev/pts/8
 \end{bashinput}
 
-Note: if you do not specify a file to be used, gdb-multiarch won't be able to
-detect the architecture automatically and the target command will fail. In that
-case, you can set the architecture using:
+Note: if you prefer using gdb-multiarch instead of the cross-gdb we have
+built and do not specify a file to be used, gdb-multiarch won't be able to
+detect the architecture automatically and the target command will fail. In
+that case, you can set the architecture using:
 
 \begin{bashinput}
 (gdb) set arch arm
@@ -293,7 +294,7 @@ The kernel will then enter KGDB mode and will wait for a gdb connection. On the
 development platform, start it and attach to the target:
 
 \begin{bashinput}$
-$ gdb-multiarch /home/$USER/debugging-labs/buildroot/output/build/linux-5.13/vmlinux
+$ ${CROSS_COMPILE}gdb /home/$USER/debugging-labs/buildroot/output/build/linux-5.13/vmlinux
 (gdb) target remote /dev/pts/8
 \end{bashinput}
 
@@ -413,9 +414,9 @@ $ scp root at 192.168.0.101:/proc/vmcore .
 \end{bashinput}
 
 Finally, we will be able to debug that kernel coredump using crash.
-Using gdb, you can load the \code{vmcore} file using \code{gdb-multiarch}:
+You can load the \code{vmcore} file using cross GDB:
 
 \begin{bashinput}
-$ gdb-multiarch /home/$USER/debugging-labs/buildroot/output/build/linux-5.13/vmlinux \
+$ ${CROSS_COMPILE}gdb /home/$USER/debugging-labs/buildroot/output/build/linux-5.13/vmlinux \
   vmcore
 \end{bashinput}




More information about the training-materials-updates mailing list