This is the mail archive of the
mailing list for the GDB project.
Re: gdb internal functionality
- From: Michael Snyder <msnyder at vmware dot com>
- To: "raja dot saleru at iap-online dot com" <raja dot saleru at iap-online dot com>
- Cc: "gdb at sourceware dot org" <gdb at sourceware dot org>
- Date: Fri, 07 Nov 2008 10:14:18 -0800
- Subject: Re: gdb internal functionality
- References: <firstname.lastname@example.org> <email@example.com>
> 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,
> 5. delete bpnum
break at delete_command.
> 6. watch expression
> 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
> 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
> 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