From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15882 invoked by alias); 8 Oct 2012 20:01:35 -0000 Received: (qmail 15872 invoked by uid 22791); 8 Oct 2012 20:01:34 -0000 X-SWARE-Spam-Status: No, hits=-1.3 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,RCVD_IN_HOSTKARMA_YE,SPF_SOFTFAIL X-Spam-Check-By: sourceware.org Received: from oproxy11-pub.bluehost.com (HELO oproxy11-pub.bluehost.com) (173.254.64.10) by sourceware.org (qpsmtpd/0.43rc1) with SMTP; Mon, 08 Oct 2012 20:01:28 +0000 Received: (qmail 21333 invoked by uid 0); 8 Oct 2012 20:01:27 -0000 Received: from unknown (HELO box531.bluehost.com) (74.220.219.131) by oproxy11.bluehost.com with SMTP; 8 Oct 2012 20:01:27 -0000 Received: from [146.115.71.23] (port=39294 helo=[172.31.1.105]) by box531.bluehost.com with esmtpsa (SSLv3:CAMELLIA256-SHA:256) (Exim 4.76) (envelope-from ) id 1TLJW2-0007H3-Pt for gdb@sourceware.org; Mon, 08 Oct 2012 14:01:27 -0600 Message-ID: <1349726484.10588.12.camel@homebase> Subject: Help with cross-compiling GDB From: Paul Smith Reply-To: psmith@gnu.org To: "gdb@sourceware.org" Date: Mon, 08 Oct 2012 20:01:00 -0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Mime-Version: 1.0 X-Identified-User: {678:box531.bluehost.com:madscie1:mad-scientist.us} {sentby:smtp auth 146.115.71.23 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: 2012-10/txt/msg00043.txt.bz2 Hi all. I'm trying to create a complete toolchain including GCC, binutils, plus tools like make, fakeroot, bison, flex, m4, and of course GDB. What I need to do is have the tools compiled to be able to run on much older GNU/Linux distributions, even though my build system is very recent. So I have a cross-compiler built that uses a sysroot from an older distribution and I'm using that to compile GDB. I need to be able to compile and debug both 32bit and 64bit programs. Originally I wanted to have a 32bit version of GDB which could debug both, but that doesn't appear to be possible. That's OK, I'm willing to have GDB be a 64bit application, or else I'll build GDB twice. For now I'm just trying to get the 64bit GDB working. So, I configure GDB with something like this: ./configure --disable-nls --disable-werror --prefix=/tmp/invalid/generic \ --host=x86_64-olddist-linux-gnu --target=x86_64-generic-linux-gnu \ --with-sysroot=/tmp/invalid/sysroot/generic/sysroot --enable-64-bit-bfd \ --enable-tui --with-expat --without-python \ --program-prefix=x86_64-generic-linux-gnu- So this builds fine, but when I try to debug something I always get errors: $ ./obj/cc/generic/bin/x86_64-generic-linux-gnu-gdb foo GNU gdb (GDB) 7.5 ... This GDB was configured as "--host=x86_64-olddist-linux-gnu --target=x86_64-generic-linux-gnu". For bug reporting instructions, please see: ... Reading symbols from foo...done. (gdb) run Starting program: foo Don't know how to run. Try "help target". (gdb) show arch The target architecture is set automatically (currently i386) (gdb) set arch Requires an argument. Valid arguments are i386, i386:x86-64, i386:x64-32, i8086, i386:intel, i386:x86-64:intel, i386:x64-32:intel, auto. This is a 32bit app but I get identical errors (although different show arch of course) when I try to debug a 64bit app. I can set breakpoints, etc. but any attempt to run gives the "don't know how to run" error. I'm not sure exactly what that means in this context. It appears to have the right architecture and that architecture appears to be supported. So what does GDB need from me?