From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3464 invoked by alias); 19 May 2011 20:18:07 -0000 Received: (qmail 3426 invoked by uid 22791); 19 May 2011 20:18:06 -0000 X-SWARE-Spam-Status: No, hits=-1.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE,SPF_SOFTFAIL X-Spam-Check-By: sourceware.org Received: from oproxy7-pub.bluehost.com (HELO oproxy7-pub.bluehost.com) (67.222.55.9) by sourceware.org (qpsmtpd/0.43rc1) with SMTP; Thu, 19 May 2011 20:17:49 +0000 Received: (qmail 23844 invoked by uid 0); 19 May 2011 20:17:47 -0000 Received: from unknown (HELO box531.bluehost.com) (74.220.219.131) by oproxy7.bluehost.com with SMTP; 19 May 2011 20:17:47 -0000 Received: from 146-115-68-18.c3-0.lex-ubr3.sbo-lex.ma.cable.rcn.com ([146.115.68.18] helo=[172.31.1.105]) by box531.bluehost.com with esmtpsa (SSLv3:AES256-SHA:256) (Exim 4.69) (envelope-from ) id 1QN9fH-0003Zq-1g for gdb@sourceware.org; Thu, 19 May 2011 14:17:47 -0600 Subject: Debugging 32bit apps with 64bit target gdb From: Paul Smith Reply-To: psmith@gnu.org To: gdb@sourceware.org Content-Type: text/plain; charset="us-ascii" Date: Thu, 19 May 2011 20:18:00 -0000 Message-ID: <1305836264.2776.76.camel@homebase> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-Identified-User: {678:box531.bluehost.com:madscie1:mad-scientist.us} {sentby:smtp auth 146.115.68.18 authed with paul+mad-scientist.us} 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-05/txt/msg00101.txt.bz2 Hi all; Maybe this is a naive question. I have an environment (x86) with both 32bit and 64bit applications running in it. I would like to use the same GDB binary to debug both types of applications. Ideally, though, GDB would be a 32bit application because sometimes I run on 32bit systems (obviously the 64bit applications do not run and cannot be debugged on those systems, but the 32bit ones can). I will also be doing remote debugging (with gdbserver) from a 32bit host to a 64bit target (at least I would like to be able to do that). I configured GDB (7.2) with --host=i686-generic-linux-gnu and --target=x86_64-generic-linux-gnu (and --enable-targets=all but I don't know if GDB configure groks this flag). This compiled just fine, but when I have a 32bit core file and I try to access it with GDB, I get an error: warning: Could not load shared library symbols for 8 libraries, e.g. /lib/tls/librt.so.1. Use the "info sharedlibrary" command to see the complete listing. Do you need "set solib-search-path" or "set sysroot"? warning: Unable to find dynamic linker breakpoint function. GDB will be unable to debug shared library initializers and track explicitly loaded dynamic code. Core was generated by `app32bit'. Program terminated with signal 11, Segmentation fault. #0 0x00b187a2 in ?? () #0 0x00b187a2 in ?? () #1 0x00d9c6f4 in ?? () #2 0x00000000 in ?? () and I can't get a backtrace or anything. "info sharedlibrary" shows: >From To Syms Read Shared Object Library No /lib/tls/librt.so.1 No /usr/lib/libz.so.1 No /lib/libdl.so.2 No /lib/tls/libpthread.so.0 No /lib/tls/libm.so.6 No /lib/tls/libc.so.6 No /lib/ld-linux.so.2 No /lib/libgcc_s.so.1 which are all perfectly reasonable 32bit shared libs. On the other hand, if I build a 32bit GDB (same version of code but compiled on a 32bit Linux without the --target=x6_64-generic-linux-gnu flag) then I get a perfectly usable backtrace for this identical coredump on the same system. Is what I want to do simply not possible? Or am I missing some trick? It seems to me that on the 64bit multiarch Linux systems I've used, the GDB versions that come with them can debug 32bit applications. Or am I just imagining that this is possible? -- ------------------------------------------------------------------------------- Paul D. Smith Find some GNU make tips at: http://www.gnu.org http://make.mad-scientist.net "Please remain calm...I may be mad, but I am a professional." --Mad Scientist