public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: Delcypher <delcypher@gmail.com>
Cc: gdb@sourceware.org
Subject: Re: Accessing std::cout and std::cin from within gdb.
Date: Fri, 21 Oct 2011 00:47:00 -0000	[thread overview]
Message-ID: <20111020214253.GA22387@host1.jankratochvil.net> (raw)
In-Reply-To: <CANNJ_ziCQSnYQ+WdXMA1fFD9cqXNFEGp3FaXG+AqiR-3n7gpMg@mail.gmail.com>

On Wed, 19 Oct 2011 23:14:24 +0200, Delcypher wrote:
> What I see is that gdb has the completely wrong address for the cin
> and cout objects.

$ nm a.out
00000000006013a0 B _ZSt4cout@@GLIBCXX_3.4
$ nm -C a.out
00000000006013a0 B std::cout@@GLIBCXX_3.4

std::cout symbol has mangled name _ZSt4cout.

$ readelf -Wr a.out | grep  _ZSt4cout
00000000006013a0  0000000c00000005 R_X86_64_COPY     00000000006013a0 _ZSt4cout + 0
$ readelf -Wr /usr/lib64/libstdc++.so.6 | grep  _ZSt4cout
00000000002ef688  00000a6500000006 R_X86_64_GLOB_DAT 00000000002f2d60 _ZSt4cout + 0

GDB does not handle the copy relocations well as GDB is not compliant with the
well defined ld.so symbols precedence/resolving.  GDB just searches symbols in
arbitrary order and when it finds one it succeeds.

This may be a wrong/dead copy in the case of copy relocations.  One should fix
it sooner it is pretty serious.

common/.bss variables from shared libraries not displayed correctly
http://sourceware.org/bugzilla/show_bug.cgi?id=11717


Thanks,
Jan

  reply	other threads:[~2011-10-20 21:43 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-20 17:24 Delcypher
2011-10-21  0:47 ` Jan Kratochvil [this message]
2011-10-22  1:18   ` Delcypher

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=20111020214253.GA22387@host1.jankratochvil.net \
    --to=jan.kratochvil@redhat.com \
    --cc=delcypher@gmail.com \
    --cc=gdb@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).