This is the mail archive of the gdb-prs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug gdb/18065] New: GDB does not honor Debug Information File listed in gnu_debuglink


https://sourceware.org/bugzilla/show_bug.cgi?id=18065

            Bug ID: 18065
           Summary: GDB does not honor Debug Information File listed in
                    gnu_debuglink
           Product: gdb
           Version: 7.7
            Status: NEW
          Severity: normal
          Priority: P2
         Component: gdb
          Assignee: unassigned at sourceware dot org
          Reporter: noloader at gmail dot com

It appears GDB does not honor the debug information file name placed in
gnu_debuglink.

The digest is I have a library installed in /usr/local/lib, and I can't get GDB
to load its symbols that were placed in /usr/lib/debug.

The remainder are the symptoms I am seeing.

**********

I'm building the Crypto++ library. The library will be installed in
/usr/local/lib as libcryptopp.so.

After make'ing but before installing, I use objcopy and strip to create the two
part executable file - the stripped executable, and its debug information file.
The debug information file is named libcryptopp.so.debug. Here are the commands
used:

    cd cryptopp
    make static dynamic cryptest.exe

    DEBUG_SYM_DIR=/usr/lib/debug
    objcopy --only-keep-debug libcryptopp.so libcryptopp.so.debug
    strip --strip-debug --strip-unneeded libcryptopp.so
    sudo cp libcryptopp.so.debug $(DEBUG_SYM_DIR)/
    objcopy --add-gnu-debuglink=$(DEBUG_SYM_DIR)/libcryptopp.so.debug
libcryptopp.so

According to objcopy(1), gnu_debuglink should include the full path
(https://sourceware.org/binutils/docs/binutils/objcopy.html):

  --add-gnu-debuglink=path-to-file
      Creates a .gnu_debuglink section which contains a reference to
      path-to-file and adds it to the output file.

After performing make, objcopy, strip and install:

$ ls -l /usr/local/lib/libcryptopp.so
-rwxr-xr-x 1 root root 4837488 Feb 28 23:54 /usr/local/lib/libcryptopp.so

$ file /usr/local/lib/libcryptopp.so
/usr/local/lib/libcryptopp.so: ELF 64-bit LSB  shared object, x86-64, version 1
(SYSV), dynamically linked,
BuildID[sha1]=94b358780db21ff9b02b44ac65214ec9b855f72b, stripped

$ file /usr/lib/debug/cryptopp/libcryptopp.so.debug
/usr/lib/debug/cryptopp/libcryptopp.so.debug: ELF 64-bit LSB  shared object,
x86-64, version 1 (SYSV), dynamically linked,
BuildID[sha1]=94b358780db21ff9b02b44ac65214ec9b855f72b, not stripped

$ ls -l /usr/lib/debug/cryptopp/libcryptopp.so.debug
-rwxr-xr-x 1 root root 17757127 Mar  1 00:09
/usr/lib/debug/cryptopp/libcryptopp.so.debug

$ objdump -h /usr/local/lib/libcryptopp.so
...
 27 .gnu_debuglink 0000001c  0000000000000000  0000000000000000  0049c7ac  2**0
CONTENTS, READONLY

I don't know how to ask objdump or readelf to print a section's details, so
about all I can do is dump strings (forgive my ignorance):

$ strings /usr/local/lib/libcryptopp.so | grep libcryptopp
libcryptopp.so.debug

When I attempt to load Crypto++:

(gdb) file /usr/local/lib/libcryptopp.so 
Reading symbols from /usr/local/lib/libcryptopp.so...(no debugging symbols
found)...done.

$ gdb 
GNU gdb (Ubuntu 7.7.1-0ubuntu5~14.04.2) 7.7.1
Copyright (C) 2014 Free Software Foundation, Inc.
...
(gdb) file /usr/local/lib/libcryptopp.so
Reading symbols from /usr/local/lib/libcryptopp.so...(no debugging symbols
found)...done.
...

-- 
You are receiving this mail because:
You are on the CC list for the bug.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]