gdbint_10.html   [plain text]


<HTML>
<HEAD>
<!-- This HTML file has been created by texi2html 1.51
     from /mnt/apple/gdb/source/gdb.apple/source/gdb/gdb/doc/gdbint.texinfo on 23 November 1999 -->

<TITLE>GDB Internals - Target Vector Definition</TITLE>
</HEAD>
<BODY>
Go to the <A HREF="gdbint_1.html">first</A>, <A HREF="gdbint_9.html">previous</A>, <A HREF="gdbint_11.html">next</A>, <A HREF="gdbint_16.html">last</A> section, <A HREF="gdbint_toc.html">table of contents</A>.
<P><HR><P>


<H1><A NAME="SEC68" HREF="gdbint_toc.html#TOC68">Target Vector Definition</A></H1>

<P>
The target vector defines the interface between GDB's abstract handling
of target systems, and the nitty-gritty code that actually exercises
control over a process or a serial port.  GDB includes some 30-40
different target vectors; however, each configuration of GDB includes
only a few of them.

</P>


<H2><A NAME="SEC69" HREF="gdbint_toc.html#TOC69">File Targets</A></H2>

<P>
Both executables and core files have target vectors.

</P>


<H2><A NAME="SEC70" HREF="gdbint_toc.html#TOC70">Standard Protocol and Remote Stubs</A></H2>

<P>
GDB's file <TT>`remote.c'</TT> talks a serial protocol to code that runs in
the target system.  GDB provides several sample "stubs" that can be
integrated into target programs or operating systems for this purpose;
they are named <TT>`*-stub.c'</TT>.

</P>
<P>
The GDB user's manual describes how to put such a stub into your target
code.  What follows is a discussion of integrating the SPARC stub into a
complicated operating system (rather than a simple program), by Stu
Grossman, the author of this stub.

</P>
<P>
The trap handling code in the stub assumes the following upon entry to
trap_low:

</P>

<OL>

<LI>%l1 and %l2 contain pc and npc respectively at the time of the trap

<LI>traps are disabled

<LI>you are in the correct trap window

</OL>

<P>
As long as your trap handler can guarantee those conditions, then there
is no reason why you shouldn't be able to `share' traps with the stub.
The stub has no requirement that it be jumped to directly from the
hardware trap vector.  That is why it calls <CODE>exceptionHandler()</CODE>,
which is provided by the external environment.  For instance, this could
setup the hardware traps to actually execute code which calls the stub
first, and then transfers to its own trap handler.

</P>
<P>
For the most point, there probably won't be much of an issue with
`sharing' traps, as the traps we use are usually not used by the kernel,
and often indicate unrecoverable error conditions.  Anyway, this is all
controlled by a table, and is trivial to modify.  The most important
trap for us is for <CODE>ta 1</CODE>.  Without that, we can't single step or
do breakpoints.  Everything else is unnecessary for the proper operation
of the debugger/stub.

</P>
<P>
From reading the stub, it's probably not obvious how breakpoints work.
They are simply done by deposit/examine operations from GDB.

</P>


<H2><A NAME="SEC71" HREF="gdbint_toc.html#TOC71">ROM Monitor Interface</A></H2>



<H2><A NAME="SEC72" HREF="gdbint_toc.html#TOC72">Custom Protocols</A></H2>



<H2><A NAME="SEC73" HREF="gdbint_toc.html#TOC73">Transport Layer</A></H2>



<H2><A NAME="SEC74" HREF="gdbint_toc.html#TOC74">Builtin Simulator</A></H2>

<P><HR><P>
Go to the <A HREF="gdbint_1.html">first</A>, <A HREF="gdbint_9.html">previous</A>, <A HREF="gdbint_11.html">next</A>, <A HREF="gdbint_16.html">last</A> section, <A HREF="gdbint_toc.html">table of contents</A>.
</BODY>
</HTML>