1{ interpreter, lib, gdb, writeText, runCommand }: 2 3let 4 crashme-py = writeText "crashme.py" '' 5 import ctypes 6 7 def sentinel_foo_bar(): 8 ctypes.memset(0, 1, 1) 9 10 sentinel_foo_bar() 11 ''; 12in runCommand "python-gdb" {} '' 13 # test that gdb is able to recover the python stack frame of this segfault 14 ${gdb}/bin/gdb -batch -ex 'set debug-file-directory ${interpreter.debug}/lib/debug' \ 15 -ex 'source ${interpreter}/share/gdb/libpython.py' \ 16 -ex r \ 17 -ex py-bt \ 18 --args ${interpreter}/bin/python ${crashme-py} | grep 'in sentinel_foo_bar' > /dev/null 19 20 # success. 21 touch $out 22''