public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "noloader at gmail dot com" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug gdb/18065] New: GDB does not honor Debug Information File listed in gnu_debuglink
Date: Sun, 01 Mar 2015 05:31:00 -0000	[thread overview]
Message-ID: <bug-18065-4717@http.sourceware.org/bugzilla/> (raw)

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.


             reply	other threads:[~2015-03-01  5:22 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-01  5:31 noloader at gmail dot com [this message]
2015-03-01 11:43 ` [Bug gdb/18065] " noloader at gmail dot com
2022-02-24 15:02 ` tromey at sourceware dot org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-18065-4717@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).