LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices

Reply
 
Search this Thread
Old 03-26-2009, 02:40 PM   #1
Shingoshi
Member
 
Registered: Oct 2006
Location: Cochise County, Arizona
Distribution: Gentoo-AMD64 / Slackware64-Current
Posts: 474
Blog Entries: 28

Rep: Reputation: 34
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
 
Old 03-26-2009, 02:48 PM   #2
Alien_Hominid
Senior Member
 
Registered: Oct 2005
Location: Lithuania
Distribution: Hybrid
Posts: 2,247

Rep: Reputation: 53
Packages have their own debug configuration options.

Don't use optimizations especially -fomit-frame-pointer.
 
Old 03-26-2009, 03:07 PM   #3
Shingoshi
Member
 
Registered: Oct 2006
Location: Cochise County, Arizona
Distribution: Gentoo-AMD64 / Slackware64-Current
Posts: 474
Blog Entries: 28

Original Poster
Rep: Reputation: 34
Not concerned with package configurations...

Quote:
Originally Posted by Alien_Hominid View Post
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
 
Old 03-26-2009, 04:10 PM   #4
bgeddy
Senior Member
 
Registered: Sep 2006
Location: Liverpool - England
Distribution: slackware64 13.37 and -current, Dragonfly BSD
Posts: 1,810

Rep: Reputation: 227Reputation: 227Reputation: 227
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.
 
Old 03-26-2009, 07:43 PM   #5
Shingoshi
Member
 
Registered: Oct 2006
Location: Cochise County, Arizona
Distribution: Gentoo-AMD64 / Slackware64-Current
Posts: 474
Blog Entries: 28

Original Poster
Rep: Reputation: 34
How would this work in a SlackBuild??

Quote:
Originally Posted by bgeddy View Post
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
 
Old 03-27-2009, 12:41 PM   #6
gnashley
Amigo developer
 
Registered: Dec 2003
Location: Germany
Distribution: Slackware
Posts: 4,752

Rep: Reputation: 462Reputation: 462Reputation: 462Reputation: 462Reputation: 462
Thought you'd be interested in this thread:
http://www.linuxquestions.org/questi...1/#post3489783
 
Old 03-27-2009, 05:10 PM   #7
Shingoshi
Member
 
Registered: Oct 2006
Location: Cochise County, Arizona
Distribution: Gentoo-AMD64 / Slackware64-Current
Posts: 474
Blog Entries: 28

Original Poster
Rep: Reputation: 34
Gnashley, Thanks...

Quote:
Originally Posted by gnashley View Post
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

Last edited by Shingoshi; 03-27-2009 at 05:12 PM.
 
Old 03-27-2009, 08:15 PM   #8
Shingoshi
Member
 
Registered: Oct 2006
Location: Cochise County, Arizona
Distribution: Gentoo-AMD64 / Slackware64-Current
Posts: 474
Blog Entries: 28

Original Poster
Rep: Reputation: 34
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

Last edited by Shingoshi; 03-27-2009 at 10:47 PM. Reason: I forgot the quotation marks in the code!!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
can't get debugging symbols when using automake ta0kira Programming 1 10-23-2008 08:52 PM
gdb debugging assembly with no symbols Four Programming 5 10-01-2008 08:47 PM
SlackWare :Method Not Allowed The requested method POST is not allowed for the URL slack31337 Linux - Software 0 04-08-2006 06:09 PM
i have used 'ggdb3' when i compile a software,why gdb didn't find debugging symbols icoming Programming 0 08-30-2004 01:35 PM
General Debugging Question Cruelpeace Programming 22 01-30-2003 11:04 AM


All times are GMT -5. The time now is 01:39 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration