Results 1 to 7 of 7

Thread: oprofile and debug symbols for glibc

  1. #1

    Default oprofile and debug symbols for glibc

    Hi,

    how do I get debug symbols for glibc?

    I'm using oprofile when profiling applications.
    Unfortunately, the default glibc version that comes with SUSE 11.1 has the debug symbols stripped-out. That means that all libc functions get aggregated into one big blob under "glibc.so" and you can't tell whether you spend most of the time in memory allocation, syslog or lock related routines.

    So, I've tried a myriad of different ways of getting the symbols. From trying to build glibc myself to hunting for dozens of different rpms on this site and on the Internet. So far - no positive results.

    Any help much appriciated.

    Thanks,
    Andy.

    My sytem: OpenSUSE 11.1, x86-64.

  2. #2
    Join Date
    Feb 2010
    Location
    Germany
    Posts
    4,654

    Default Re: oprofile and debug symbols for glibc

    zypper se glibc

    shows for example

    | glibc-profile | Libc Profiling and Debugging Versions

    is that what you are after? Did you install glibc-profile?

  3. #3

    Default Re: oprofile and debug symbols for glibc

    Quote Originally Posted by martin_helm View Post
    zypper se glibc

    shows for example

    | glibc-profile | Libc Profiling and Debugging Versions

    is that what you are after? Did you install glibc-profile?
    Well, it looks like glibc-profile package (which I did install) is only for gprof profiling. Meaning that the applications being profiled have to be recompiled with -pg option. Furthermore, libc in glibc-profile package is distributed only as a static library. It's hard for me to get the code re-compiled with that switch. Oprofile on the other hand can profile existing executables without the need to re-compile.
    I just need the debug symbolls, that's it. But it seems like an unsurmountable obstacle.

    Thanks,
    Andy.

    P.S. BTW, what is the reason behind stripping the debug symbols? Disk space?

  4. #4
    Join Date
    Feb 2010
    Location
    Germany
    Posts
    4,654

    Default Re: oprofile and debug symbols for glibc

    It is a standard thing to have the debug symbols in a separate package.
    debian does the same, it maybe does not make much sense in a standard
    desktop linux distro (it sure makes sense for a minimal distro for special
    purposes). But I do not really know.

    I was surprised that therei sno glibc-debug package, so I looked at the
    opensuse build service

    http://download.opensuse.org/reposit...2/11.2/x86_64/

    has glibc-debuginfo glibc-debug-source and so on maybe you can look at it.




  5. #5

    Default Re: oprofile and debug symbols for glibc

    Quote Originally Posted by martin_helm View Post
    It is a standard thing to have the debug symbols in a separate package.
    debian does the same, it maybe does not make much sense in a standard
    desktop linux distro (it sure makes sense for a minimal distro for special
    purposes). But I do not really know.

    I was surprised that therei sno glibc-debug package, so I looked at the
    opensuse build service

    Index of /repositories/home:/AndreasSchwab:/11.2/11.2/x86_64

    has glibc-debuginfo glibc-debug-source and so on maybe you can look at it.
    Yeah, I saw these too. But what deterred me was that these were for 11.2
    I'm not sure I can use these on my 11.1 system.
    Do you think it's safe?

    I actually took a look at the libc version in theses packages and it's higher that I'm currently using (which is 2.9-2.9)

    Thanks,
    Andy.

  6. #6

    Default Re: oprofile and debug symbols for glibc

    Ok, I finally got it working.

    Here's the steps if anyone is interested:

    (the idea is to rebuild glibc.rpm from glibc-source.rpm but withoug a step that strips out the symbolls)

    first, install the glibc-source package that comes with the standard 11.1 distro. This package puts some files into /usr/src/packages and its subdirectories (particularly into SPECS and SOURCES). Then cd into /usr/src/packages/SPECS there should be a file called glibc.spec. Edit this file. Search for
    export STRIP_KEEP_SYMTAB=<.....>*
    remove the <....> part, keeping only the star.
    This will tell the find_debug.sh script to not strip any of the produced files (I hope that's what I wanted).
    Next, start the rpm build procedure:

    rpmbuild -bb libc.spec

    If it fails, most probably it's due to some missing standard packages. In my case I needed to install stdc++-devel, selenix-devel and patch packages.
    Also, make sure that LD_LIBRARY_PATH is unset.
    This step takes a while but at the end of the day you'll get an libc rpm that was built just like the one that came with the original distro except it'll contain symbolls for all libc related libraries.

    Note: in my case rpmbuild actually failed trying to build some html ****. But by that time all libc related libraries were already built and copied to /var/tmp/glibc_build directory. For me it was just the matter of grabbing the right libraries and copying them over the existing ones. I ended up doing that by hand, but you'd probably want to use ldconfig for that.

    Hope that helps.

    Andy.

  7. #7
    Join Date
    Feb 2010
    Location
    Germany
    Posts
    4,654

    Default Re: oprofile and debug symbols for glibc

    Good to hear you solved it.
    Thank you for sharing the solution. It is a bit surprising for me why there
    is no package with the debug symbols available in the main repository for
    this really central library.



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •