[pacman-dev] [PATCH] makepkg: Only change debug prefix if making debug package

Austin Lund austin.lund at gmail.com
Tue Jul 30 04:57:38 UTC 2019


On Mon, 29 Jul 2019 at 15:37, Eli Schwartz <eschwartz at archlinux.org> wrote:
>
> 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 at 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

There are a handful of packages that force !strip (e.g. glibc,
firefox, bash).  The current prefix rewriting to /usr/src/debug
essentially ensures a symbol lookup failure when compiling with debug
enabled for these packages (unless you build in /usr/src/debug).  The
gcc substitute path can only handle one FROM path hence you cannot
simultaneously get symbols for these packages.

Would a relative path for the debug !strip case make more sense?  In
that instance gdb could be configured using "set directories" to
resolve to the build sources should they not be purged.


More information about the pacman-dev mailing list