diff options
author | Pau Espin Pedrol <pespin@sysmocom.de> | 2020-01-16 14:50:15 +0100 |
---|---|---|
committer | Pau Espin Pedrol <pespin@sysmocom.de> | 2020-01-16 14:50:15 +0100 |
commit | fd77c845dfd556f503f7fd4d9784d5b19768170e (patch) | |
tree | 087f14766917ded328e628aeec9b5dcf69e74537 | |
parent | 259fd3cedf81c7dd1d8b74e9d3c3cca517b46f1e (diff) |
README.md: Document how to get gdb backtrace from process crash
Change-Id: I507707a3ed0e7f88bcc9006612df531c848b949e
-rw-r--r-- | README.md | 37 |
1 files changed, 37 insertions, 0 deletions
@@ -72,6 +72,43 @@ necessary to add further complexity to the `Makefile`. Instead it was decided to scrap the file, and just keep the short list of dependencies right above where they would be needed in the `jenkins.sh`. +## Obtaining gdb backtrace from crash + +If for instance TTCN3 test is producing a crash on a program running in docker, +eg. osmo-msc, it is desirable to get a full crash report. This section describes +how to do so. + +First, open `osmo-$program/Dockerfile` and add lines to install `gdb` plus +`$program` dependency debug packages. For instance: + +``` ++RUN apt-get install -y --no-install-recommends \ ++ gdb \ ++ libosmocore-dbg libosmo-abis-dbg libosmo-netif-dbg libosmo-sigtran-dbg osmo-msc-dbg && \ ++ apt-get clean +``` + +In same `Dockerfile` file, modify configure to build with debug symbols enabled +and other interesting options, such as `--enable-sanitize`: + +``` +- ./configure --enable-smpp --enable-iu && \ ++ export CPPFLAGS="-g -O0 -fno-omit-frame-pointer" && \ ++ export CFLAGS="-g -O0 -fno-omit-frame-pointer" && \ ++ export CXXFLAGS="-g -O0 -fno-omit-frame-pointer" && \ ++ ./configure --enable-smpp --enable-iu --enable-sanitize && \ +``` + +Finally open the script you use to run the program (for instance +`ttcn3-$program-master/jenkins.sh`), and modify it to launch the process using +gdb, and to print a full backtrace when control returns to gdb (when the process +crashes): + +``` +-/bin/sh -c "osmo-msc -c /data/osmo-msc.cfg >>/data/osmo-msc.log 2>&1" ++/bin/sh -c "gdb -ex 'run' -ex 'bt full' --arg osmo-msc -c /data/osmo-msc.cfg >>/data/osmo-msc.log 2>&1" +``` + ## See also * [Overhyped Docker](http://laforge.gnumonks.org/blog/20170503-docker-overhyped/) for related rambling on why this doesn't work as well as one would |