ContinuumIO / anaconda-issues

Anaconda issue tracking
646 stars 220 forks source link

Conda 4.3.2 vs Conda 5.3 and c/c++ extension debugging with gdb #10659

Open ocrush1 opened 5 years ago

ocrush1 commented 5 years ago

Actual Behavior

I have a c/c++ extension that is called from Python and in the past I was able to use gdb to set a break point in my c/c++ extension code and use "py-bt" to see the Python backtrace. However, Anaconda 5.3 (Python 2.7) does not allow me to do so.

everything worked fine with Anaconda 4.3.2. Any ideas on what might have changed between these versions? It may be optimization flags, etc. Any plans to support such a use case in the future?

output from 5.3: Breakpoint 1, sum (num=6, num_array=0x555555c5dd80) at ../../src/test_ctypes_numpy.c:7 7 for (i=0;i < num;i++) (gdb) py-bt

6 (unable to read python frame information)

7 (unable to read python frame information)

Expected Behavior

output from 4.3.2: Breakpoint 1, sum (num=6, num_array=0xa041a0) at ../../src/test_ctypes_numpy.c:7 7 for (i=0;i < num;i++) (gdb) py-bt

9 Frame 0x7fffeec59230, for file test_sum.py, line 18, in py_sum (numbers=<numpy.ndarray at remote 0x7ffff7e1ab70>, num_numbers=6)

result = _sum.sum(ctypes.c_int(num_numbers), numbers.ctypes.data_as(ctypes.POINTER(ctypes.c_double)))

12 (frame information optimized out)

Steps to Reproduce

Create a simple C/C++ extension and call via Python

Anaconda or Miniconda version:

Anaconda 5.3

Operating System:

Ubuntu1404

conda info
active environment : None
       user config file : /home/.condarc
 populated config files : /home/.condarc
          conda version : 4.5.11
    conda-build version : 3.15.1
         python version : 2.7.15.final.0
       base environment : /anaconda2_5.3  (writable)
           channel URLs : https://conda.anaconda.org/intel/linux-64
                          https://conda.anaconda.org/intel/noarch
                          https://repo.anaconda.com/pkgs/main/linux-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/free/linux-64
                          https://repo.anaconda.com/pkgs/free/noarch
                          https://repo.anaconda.com/pkgs/r/linux-64
                          https://repo.anaconda.com/pkgs/r/noarch
                          https://repo.anaconda.com/pkgs/pro/linux-64
                          https://repo.anaconda.com/pkgs/pro/noarch
          package cache : /home/anaconda2_5.3/pkgs
                          /home/.conda/pkgs
       envs directories : /home/anaconda2_5.3/envs
                          /home/.conda/envs
               platform : linux-64
             user-agent : conda/4.5.11 requests/2.19.1 CPython/2.7.15 Linux/3.13.0-24-generic ubuntu/14.04 glibc/2.19
                UID:GID : 5137:59
             netrc file : None
           offline mode : False
conda list --show-channel-urls
# packages in environment at /home/jsingh/anaconda2_5.3:
#
# Name                    Version                   Build  Channel
_ipyw_jlab_nb_ext_conf    0.1.0                    py27_0    defaults
alabaster                 0.7.11                   py27_0    defaults
anaconda                  5.3.0                    py27_0    defaults
anaconda-client           1.7.2                    py27_0    defaults
anaconda-navigator        1.9.2                    py27_0    defaults
anaconda-project          0.8.2                    py27_0    defaults
appdirs                   1.4.3            py27h28b3542_0    defaults
asn1crypto                0.24.0                   py27_0    defaults
astroid                   1.6.5                    py27_0    defaults
astropy                   2.0.8            py27h035aef0_0    defaults
atomicwrites              1.2.1                    py27_0    defaults
attrs                     18.2.0           py27h28b3542_0    defaults
automat                   0.7.0                    py27_0    defaults
babel                     2.6.0                    py27_0    defaults
backports                 1.0                      py27_1    defaults
backports.functools_lru_cache 1.5                      py27_1    defaults
backports.shutil_get_terminal_size 1.0.0                    py27_2    defaults
backports_abc             0.5                      py27_0    defaults
beautifulsoup4            4.6.3                    py27_0    defaults
bitarray                  0.8.3            py27h14c3975_0    defaults
bkcharts                  0.2                      py27_0    defaults
blas                      1.0                         mkl    defaults
blaze                     0.11.3                   py27_0    defaults
bleach                    2.1.4                    py27_0    defaults
blosc                     1.14.4               hdbcaa40_0    defaults
bokeh                     0.13.0                   py27_0    defaults
boto                      2.49.0                   py27_0    defaults
bottleneck                1.2.1            py27h035aef0_1    defaults
bzip2                     1.0.6                h14c3975_5    defaults
ca-certificates           2018.03.07                    0    defaults
cairo                     1.14.12              h8948797_3    defaults
cdecimal                  2.3              py27h14c3975_3    defaults
certifi                   2018.8.24                py27_1    defaults
cffi                      1.11.5           py27he75722e_1    defaults
chardet                   3.0.4                    py27_1    defaults
click                     6.7                      py27_0    defaults
cloudpickle               0.5.5                    py27_0    defaults
clyent                    1.2.2                    py27_1    defaults
colorama                  0.3.9                    py27_0    defaults
conda                     4.5.11                   py27_0    defaults
conda-build               3.15.1                   py27_0    defaults
conda-env                 2.6.0                         1    defaults
configparser              3.5.0                    py27_0    defaults
constantly                15.1.0           py27h28b3542_0    defaults
contextlib2               0.5.5                    py27_0    defaults
cryptography              2.3.1            py27hc365091_0    defaults
curl                      7.61.0               h84994c4_0    defaults
cycler                    0.10.0                   py27_0    defaults
cython                    0.28.5           py27hf484d3e_0    defaults
cytoolz                   0.9.0.1          py27h14c3975_1    defaults
dask                      0.19.1                   py27_0    defaults
dask-core                 0.19.1                   py27_0    defaults
datashape                 0.5.4                    py27_1    defaults
dbus                      1.13.2               h714fa37_1    defaults
decorator                 4.3.0                    py27_0    defaults
defusedxml                0.5.0                    py27_1    defaults
distributed               1.23.1                   py27_0    defaults
docutils                  0.14                     py27_0    defaults
entrypoints               0.2.3                    py27_2    defaults
enum34                    1.1.6                    py27_1    defaults
et_xmlfile                1.0.1                    py27_0    defaults
expat                     2.2.6                he6710b0_0    defaults
fastcache                 1.0.2            py27h14c3975_2    defaults
filelock                  3.0.8                    py27_0    defaults
flask                     1.0.2                    py27_1    defaults
flask-cors                3.0.6                    py27_0    defaults
fontconfig                2.13.0               h9420a91_0    defaults
freetype                  2.9.1                h8a8886c_1    defaults
fribidi                   1.0.5                h7b6447c_0    defaults
funcsigs                  1.0.2                    py27_0    defaults
functools32               3.2.3.2                  py27_1    defaults
futures                   3.2.0                    py27_0    defaults
get_terminal_size         1.0.0                haa9412d_0    defaults
gevent                    1.3.6            py27h7b6447c_0    defaults
glib                      2.56.2               hd408876_0    defaults
glob2                     0.6                      py27_0    defaults
gmp                       6.1.2                h6c8ec71_1    defaults
gmpy2                     2.0.8            py27h10f8cd9_2    defaults
graphite2                 1.3.12               h23475e2_2    defaults
greenlet                  0.4.15           py27h7b6447c_0    defaults
grin                      1.2.1                    py27_4    defaults
gst-plugins-base          1.14.0               hbbd80ab_1    defaults
gstreamer                 1.14.0               hb453b48_1    defaults
h5py                      2.8.0            py27h989c5e5_3    defaults
harfbuzz                  1.8.8                hffaf4a1_0    defaults
hdf5                      1.10.2               hba1933b_1    defaults
heapdict                  1.0.0                    py27_2    defaults
html5lib                  1.0.1                    py27_0    defaults
hyperlink                 18.0.0                   py27_0    defaults
icu                       58.2                 h9c2bf20_1    defaults
idna                      2.7                      py27_0    defaults
imageio                   2.4.1                    py27_0    defaults
imagesize                 1.1.0                    py27_0    defaults
incremental               17.5.0                   py27_0    defaults
intel-openmp              2019.0                      118    defaults
ipaddress                 1.0.22                   py27_0    defaults
ipykernel                 4.9.0                    py27_1    defaults
ipython                   5.8.0                    py27_0    defaults
ipython_genutils          0.2.0                    py27_0    defaults
ipywidgets                7.4.1                    py27_0    defaults
isort                     4.3.4                    py27_0    defaults
itsdangerous              0.24                     py27_1    defaults
jbig                      2.1                  hdba287a_0    defaults
jdcal                     1.4                      py27_0    defaults
jedi                      0.12.1                   py27_0    defaults
jinja2                    2.10                     py27_0    defaults
jpeg                      9b                   h024ee3a_2    defaults
jsonschema                2.6.0                    py27_0    defaults
jupyter                   1.0.0                    py27_7    defaults
jupyter_client            5.2.3                    py27_0    defaults
jupyter_console           5.2.0                    py27_1    defaults
jupyter_core              4.4.0                    py27_0    defaults
jupyterlab                0.33.11                  py27_0    defaults
jupyterlab_launcher       0.11.2           py27h28b3542_0    defaults
kiwisolver                1.0.1            py27hf484d3e_0    defaults
lazy-object-proxy         1.3.1            py27h14c3975_2    defaults
libcurl                   7.61.0               h1ad7b7a_0    defaults
libedit                   3.1.20170329         h6b74fdf_2    defaults
libffi                    3.2.1                hd88cf55_4    defaults
libgcc-ng                 8.2.0                hdf63c60_1    defaults
libgfortran-ng            7.3.0                hdf63c60_0    defaults
libpng                    1.6.34               hb9fc6fc_0    defaults
libsodium                 1.0.16               h1bed415_0    defaults
libssh2                   1.8.0                h9cfc8f7_4    defaults
libstdcxx-ng              8.2.0                hdf63c60_1    defaults
libtiff                   4.0.9                he85c1e1_2    defaults
libtool                   2.4.6                h544aabb_3    defaults
libuuid                   1.0.3                h1bed415_2    defaults
libxcb                    1.13                 h1bed415_1    defaults
libxml2                   2.9.8                h26e45fe_1    defaults
libxslt                   1.1.32               h1312cb7_0    defaults
linecache2                1.0.0                    py27_0    defaults
llvmlite                  0.24.0           py27hdbcaa40_0    defaults
locket                    0.2.0                    py27_1    defaults
lxml                      4.2.5            py27hefd8a0e_0    defaults
lzo                       2.10                 h49e0be7_2    defaults
markupsafe                1.0              py27h14c3975_1    defaults
matplotlib                2.2.3            py27hb69df0a_0    defaults
mccabe                    0.6.1                    py27_1    defaults
mistune                   0.8.3            py27h14c3975_1    defaults
mkl                       2019.0                      118    defaults
mkl-service               1.1.2            py27h90e4bf4_5    defaults
mkl_fft                   1.0.4            py27h4414c95_1    defaults
mkl_random                1.0.1            py27h4414c95_1    defaults
more-itertools            4.3.0                    py27_0    defaults
mpc                       1.1.0                h10f8cd9_1    defaults
mpfr                      4.0.1                hdf1c602_3    defaults
mpmath                    1.0.0                    py27_2    defaults
msgpack-python            0.5.6            py27h6bb024c_1    defaults
multipledispatch          0.6.0                    py27_0    defaults
navigator-updater         0.2.1                    py27_0    defaults
nbconvert                 5.4.0                    py27_1    defaults
nbformat                  4.4.0                    py27_0    defaults
ncurses                   6.1                  hf484d3e_0    defaults
networkx                  2.1                      py27_0    defaults
nltk                      3.3.0                    py27_0    defaults
nose                      1.3.7                    py27_2    defaults
notebook                  5.6.0                    py27_0    defaults
numba                     0.39.0           py27h04863e7_0    defaults
numexpr                   2.6.8            py27hd89afb7_0    defaults
numpy                     1.15.1           py27h1d66e8a_0    defaults
numpy-base                1.15.1           py27h81de0dd_0    defaults
numpydoc                  0.8.0                    py27_0    defaults
odo                       0.5.1                    py27_0    defaults
olefile                   0.46                     py27_0    defaults
openpyxl                  2.5.6                    py27_0    defaults
openssl                   1.0.2p               h14c3975_0    defaults
packaging                 17.1                     py27_0    defaults
pandas                    0.23.4           py27h04863e7_0    defaults
pandoc                    1.19.2.1             hea2e7c5_1    defaults
pandocfilters             1.4.2                    py27_1    defaults
pango                     1.42.4               h049681c_0    defaults
parso                     0.3.1                    py27_0    defaults
partd                     0.3.8                    py27_0    defaults
patchelf                  0.9                  hf484d3e_2    defaults
path.py                   11.1.0                   py27_0    defaults
pathlib2                  2.3.2                    py27_0    defaults
patsy                     0.5.0                    py27_0    defaults
pcre                      8.42                 h439df22_0    defaults
pep8                      1.7.1                    py27_0    defaults
pexpect                   4.6.0                    py27_0    defaults
pickleshare               0.7.4                    py27_0    defaults
pillow                    5.2.0            py27heded4f4_0    defaults
pip                       10.0.1                   py27_0    defaults
pixman                    0.34.0               hceecf20_3    defaults
pkginfo                   1.4.2                    py27_1    defaults
pluggy                    0.7.1            py27h28b3542_0    defaults
ply                       3.11                     py27_0    defaults
prometheus_client         0.3.1            py27h28b3542_0    defaults
prompt_toolkit            1.0.15                   py27_0    defaults
psutil                    5.4.7            py27h14c3975_0    defaults
ptyprocess                0.6.0                    py27_0    defaults
py                        1.6.0                    py27_0    defaults
pyasn1                    0.4.4            py27h28b3542_0    defaults
pyasn1-modules            0.2.2                    py27_0    defaults
pycairo                   1.17.1           py27h2a1e443_0    defaults
pycodestyle               2.4.0                    py27_0    defaults
pycosat                   0.6.3            py27h14c3975_0    defaults
pycparser                 2.18                     py27_1    defaults
pycrypto                  2.6.1            py27h14c3975_9    defaults
pycurl                    7.43.0.2         py27hb7f436b_0    defaults
pyflakes                  2.0.0                    py27_0    defaults
pygments                  2.2.0                    py27_0    defaults
pylint                    1.9.2                    py27_0    defaults
pyodbc                    4.0.24           py27he6710b0_0    defaults
pyopenssl                 18.0.0                   py27_0    defaults
pyparsing                 2.2.0                    py27_1    defaults
pyqt                      5.9.2            py27h05f1152_2    defaults
pysocks                   1.6.8                    py27_0    defaults
pytables                  3.4.4            py27ha205bf6_0    defaults
pytest                    3.8.0                    py27_0    defaults
python                    2.7.15               h1571d57_0    defaults
python-dateutil           2.7.3                    py27_0    defaults
pytz                      2018.5                   py27_0    defaults
pywavelets                1.0.0            py27hdd07704_0    defaults
pyyaml                    3.13             py27h14c3975_0    defaults
pyzmq                     17.1.2           py27h14c3975_0    defaults
qt                        5.9.6                h8703b6f_2    defaults
qtawesome                 0.4.4                    py27_0    defaults
qtconsole                 4.4.1                    py27_0    defaults
qtpy                      1.5.0                    py27_0    defaults
readline                  7.0                  h7b6447c_5    defaults
requests                  2.19.1                   py27_0    defaults
rope                      0.11.0                   py27_0    defaults
ruamel_yaml               0.15.46          py27h14c3975_0    defaults
scandir                   1.9.0            py27h14c3975_0    defaults
scikit-image              0.14.0           py27hf484d3e_1    defaults
scikit-learn              0.19.2           py27h4989274_0    defaults
scipy                     1.1.0            py27hfa4b5c9_1    defaults
seaborn                   0.9.0                    py27_0    defaults
send2trash                1.5.0                    py27_0    defaults
service_identity          17.0.0           py27h28b3542_0    defaults
setuptools                40.2.0                   py27_0    defaults
simplegeneric             0.8.1                    py27_2    defaults
singledispatch            3.4.0.3                  py27_0    defaults
sip                       4.19.8           py27hf484d3e_0    defaults
six                       1.11.0                   py27_1    defaults
snappy                    1.1.7                hbae5bb6_3    defaults
snowballstemmer           1.2.1                    py27_0    defaults
sortedcollections         1.0.1                    py27_0    defaults
sortedcontainers          2.0.5                    py27_0    defaults
sphinx                    1.7.9                    py27_0    defaults
sphinxcontrib             1.0                      py27_1    defaults
sphinxcontrib-websupport  1.1.0                    py27_1    defaults
spyder                    3.3.1                    py27_1    defaults
spyder-kernels            0.2.6                    py27_0    defaults
sqlalchemy                1.2.11           py27h7b6447c_0    defaults
sqlite                    3.24.0               h84994c4_0    defaults
ssl_match_hostname        3.5.0.1                  py27_2    defaults
statsmodels               0.9.0            py27h035aef0_0    defaults
subprocess32              3.5.2            py27h14c3975_0    defaults
sympy                     1.2                      py27_0    defaults
tblib                     1.3.2                    py27_0    defaults
terminado                 0.8.1                    py27_1    defaults
testpath                  0.3.1                    py27_0    defaults
tk                        8.6.8                hbc83047_0    defaults
toolz                     0.9.0                    py27_0    defaults
tornado                   5.1              py27h14c3975_0    defaults
tqdm                      4.26.0           py27h28b3542_0    defaults
traceback2                1.4.0                    py27_0    defaults
traitlets                 4.3.2                    py27_0    defaults
twisted                   18.7.0           py27h14c3975_1    defaults
typing                    3.6.6                    py27_0    defaults
unicodecsv                0.14.1                   py27_0    defaults
unittest2                 1.1.0                    py27_0    defaults
unixodbc                  2.3.7                h14c3975_0    defaults
urllib3                   1.23                     py27_0    defaults
wcwidth                   0.1.7                    py27_0    defaults
webencodings              0.5.1                    py27_1    defaults
werkzeug                  0.14.1                   py27_0    defaults
wheel                     0.31.1                   py27_0    defaults
widgetsnbextension        3.4.1                    py27_0    defaults
wrapt                     1.10.11          py27h14c3975_2    defaults
xlrd                      1.1.0                    py27_1    defaults
xlsxwriter                1.1.0                    py27_0    defaults
xlwt                      1.3.0                    py27_0    defaults
xz                        5.2.4                h14c3975_4    defaults
yaml                      0.1.7                had09818_2    defaults
zeromq                    4.2.5                hf484d3e_1    defaults
zict                      0.1.3                    py27_0    defaults
zlib                      1.2.11               ha838bed_2    defaults
zope                      1.0                      py27_1    defaults
zope.interface            4.5.0            py27h14c3975_0    defaults
ocrush1 commented 5 years ago

few comments from community discussion. see https://groups.google.com/a/continuum.io/forum/#!mydiscussions/anaconda/NgrSLn11Znk

Reply from Ray Donnelly: You'd be best off filing a bug for this at https://github.com/ContinuumIO/anaconda-issues/issues so we can keep track of it. Please copy in the conversation so far if you elect to do that.

The Anaconda Python's are not currently built with this use-case in mind. That it worked before was a fluke I suspect, in that AD 4.3.2 Python was more compatible with your system Python than AD 5.3.x Python is.

We are missing e.g. python3.6-gdb.py and really need to use our own gdb compiled against our Python. You may want to test and/or contribute towards the gdb package over at https://github.com/conda-forge/gdb-feedstock. You'll need to track down that python3.6-gdb.py from somewhere though I think. If you wanted to fix our packaging but that's causing that file not to be present (it should live at bin/pythonX.X-gdb.py) then a PR to https://github.com/AnacondaRecipes/python-feedstock (or https://github.com/conda-forge/python-feedstock) would be very welcome.

I'm not sure if the Python interpreter needs to be built with --with-PyDebug though, I know back when I was hacking on mingw-w64/python that was necessary. These days I'm not sure, but I'd definitely like to know where we stand and am very interested in making this work as well as we can.