调试Python崩溃

时间:2010-03-04 00:12:59

标签: python linux debugging gdb

我正在Linux服务器上从源代码构建Python 2.6 4,并且在运行测试(make test)时遇到了分段错误(test_hashlib.py和test_hmac.py)。当我在gdb中打开核心转储文件时,我被告知错误发生在0x00002b73379ac446 in ??。然后我重新编译python,我的CFLAGS和CPPFLAGS都设置为-g以启用调试符号并重新启动失败的测试。当我在gdb中打开核心转储文件时,我获得了与启用调试符号之前相同的无用内容。然后我尝试在gdb中运行python,但是得到相同的结果。

这是我用来构建和安装Python的脚本(install-python.sh):

#!/bin/sh

VER=2.6.4

wget http://www.python.org/ftp/python/${VER}/Python-${VER}.tar.bz2
tar -xjf Python-${VER}.tar.bz2
cd Python-${VER}
export CFLAGS="-g"
export CPPFLAGS="${CFLAGS}"
./configure --prefix=${HOME}/packages/python --exec-prefix=${HOME}/packages/python
make && make test
make install
cd ..
#rm -rf Python-${VER}*

有谁知道如何从我的手动Python中获取可用的回溯?

1 个答案:

答案 0 :(得分:0)

通常,您需要在调用CFLAGS之前设置./configure - 通常会将其编写为将CFLAGS值烘焙到Makefile