Skip to content

Commit

Permalink
feat: show backtraces on macOS
Browse files Browse the repository at this point in the history
  • Loading branch information
XuehaiPan committed Nov 8, 2024
1 parent b73ddf2 commit b6b82eb
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions .github/workflows/tests-with-pydebug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -281,17 +281,28 @@ jobs:
shell: bash
run: |
if [[ -n "$(find . -iname "core.*.[1-9]*")" ]]; then
echo "Found core dumps:"
ls -alh $(find . -iname "core.*.[1-9]*")
BACKTRACE_COMMAND=""
if [[ "${{ runner.os }}" == 'Linux' ]]; then
echo "::group::Install GDB"
(
export DEBIAN_FRONTEND=noninteractive
sudo apt-get update -qq && sudo apt-get install -yqq gdb
)
echo "Found core dumps:"
ls -alh $(find . -iname "core.*.[1-9]*")
echo "::endgroup::"
BACKTRACE_COMMAND="gdb --exec ${{ env.PYTHON }} --core '{}' -ex 'bt' -ex 'q'"
elif [[ "${{ runner.os }}" == 'macOS' ]]; then
echo "::group::Install LLDB"
brew install llvm --quiet
echo "::endgroup::"
BACKTRACE_COMMAND="lldb --file ${{ env.PYTHON }} --core '{}' -o 'bt' -o 'q'"
fi
if [[ -n "${BACKTRACE_COMMAND}" ]]; then
echo "Collecting backtraces:"
find . -iname "core.*.[1-9]*" -exec bash -xc "
echo '::group::backtrace from: {}';
gdb ${{ env.PYTHON }} '{}' -ex 'backtrace' -ex 'quit';
${BACKTRACE_COMMAND};
echo '::endgroup::';
" ';'
fi
Expand Down

0 comments on commit b6b82eb

Please sign in to comment.