LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   Is a there general method to segregate debugging symbols in Slackware packages? (https://www.linuxquestions.org/questions/slackware-14/is-a-there-general-method-to-segregate-debugging-symbols-in-slackware-packages-714653/)

Shingoshi 03-26-2009 02:40 PM

Is a there general method to segregate debugging symbols in Slackware packages?
 
I'm needing to know if there is a standard method for creating debug packages in Slackware. If there is, would someone please post the code here on how to do it for all packages. I want to be able to create debug packages for every package I build. I'm particularly interested in a means to replace the strip function that is commonly used in SlackBuilds.

Thank you,
Xavian-Anderson Macpherson
Shingoshi

Alien_Hominid 03-26-2009 02:48 PM

Packages have their own debug configuration options.

Don't use optimizations especially -fomit-frame-pointer.

Shingoshi 03-26-2009 03:07 PM

Not concerned with package configurations...
 
Quote:

Originally Posted by Alien_Hominid (Post 3488760)
Packages have their own debug configuration options.

Don't use optimizations especially -fomit-frame-pointer.

I'm only interested in what to do AFTER the debugging symbols have been created in the main package. I want to know the best means to move them from the main package, to a separate package, $NAME-debug-$VERSION-$ARCH-$BUILD.tgz.

Xavian-Anderson Macpherson
Shingoshi

bgeddy 03-26-2009 04:10 PM

Just a quick script to create seperate debugging tables :
Code:

#!/bin/sh
program="$1"
gcc -g "$program.c" -o "$program"
strip "$program" --only-keep-debug -o "$program".dbg
strip $program

This will leave the symbolic debugging information in the file called basename.dbg and create an executable basename which has no debugging information. The same techniques or an alias could be supplied to make the script run for a slackbuild.

Shingoshi 03-26-2009 07:43 PM

How would this work in a SlackBuild??
 
Quote:

Originally Posted by bgeddy (Post 3488832)
Just a quick script to create seperate debugging tables :
Code:

#!/bin/sh
program="$1"
## I think this line below is already taken care in building Slackware packages.
gcc -g "$program.c" -o "$program"
## These are the two following lines which I think are actually helpful.
strip "$program" --only-keep-debug -o "$program".dbg
strip $program

This will leave the symbolic debugging information in the file called basename.dbg and create an executable basename which has no debugging information.
## ^^ I think this is what I was asking for. But see my questions below for clarification. ^^
The same techniques or an alias could be supplied to make the script run for a slackbuild.

What I want is two files (packages). One would be ${name}, and the second would be ${name}-debug. I want to create my main package in /tmp/package-${name}, and then move (mv) all of the symbols to the separate package tree in /tmp/package-${name}-debug.
While ensuring that the files are in a package format that could be properly used. Essentially, I want to copy the way things are done with Redhat/Fedora debug packages.

I'm not certain how to do this in a SlackBuild, since typically, gcc is not called directly. Is there a "make -g" that will achieve the same thing? Typically in SlackBuilds, you have to strip the symbols AFTER they are created. These are the lines of code that are used for this:

This was taken from glibc.SlackBuild:
# The prevailing standard seems to be putting unstripped libraries in
# /usr/lib/debug/ and stripping the debugging symbols from all the other
# libraries.
mkdir -p $PKG/usr/lib${LIBSUFFIX}/debug
cp -a $PKG/lib${LIBSUFFIX}/l*.so* $PKG/usr/lib${LIBSUFFIX}/debug
cp -a $PKG/usr/lib${LIBSUFFIX}/*.a $PKG/usr/lib${LIBSUFFIX}/debug
# Don't need debug+profile:
( cd $PKG/usr/lib${LIBSUFFIX}/debug ; rm -f *_p.* )
# NOTE: Is there really a reason for the glibc-debug package?
# If you're debugging glibc, you can also compile it, right?

## COMMENTED OUT: There's no reason for profile libs to include -g information.
## Put back unstripped profiling libraries:
#mv $PKG/usr/lib/debug/*_p.a $PKG/usr/lib
# It might be best to put the unstripped and profiling libraries in glibc-debug and glibc-profile.

# I don't think "strip -g" causes the pthread problems. It's --strip-unneeded that does.
strip -g $PKG/lib${LIBSUFFIX}/l*.so*
strip -g $PKG/usr/lib${LIBSUFFIX}/l*.so*
strip -g $PKG/usr/lib${LIBSUFFIX}/lib*.a

And a few lines later, this shows up:
# Strip most binaries:
( cd $PKG
find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip -g 2> /dev/null
)
## That paragraph above is commonly repeated in most of the SlackBuilds I've seen.

I'm wanting to know how to create a separate package from all these files that strip is used to find and delete.

Xavian-Anderson Macpherson
Shingoshi

gnashley 03-27-2009 12:41 PM

Thought you'd be interested in this thread:
http://www.linuxquestions.org/questi...1/#post3489783

Shingoshi 03-27-2009 05:10 PM

Gnashley, Thanks...
 
Quote:

Originally Posted by gnashley (Post 3489804)
Thought you'd be interested in this thread:
http://www.linuxquestions.org/questi...1/#post3489783

That link was very encouraging. So I won't see any real overhead on running my binaries. And thanks for the email. Putting
Code:

[[ $EXTRA_FLAGS ]] || EXTRA_FLAGS="-g"
in src2pkg.conf will definitely help.

Xavian-Anderson Macpherson
Shingoshi

Shingoshi 03-27-2009 08:15 PM

Does this work as a general solution?
 
I've created a file in /etc/profile.d/gcc.sh.

In this file, I've put the two following lines:
Code:

export CXX="/usr/bin/g++ -g -pipe"
export CC="/usr/bin/gcc -g -pipe

"
Will this fix the compilations system-wide, providing the debug symbols I want?

Xavian-Anderson Macpherson
Shingoshi


All times are GMT -5. The time now is 08:52 PM.