Skip to content

Debug numpy with gdb

Lu Yahan edited this page Apr 23, 2024 · 4 revisions

virtualenv

  1. source venv/bin/active

Build with debug info.

export CFLAGS="-O0 -g"
export CXXFLAGS="-O0 -g"
spin build --clean -- -Dbuildtype=debug

Install

  1. pip install -e . --no-build-isolation

  2. test.py

import numpy as np
x = np.arange(5)
np.empty_like(x)
  1. spin gdb ./test.py

  2. debug

(gdb) break array_empty_like
(gdb) run
Clone this wiki locally