add gdb to ci runners on debian to catch backtraces if they happen

This commit is contained in:
Jeff Becker 2020-06-16 09:21:19 -04:00
parent fc08f92425
commit 52bc2facc2
No known key found for this signature in database
GPG Key ID: F357B3B42F6F9B05
3 changed files with 35 additions and 7 deletions

View File

@ -38,16 +38,16 @@ local debian_pipeline(name, image,
'apt-get update',
'apt-get install -y eatmydata',
'eatmydata apt-get dist-upgrade -y',
'eatmydata apt-get install -y cmake git ninja-build pkg-config ccache ' + deps,
'eatmydata apt-get install -y gdb cmake git ninja-build pkg-config ccache ' + deps,
'mkdir build',
'cd build',
'cmake .. -G Ninja -DCMAKE_CXX_FLAGS=-fdiagnostics-color=always -DCMAKE_BUILD_TYPE='+build_type+' ' +
(if werror then '-DWARNINGS_AS_ERRORS=ON ' else '') +
(if lto then '' else '-DWITH_LTO=OFF ') +
cmake_extra,
'ninja -v',
'./test/testAll --gtest_color=yes',
'./test/catchAll --use-colour yes',
cmake_extra,
'ninja clean && ninja -v',
'../contrib/ci/drone-gdb.sh ./test/testAll --gtest_color=yes',
'../contrib/ci/drone-gdb.sh ./test/catchAll --use-colour yes',
] + extra_cmds,
}
],
@ -86,7 +86,7 @@ local windows_cross_pipeline(name, image,
(if lto then '' else '-DWITH_LTO=OFF ') +
"-DBUILD_STATIC_DEPS=ON -DDOWNLOAD_SODIUM=ON -DBUILD_PACKAGE=OFF -DBUILD_SHARED_LIBS=OFF -DBUILD_TESTING=ON -DNATIVE_BUILD=OFF -DSTATIC_LINK=ON" +
cmake_extra,
'ninja -v',
'ninja clean && ninja -v',
] + extra_cmds,
}
],
@ -158,7 +158,7 @@ local mac_builder(name, build_type='Release', werror=true, cmake_extra='', extra
'cmake .. -G Ninja -DCMAKE_CXX_FLAGS=-fcolor-diagnostics -DCMAKE_BUILD_TYPE='+build_type+' ' +
(if werror then '-DWARNINGS_AS_ERRORS=ON ' else '') +
cmake_extra,
'ninja -v',
'ninja clean && ninja -v',
'./test/testAll --gtest_color=yes',
'./test/catchAll --use-colour yes',
] + extra_cmds,

5
contrib/ci/drone-gdb.sh Executable file
View File

@ -0,0 +1,5 @@
#!/usr/bin/env bash
rm -f crash.out.txt exit.out.txt
gdb -q -x $(readlink -e $(dirname $0))/gdb-filter.py --args $@
test -e crash.out.txt && cat crash.out.txt
exit $(cat exit.out.txt)

23
contrib/ci/gdb-filter.py Normal file
View File

@ -0,0 +1,23 @@
def exit_handler (event):
code = 1
if hasattr(event, "exit_code"):
code = event.exit_code
with open("exit.out.txt", 'w') as f:
f.write("{}".format(code))
def crash_handler (event):
if (isinstance(event, gdb.SignalEvent)):
log_file_name = "crash.out.txt"
gdb.execute("set logging file " + log_file_name )
gdb.execute("set logging on")
gdb.execute("set logging redirect on")
gdb.execute("thread apply all bt")
gdb.execute("q")
gdb.events.stop.connect(crash_handler)
gdb.events.exited.connect(exit_handler)
gdb.execute("set confirm off")
gdb.execute("set pagination off")
gdb.execute("r")
gdb.execute("q")