From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27994 invoked by alias); 7 Nov 2008 18:22:34 -0000 Received: (qmail 27890 invoked by uid 22791); 7 Nov 2008 18:22:33 -0000 X-Spam-Check-By: sourceware.org Received: from smtp-outbound-1.vmware.com (HELO smtp-outbound-1.vmware.com) (65.115.85.69) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 07 Nov 2008 18:21:57 +0000 Received: from mailhost3.vmware.com (mailhost3.vmware.com [10.16.27.45]) by smtp-outbound-1.vmware.com (Postfix) with ESMTP id 8D0673C006; Fri, 7 Nov 2008 10:21:54 -0800 (PST) Received: from [10.20.92.59] (promb-2s-dhcp59.eng.vmware.com [10.20.92.59]) by mailhost3.vmware.com (Postfix) with ESMTP id 82DE3C9AA9; Fri, 7 Nov 2008 10:21:54 -0800 (PST) Message-ID: <4914857A.2070201@vmware.com> Date: Fri, 07 Nov 2008 18:22:00 -0000 From: Michael Snyder User-Agent: Thunderbird 1.5.0.12 (X11/20080411) MIME-Version: 1.0 To: "raja.saleru@iap-online.com" CC: "gdb@sourceware.org" Subject: Re: gdb internal functionality References: <33036.210.143.35.19.1225860010.squirrel@www.iap-online.com> <21449.210.143.35.19.1226044120.squirrel@www.iap-online.com> In-Reply-To: <21449.210.143.35.19.1226044120.squirrel@www.iap-online.com> Content-Type: text/plain; charset=ISO-2022-JP Content-Transfer-Encoding: 7bit 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: 2008-11/txt/msg00066.txt.bz2 raja.saleru@iap-online.com wrote: > Hi, > > I would like to know more of GDB internals especially the control flow and > functionality for the following gdb commands. For ex. the development > environment include gdb on cygwin environment, which is connected to > OpenOCD, which inturn connects to ARM target. Any information on this > would be very helpful. > > 1. target remote host:port Set a breakpoint at remote_open_1, then look at your call stack. > 2. stepi break at stepi_command. > 3. contrinue break at continue_command. > 4. break linenum This is complex. You'll need to look around within breakpoint.c and, if you want to get down and dirty, in linespec.c. > 5. delete bpnum break at delete_command. > 6. watch expression watch_command > 7. set/read register value There is no "set register" command. You can just use the regular "set" command to assign a value to a register, eg. "set $pc = 0xfeedface". The internal code for manipulating and storing register values is quite complex -- start by looking at regcache.c. > 8. read/write memory Also quite complex. There is a function pointer called "to_xfer_partial" (I know, probably seems non-intuitive). It lives in a struct called a "target_ops", which is defined in target.c. Since you're using "target remote", this pointer will point to "remote_xfer_partial". You can start looking there. > 9. quit break at quit_command. > 10. monitor reset "monitor" is a prefix command that means "send the following to my target, without interpreting it". So "reset" is a command that will be passed to your target. You can find "monitor_command" in target.c, and for the remote target, it will be implemented by function "remote_rcmd" in remote.c