Pythonのセグメンテーションフォルトをどのようにデバッグできますか?Pythonセグメンテーションフォールトをデバッグする方法は?
私たちはSuSE 12.3でPythonコードを実行しようとしています。我々は再現可能なセグメンテーション障害を得る。 Pythonコードは、何年もの間、セグメンテーション障害のない他のプラットフォームで動作しています。
我々は唯一のコードはPython、Cなし拡張子....
これをデバッグするための最良の方法は何ですか? Pythonの2.7.5は、セグメンテーションフォールトがインタプリタシャットダウン時に起こる
更新
....私は、ビットのANSI Cを知っているが、それは10年前のことでした。
私は、スクリプトを複数回実行することができます:私はCTRL-DでPDBを残す場合
python -m pdb myscript.py arg1 arg1
continue
run
continue
run
しかし、セグメンテーションフォルトが起こります。
アップデート2
私は今、GDBでそれをデバッグしよう:
gdb
> file python
> run myscript.py arg1 arg2
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffefbe2700 (LWP 15483)]
0x00007ffff7aef93c in PyEval_EvalFrameEx() from /usr/lib64/libpython2.7.so.1.0
(gdb) bt
#0 0x00007ffff7aef93c in PyEval_EvalFrameEx() from /usr/lib64/libpython2.7.so.1.0
#1 0x00007ffff7af5303 in PyEval_EvalCodeEx() from /usr/lib64/libpython2.7.so.1.0
#2 0x00007ffff7adc858 in ??() from /usr/lib64/libpython2.7.so.1.0
#3 0x00007ffff7ad840d in PyObject_Call() from /usr/lib64/libpython2.7.so.1.0
#4 0x00007ffff7af1082 in PyEval_EvalFrameEx() from /usr/lib64/libpython2.7.so.1.0
#5 0x00007ffff7af233d in PyEval_EvalFrameEx() from /usr/lib64/libpython2.7.so.1.0
#6 0x00007ffff7af233d in PyEval_EvalFrameEx() from /usr/lib64/libpython2.7.so.1.0
#7 0x00007ffff7af5303 in PyEval_EvalCodeEx() from /usr/lib64/libpython2.7.so.1.0
#8 0x00007ffff7adc5b6 in ??() from /usr/lib64/libpython2.7.so.1.0
#9 0x00007ffff7ad840d in PyObject_Call() from /usr/lib64/libpython2.7.so.1.0
#10 0x00007ffff7ad9171 in ??() from /usr/lib64/libpython2.7.so.1.0
#11 0x00007ffff7ad840d in PyObject_Call() from /usr/lib64/libpython2.7.so.1.0
#12 0x00007ffff7aeeb62 in PyEval_CallObjectWithKeywords() from /usr/lib64/libpython2.7.so.1.0
#13 0x00007ffff7acc757 in ??() from /usr/lib64/libpython2.7.so.1.0
#14 0x00007ffff7828e0f in start_thread() from /lib64/libpthread.so.0
#15 0x00007ffff755c7dd in clone() from /lib64/libc.so.6
アップデート3
私はhttp://download.opensuse.org/debug/distribution/12.3/repo/oss/suse/x86_64/
からhttp://hg.python.org/cpython/file/default/Misc/gdbinit からgdbinitとデバッグシンボルをインストール(gdb) pystack
No symbol "_PyUnicode_AsString" in current context.
今は何ですか?
更新4 新しいRPM(python-2.7.5-3.1.x86_64)をインストールしました。セグメンテーションは少なくなりますが、それでも起こります。
http://download.opensuse.org/repositories/devel:/languages:/python:/Factory/openSUSE_12.3/x86_64/
更新5 は私の最初の問題解決:ここ は、リポジトリへのリンクです
それはhttp://bugs.python.org/issue1856(シャットダウン(終了)ハングまたはデーモンスレッドが実行されているとセグメンテーションフォールトができます)
ました関連:Detect Interpreter shut down in daemon thread
私はまた、私のアプリケーションを閉じるときにsegfaultを取得しています。どのようにPython 2.7のこのバグを修正するには? – Patrick
@Patrick See http://stackoverflow.com/a/18099067/633961 – guettli