This is the mail archive of the gdb@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]

Re: Accessing std::cout and std::cin from within gdb.


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


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