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