On 7/29/19 12:52 AM, Austin Lund wrote:
Currently all debug builds will prefix /usr/src/build to the source paths. If debugging symbols are stripped into a separate package then these sources files are indeed in this path. But if the debug build is not stripped then one is left with a complex path rewriting to perform debugging. It's much easier to perform sensible path rewriting in this instance when the path is left untouched.
Signed-off-by: Austin Lund <austin.lund@gmail.com> --- scripts/libmakepkg/buildenv/debugflags.sh.in | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/scripts/libmakepkg/buildenv/debugflags.sh.in b/scripts/libmakepkg/buildenv/debugflags.sh.in index ce9c1556..ff715803 100644 --- a/scripts/libmakepkg/buildenv/debugflags.sh.in +++ b/scripts/libmakepkg/buildenv/debugflags.sh.in @@ -30,8 +30,10 @@ buildenv_functions+=('buildenv_debugflags')
buildenv_debugflags() { if check_option "debug" "y"; then - DEBUG_CFLAGS+=" -fdebug-prefix-map=$srcdir=${DBGSRCDIR:-/usr/src/debug}" - DEBUG_CXXFLAGS+=" -fdebug-prefix-map=$srcdir=${DBGSRCDIR:-/usr/src/debug}" + if check_option "strip" "y"; then
if check_option "debug" "y" && check_option "strip" "y";
+ DEBUG_CFLAGS+=" -fdebug-prefix-map=$srcdir=${DBGSRCDIR:-/usr/src/debug}" + DEBUG_CXXFLAGS+=" -fdebug-prefix-map=$srcdir=${DBGSRCDIR:-/usr/src/debug}" + fi CFLAGS+=" $DEBUG_CFLAGS" CXXFLAGS+=" $DEBUG_CXXFLAGS" fi
But I would expect if people wished to debug the build, they would use debug + strip -- the default is to strip and not debug, which is two negatives for debugging, so the user is clearly changing something, and relying on the source files for stepping through the debugger to be available after the build, is not the optimal move anyway. Depending on how you build, it may be in a regularly purged container, a tmpfs, or simply that makepkg -c will delete it The debug prefix map is also valued by people who do not wish build environment artifacts to be exposed in the final binaries. (Granted they may wish for -fmacro-prefix-map too, which makepkg does not handle.) ... Note that AFAIK it should be a simple matter of using set substitute-path in gdb to reverse the -fdebug-prefix-map in makepkg, so it's not all that complex anyway (but is package-specific). -- Eli Schwartz Bug Wrangler and Trusted User