conda-forge / gdb-feedstock

A conda-smithy repository for gdb.
BSD 3-Clause "New" or "Revised" License
17 stars 62 forks source link

--with-separate-debug-dir="$PREFIX/lib/debug:/usr/lib/debug" #11

Open mingwandroid opened 6 years ago

mingwandroid commented 6 years ago

Hi @isuruf, @gqmelo, @msarahan, @nehaljwani, @jjhelmus, @conda-forge/core

It would be nice if AD could provide GDB (someone ran into trouble using, I guess, their system GDB recently on the Anaconda Community mailing list).

I think we may want to align the subject line with:

https://github.com/AnacondaRecipes/aggregate/blob/master/ctng-compilers-activation-feedstock/recipe/activate-gcc.sh#L87

CFLAGS_USED=" .. -fdebug-prefix-map=\${SRC_DIR}=/usr/local/src/conda/\${PKG_NAME}-\${PKG_VERSION} -fdebug-prefix-map=\${PREFIX}=/usr/local/src/conda-prefix"

My plan was to modify (I think it exists, never tried it!) conda-debug so you can pass it a package tarball or a package name in the current env and it unpacks the source code, applies patches and launches gdb (optionally).

I selected /usr/local/src but some have stated a preference for /opt/conda/src or something like that. The problem as I see it is that we don't really want a path that's in the prefix, as that would risk serious clobbering opportunities. Also, I am not really confident that we can do binary prefix replacement inside some (seperated by now, hopefully) debug information, therefore I think a fixed path is safer and easier (yes, gdb can remap source paths but it's a pain in the you know what and debugging needs to be as easy as we can make it .. I am willing to cencede that requiring things to get put in an absolute path isn't going to be possible for everyone, on that point could/should we use /tmp/conda/src instead?)

Also, we need to be packaging bin/pythonX.X-gdb.py in our python builds.

gqmelo commented 6 years ago

Hi @mingwandroid,

It would be great to have an out-of-the-box debugging solution. Initially I set --with-separate-debug-dir this way just because I wanted to add /usr/lib/debug, which is the path used by most Linux distros. This made it possible to use conda-forge's gdb to debug system's python. Sometimes this may be desirable when you are working on an old system or where you can't install gdb system-wise. And $PREFIX/lib/debug was added just because it is gdb's default when --with-separate-debug-dir is not given.

So I think it would be good to keep both paths, but I totally agree with adding other ones that can be used to unpack conda sources.

But if you don't want to remap source paths in gdb, you have to always build packages in one of the paths you mentioned (/usr/local/src or /opt/conda/src), right? Do you plan to change the build path (in the docker image, for example)?

mingwandroid commented 6 years ago

But if you don't want to remap source paths in gdb, you have to always build packages in one of the paths you mentioned

No, this is fixed via debug-prefix remapping. This is specifically to avoid the issue with build paths being somewhat random.

If you want to debug a build you should create symlinks to the work directory. I'll figure out some conda-build debug stuff to

I'm not sure which way to go, /opt/conda/src is my new preferred directory for this remap.. I do want a great debugging experience fwiw! Conda build will need some new additions to do the symlinks for you.