From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32750 invoked by alias); 29 Nov 2011 21:11:24 -0000 Received: (qmail 32742 invoked by uid 22791); 29 Nov 2011 21:11:23 -0000 X-SWARE-Spam-Status: No, hits=-7.2 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; Tue, 29 Nov 2011 21:11:07 +0000 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id pATLB7jK027731 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 29 Nov 2011 16:11:07 -0500 Received: from host2.jankratochvil.net (ovpn-116-69.ams2.redhat.com [10.36.116.69]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id pATLB3Wu009278 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Tue, 29 Nov 2011 16:11:06 -0500 Date: Tue, 29 Nov 2011 21:11:00 -0000 From: Jan Kratochvil To: Jeff Kenton Cc: gdb@sourceware.org Subject: Re: GDB: problem debugging 32 bit binary on 64 bit machine Message-ID: <20111129211102.GA15255@host2.jankratochvil.net> References: <4ED54766.2020601@tilera.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4ED54766.2020601@tilera.com> 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-11/txt/msg00132.txt.bz2 On Tue, 29 Nov 2011 21:58:14 +0100, Jeff Kenton wrote: > 0x400000008" (address is above the 32 bit limit). This is caused by > a call to extract_typed_address() from scan_dyntag() reading an 8 > byte type when it should only be reading 4 bytes. ARCH_SIZE there should be 32 and TARGET_GDBARCH should be 32-bit. I guess for some reasons your GDB found wrong (64-bit) library for your 32-bit program. See the settings like `set solib-search-path', `set sysroot' etc. > I have two questions: > 1. is tweaking extract_typed_address() the right way to handle 32 > bit addresses on a 64 bit machine? No. If ARCH_SIZE and TARGET_GDBARCH are set right it will work. > 2. what's going wrong with dl_main()? There is called a notification new library has been loaded in the inferior, therefore GDB tries to load a matching symbol file (=the library itself) on the GDB side. > 3. meta-question: is this a generic bug in gdb's handling of 32 bit > binaries, or is there likely something I missed while porting? It 32-on-64 normally works, at least in Fedora, no custom patches for it there. Regards, Jan