Michael Opdenacker michael.opdenacker at bootlin.com
Mon Aug 3 15:09:36 CEST 2020

Repository : https://github.com/bootlin/training-materials
On branch  : master

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

Author: Michael Opdenacker <michael.opdenacker at bootlin.com>
Date:   Mon Aug 3 15:09:36 2020 +0200

gdb lab: add post-mortem analysis part

Signed-off-by: Michael Opdenacker <michael.opdenacker at bootlin.com>

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

.../sysdev-application-debugging.tex                | 21 +++++++++++++++++++--
1 file changed, 19 insertions(+), 2 deletions(-)

diff --git a/labs/sysdev-application-debugging/sysdev-application-debugging.tex b/labs/sysdev-application-debugging/sysdev-application-debugging.tex
index aa949d6d..6a0f9026 100644
--- a/labs/sysdev-application-debugging/sysdev-application-debugging.tex
+++ b/labs/sysdev-application-debugging/sysdev-application-debugging.tex
@@ -183,14 +183,27 @@ This will tell you that the segmentation fault occurred in a function
of the C library, called by our program. This should help you in
finding the bug in our application.

+\section{Post mortem analysis}
+
+Following the details in the slides, configure your shell on the
+target to get a \code{core} file dumped when you run \code{vista-emulator}
+again.
+
+Once you have such a file, inspect it with \code{arm-linux-gdb} on
+the target, set the \code{sysroot} setting, and then generate
+a backtrace to see where the program crashed.
+
+This way, you can have information about the crash without
+running the program through the debugger.
+
\section{What to remember}

During this lab, we learned that...
\begin{itemize}

\item It's easy to study the behavior of programs and diagnose issues
-%  without even having the source code, thanks to strace and ltrace.
-  without even having the source code, thanks to strace.
+  without even having the source code, thanks to \code{strace} and
+  \code{ltrace}.

\item You can leave a small \code{gdbserver} program (about 300 KB) on your target
that allows to debug target applications, using a standard \code{gdb}
@@ -200,4 +213,8 @@ During this lab, we learned that...
machine, as long as the programs and libraries with debugging
symbols are available on the development host.

+\item Thanks to \code{core} dumps, you can know where a program crashed,
+  without having to reproduce the issue by running the program through
+  the debugger.
+
\end{itemize}