From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25061 invoked by alias); 30 Nov 2011 22:00:25 -0000 Received: (qmail 25048 invoked by uid 22791); 30 Nov 2011 22:00:24 -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; Wed, 30 Nov 2011 22:00:10 +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 pAUM06iA030747 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 30 Nov 2011 17:00:10 -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 pAUM010u010586 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Wed, 30 Nov 2011 17:00:04 -0500 Date: Wed, 30 Nov 2011 22:00: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: <20111130220001.GA17137@host2.jankratochvil.net> References: <4ED54766.2020601@tilera.com> <20111129211102.GA15255@host2.jankratochvil.net> <4ED63112.5080504@tilera.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4ED63112.5080504@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/msg00136.txt.bz2 On Wed, 30 Nov 2011 14:35:14 +0100, Jeff Kenton wrote: > This sounds like the basic problem. Building the 32 bit > target_gdbarch is easy. What's the best way (place in the code) to > detect 32 bit vs. 64 bit binaries and switch between different > gdbarch's? I do not understand the context. The current GDB switches target_gdbarch right during execution of "./gdb ./gdb", at: #0 deprecated_target_gdbarch_select_hack (new_gdbarch=0x2071110) at gdbarch.c:4294 #1 in set_gdbarch_from_file (abfd=0x206c990) at arch-utils.c:559 #2 in exec_file_attach (filename=0x7fffffffde00 "./gdb", from_tty=1) at exec.c:294 #3 in catch_command_errors (command=0x488ab7 , arg=0x7fffffffde00 "./gdb", from_tty=1, mask=6) at exceptions.c:531 #4 in captured_main (data=0x7fffffffd9e0) at ./main.c:850 #5 in catch_errors (func=0x4873f6 , func_args=0x7fffffffd9e0, errstring=0xe6ede7 "", mask=6) at exceptions.c:504 #6 in gdb_main (args=0x7fffffffd9e0) at ./main.c:953 #7 in main (argc=2, argv=0x7fffffffdae8) at gdb.c:35 Regards, Jan