From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6010 invoked by alias); 16 Jun 2011 14:19:04 -0000 Received: (qmail 5996 invoked by uid 22791); 16 Jun 2011 14:19:04 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (38.113.113.100) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 16 Jun 2011 14:18:44 +0000 Received: (qmail 21707 invoked from network); 16 Jun 2011 14:18:43 -0000 Received: from unknown (HELO scottsdale.localnet) (pedro@127.0.0.2) by mail.codesourcery.com with ESMTPA; 16 Jun 2011 14:18:43 -0000 From: Pedro Alves To: gdb@sourceware.org Subject: Re: Cross debugger Date: Thu, 16 Jun 2011 14:19:00 -0000 User-Agent: KMail/1.13.6 (Linux/2.6.38-8-generic; KDE/4.6.2; x86_64; ; ) Cc: Paul Koning , Chris Sutcliffe References: <45C23430-D605-4D08-8380-BB4C6C772670@dell.com> In-Reply-To: <45C23430-D605-4D08-8380-BB4C6C772670@dell.com> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201106161518.41157.pedro@codesourcery.com> 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-06/txt/msg00117.txt.bz2 On Thursday 16 June 2011 14:52:24, Paul Koning wrote: > > On Jun 16, 2011, at 7:53 AM, Chris Sutcliffe wrote: > > > On 15 June 2011 22:53, Joel Brobecker wrote: > >> What I don't understand is why you created a cross compiler/debugger, > >> while it seems to me you could have just created a native x64 MinGW > >> toolset. That's what we do at AdaCore: We use cygwin as the build > >> environment, but then build a MinGW toolset by configuring with > >> --build=x86_64-pc-mingw32. As far as I know, the gdbserver will > >> be automatically built. > > > > Good point, for some reason I was thinking that since gdb would be > > running withing the Cygwin environment I would need the > > '--host=i686-pc-cygwin'. If I build a native x64 MinGW gdb will it > > understand Cygwin paths correctly? > > > >>> (gdb) start > >> [...] > >>> Don't know how to run. Try "help target". > >> > >> And that's also expected, since you have a cross-debugger. So the > >> debugger is expecting you to connect to the target where the process > >> is running. > > > > Ah, I didn't realize a cross-debugger could only be used to connect to > > running process. > > More precisely, it can attach to an already running process, or you can start a new one on the command line. Either way, though, by the time gdb connects to gdbserver, the process already exists. If you started it on the command line, it's on the first instruction (typically some sort of startup library code, well before "main"). So either way, you get things going by "continue". That's a bit orthogonal to cross-debuggers. It's "target remote" that doesn't know how to "start". "target extended-remote" does know. When you're not already connected to a remote target, "run"/"start" will try to run the program with the native debugger. If there's no native debugger in your gdb build (because you've built gdb as a cross debugger only), then you'll see that message, because your gdb doesn't know how to run the program natively. Those commands _can_ be used with a cross-debugger. You need to connect to a remote target that knows how. That is what the --multi switch of gdbserver is for. Start gdbserver with e.g., "gdbserver --multi :9999" and connect to it from gdb with "target extended-remote". You can then use "run", "start", and "attach", just like you would if you were debugging with a native debugger. -- Pedro Alves