From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15474 invoked by alias); 20 Oct 2011 21:43:14 -0000 Received: (qmail 15458 invoked by uid 22791); 20 Oct 2011 21:43:14 -0000 X-SWARE-Spam-Status: No, hits=-6.8 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,SPF_HELO_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 20 Oct 2011 21:42:57 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p9KLgvfT008627 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 20 Oct 2011 17:42:57 -0400 Received: from host1.jankratochvil.net (ovpn-116-16.ams2.redhat.com [10.36.116.16]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p9KLgtL6000502 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 20 Oct 2011 17:42:56 -0400 Received: from host1.jankratochvil.net (localhost [127.0.0.1]) by host1.jankratochvil.net (8.14.4/8.14.4) with ESMTP id p9KLgsdp022925; Thu, 20 Oct 2011 23:42:54 +0200 Received: (from jkratoch@localhost) by host1.jankratochvil.net (8.14.4/8.14.4/Submit) id p9KLgrrU022918; Thu, 20 Oct 2011 23:42:53 +0200 Date: Fri, 21 Oct 2011 00:47:00 -0000 From: Jan Kratochvil To: Delcypher Cc: gdb@sourceware.org Subject: Re: Accessing std::cout and std::cin from within gdb. Message-ID: <20111020214253.GA22387@host1.jankratochvil.net> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2011-10/txt/msg00164.txt.bz2 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