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