views:

253

answers:

3

I am building Python 2.6 4 from source on a Linux server and am experiencing a Segmentation Fault when running the tests (make test) (test_hashlib.py and test_hmac.py). When I opened the core dump file in gdb, I am told that the error is at 0x00002b73379ac446 in ??. I then recompiled python with both my CFLAGS and CPPFLAGS set to -g to enable debug symbols and reran the failing test. When I opened the core dump file in gdb, I got the same useless stuff as I got before enabling debug symbols. I then tried to run python within gdb, but go the same result.

Here is the script (install-python.sh) that I used to build and install Python:

#!/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}*

Does anyone know how to get a usable backtrace out of my hand-rolled Python?

A: 

Typically you need to set CFLAGS before calling ./configure - it is usually written to bake a CFLAGS value into the Makefile.

caf
I moved the CFLAGS and CPPFLAGS before the call to ./configure and recompiled, but still no backtraces.
Chris Lieb
A: 

How do you open core dump? I do it like this 'gdb .python core', where 'gdb' is gdb, '.python' is a binary file, that created the core, 'core' is the name of the 'core' file. When I open it like this 'gdb --core=core' I see the same as you, '??' instead of function name.

Graf
+1  A: 

Try passing the --with-pydebug option to configure.

Mark Dickinson