From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29842 invoked by alias); 11 Feb 2006 02:29:18 -0000 Received: (qmail 29834 invoked by uid 22791); 11 Feb 2006 02:29:18 -0000 X-Spam-Check-By: sourceware.org Received: from nevyn.them.org (HELO nevyn.them.org) (66.93.172.17) by sourceware.org (qpsmtpd/0.31.1) with ESMTP; Sat, 11 Feb 2006 02:29:16 +0000 Received: from drow by nevyn.them.org with local (Exim 4.54) id 1F7kVd-0002GS-E6; Fri, 10 Feb 2006 21:29:13 -0500 Date: Sat, 11 Feb 2006 02:29:00 -0000 From: Daniel Jacobowitz To: Mitchell Fang Cc: gdb@sourceware.org Subject: Re: More GDB stub questions Message-ID: <20060211022913.GA8659@nevyn.them.org> Mail-Followup-To: Mitchell Fang , gdb@sourceware.org References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.8i X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2006-02/txt/msg00097.txt.bz2 On Fri, Feb 10, 2006 at 05:48:10PM -0800, Mitchell Fang wrote: > So I've implementing a GDB stub thats connect GDB to a PowerPC4xx > board (target) via a JTAG controller. I've got some questions that I'm > still not sure about and since I got great advice last time I figured > I try again. So here is my environment, the host computer is a linux > machine and my GDB stub resides on the host also. They connect by > TCP/IP. > > 1) Do I need to configure GDB so that the host is linux and the target > is PPC? I don't think so but wanted to be sure. Yes, certainly. > 2) When GDB connects with the stub, one of the initial commands will > be the 'g' read general register commands. Is this only the GPR > registers then? Shouldn't it need to know the SPR registers, and > other registers also? I'm not really sure what GDB is expecting. > When I type "info registers" afterward it just lists some stuff that I > don't know what it is. Type "maint print registers" to see what registers GDB is expecting and where in the 'g' packet they ought to be. Currently GDB has somewhat limited support for SPRs, but if you set the architecture appropriately, it does know some of them. > (top-gdb) target remote :8888 > Remote debugging using :8888 > 0x00000000 in ?? () > (top-gdb) info register > eax 0x0 0 That should tip you off that you don't have a PPC debugger :-) > 3) For the program that I want to debug, I've been trying load it > onto the Target by using the GDB load command. So when I type in gdb > "load test", my stub just reads it as a write hex data to memory. I > haven't implemented the 'X' write bin data to memory command. If > that's all load does, how are you suppose to figure out where to set > the PC? or is this just not the right way to load the program to be > debugged onto the Target. Setting the PC is supposed to be done by some other mechanism. For an experimental stub I've been working with lately, we decided to use "target extended-remote" instead of "target remote", which allows us to use the "run" command ("R" packet) to set the PC appropriately. If the PC is the only thing that needs setting up, you can just use "load" and start the program by an appropriate "jump" command. -- Daniel Jacobowitz CodeSourcery