You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

86 lines
3.8 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- Created by GNU Texinfo 6.4, http://www.gnu.org/software/texinfo/ -->
<head>
<title>Exception handler (Embed with GNU)</title>
<meta name="description" content="Exception handler (Embed with GNU)">
<meta name="keywords" content="Exception handler (Embed with GNU)">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="index.html#Top" rel="start" title="Top">
<link href="leds_002ec.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="GDB.html#GDB" rel="up" title="GDB">
<link href="ROM-monitors.html#ROM-monitors" rel="next" title="ROM monitors">
<link href="GNU-remote-protocol.html#GNU-remote-protocol" rel="prev" title="GNU remote protocol">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.indentedblock {margin-right: 0em}
blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
blockquote.smallquotation {font-size: smaller}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
div.smalldisplay {margin-left: 3.2em}
div.smallexample {margin-left: 3.2em}
div.smalllisp {margin-left: 3.2em}
kbd {font-style: oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: inherit; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: inherit; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.nolinebreak {white-space: nowrap}
span.roman {font-family: initial; font-weight: normal}
span.sansserif {font-family: sans-serif; font-weight: normal}
ul.no-bullet {list-style: none}
-->
</style>
</head>
<body lang="en">
<a name="Exception-handler"></a>
<div class="header">
<p>
Next: <a href="ROM-monitors.html#ROM-monitors" accesskey="n" rel="next">ROM monitors</a>, Previous: <a href="GNU-remote-protocol.html#GNU-remote-protocol" accesskey="p" rel="prev">GNU remote protocol</a>, Up: <a href="GDB.html#GDB" accesskey="u" rel="up">GDB</a> &nbsp; [<a href="leds_002ec.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<hr>
<a name="A-linked-in-exception-handler"></a>
<h3 class="section">4.2 A linked in exception handler</h3>
<p>A <em>GDB stub</em> consists of two parts, support for the exception
handler, and the exception handler itself. The exception handler needs
to communicate to GDB on the host whenever there is a breakpoint
exception. When GDB starts a program running on the target, it&rsquo;s polling
the serial port during execution looking for any debug packets. So when
a breakpoint occurs, the exception handler needs to save state, and send
a GDB remote protocol packet to GDB on the host. GDB takes any output
that isn&rsquo;t a debug command packet and displays it in the command window.
</p>
<p>Support for the exception handler varies between processors, but the
minimum supported functions are those needed by GDB. These are functions
to support the reading and writing of registers, the reading and writing
of memory, start execution at an address, single step, and last signal.
Sometimes other functions for adjusting the baud rate, or resetting the
hardware are implemented.
</p>
<p>Once GDB gets the command packet from the breakpoint, it will read a few
registers and memory locations an then wait for the user. When the user
types <code>run</code> or <code>continue</code> a <code>continue</code> command is issued
to the backend, and control returns from the breakpoint routine to the
application.
</p>
</body>
</html>