-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
show a python core dump, with full debug symbols
- Loading branch information
Buck Golemon
committed
Nov 7, 2014
1 parent
537556c
commit b59c989
Showing
3 changed files
with
41 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,43 @@ | ||
language: cpp | ||
language: python | ||
|
||
env: | ||
matrix: | ||
- CRASH_PLEASE=boooooooom | ||
- HAPPY_NO_CRASH=all-good | ||
|
||
compiler: | ||
# gcc compiler, clang would be fine too | ||
- gcc | ||
# These must match one of the lines from `python-build --definitions` | ||
#- PYTHON=2.6.9 ## 2.6 doesn't have the gdb tools | ||
- PYTHON=2.7.8 | ||
- PYTHON=3.3.6 | ||
- PYTHON=3.4.2 | ||
|
||
before_install: | ||
# install the gnu debugger for later use in reading the core file | ||
- sudo apt-get -y install gdb | ||
# use pyenv to build a debug version of python | ||
- sudo python-build --keep --debug $PYTHON /opt/python/${PYTHON}-dbg | ||
# The cpython source tree has useful gdb tools that make its core dumps readable | ||
- PYTHON_GDBTOOLS=$(ls -1rdt /tmp/python-build.*/Python-$PYTHON/Tools/gdb/ | head -1) | ||
|
||
install: | ||
# What is the current file size max for core files? | ||
# It is usually 0, which means no core file will be dumped if there is a crash | ||
- ulimit -c | ||
|
||
# make a virtualenv for the -dbg interpreter | ||
- virtualenv --python /opt/python/${PYTHON}-dbg/bin/python virtualenv/python${PYTHON}-dbg | ||
- source virtualenv/python${PYTHON}-dbg/bin/activate | ||
- pip install virtualenv | ||
|
||
before_script: | ||
# Set the core file limit to unlimited so a core file is generated upon crash | ||
- ulimit -c unlimited -S | ||
# What is the current file size max for core files? | ||
# It is usually 0, which means no core file will be dumped if there is a crash | ||
- ulimit -Hc # hard limit | ||
- ulimit -Sc # soft limit | ||
- python-build --definitions # show available pythons | ||
|
||
script: | ||
- RESULT=0 | ||
# Compile our demo program which will crash if | ||
# the CRASH_PLEASE environment variable is set (to anything) | ||
- g++ -o test might_crash.cpp -g -O0 -DDEBUG | ||
# Run the program to prompt a crash | ||
# Note: we capture the return code of the program here and add | ||
# `|| true` to ensure that travis continues past the crash | ||
- RESULT=$(./test > /dev/null)$? || true | ||
- if [[ ${RESULT} == 0 ]]; then echo "\\o/ our test worked without problems"; else echo "ruhroh test returned an errorcode of $RESULT"; fi; | ||
# If the program returned an error code, now we check for a | ||
# core file in the current working directory and dump the backtrace out | ||
- for i in $(find ./ -maxdepth 1 -name 'core*' -print); do gdb $(pwd)/test core* -ex "thread apply all bt" -ex "set pagination 0" -batch; done; | ||
# now we should present travis with the original | ||
# error code so the run cleanly stops | ||
- if [[ ${RESULT} != 0 ]]; then exit $RESULT ; fi; | ||
- bash -c 'ulimit -Sc unlimited && source ./repro.sh' | ||
# Now we check for a core file and dump the backtrace out | ||
- > | ||
find -regex '.*/core\(\.[0-9]+\)?' | | ||
xargs -rn1 --verbose | ||
gdb $(which python) | ||
-ex "python import sys; sys.path.append('$PYTHON_GDBTOOLS'); import libpython; reload(libpython)" | ||
-ex "thread apply all py-bt" | ||
-ex "thread apply all bt" | ||
-batch |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/bash | ||
set -ex | ||
|
||
rm -rf clean | ||
mkdir clean | ||
cd clean/ | ||
virtualenv tmpvenv | ||
|
||
./tmpvenv/bin/pip install --upgrade pip wheel coverage | ||
./tmpvenv/bin/pip wheel coverage | ||
./tmpvenv/bin/python -m coverage.__main__ run -m pip install --no-index --ignore-installed --find-links wheelhouse/ coverage |