blob: e428382dfe2029cc64c7cbed3a1354c34b492d18 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">
<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">
<LINK REL="STYLESHEET" HREF="../book.css" CHARSET="ISO-8859-1" TYPE="text/css">
<TITLE>Breakpoints</TITLE>
<link rel="stylesheet" type="text/css" HREF="../book.css">
</HEAD>
<BODY BGCOLOR="#ffffff">
<h3>Breakpoints </h3>
<p>Breakpoints allow users to suspend the execution of a program at a particular
location.&nbsp; Breakpoints are typically shown in the UI along with the source
code.&nbsp; You can add an <a href="../reference/api/org/eclipse/debug/core/IBreakpointListener.html"><b>IBreakpointListener</b></a>
to an <a href="../reference/api/org/eclipse/debug/core/IBreakpointManager.html"><b>IBreakpointManager</b></a>
in order to be notified as breakpoints are added and removed.&nbsp; When a
breakpoint is encountered during execution of a program, the program suspends
and triggers a <b>SUSPEND</b> debug event with <b>BREAKPOINT</b> as the
reason.&nbsp; </p>
<p>Plug-ins that define their own debug models and launch configurations often
need to define their own breakpoint types.&nbsp; You can implement breakpoints
for your particular debug model by defining a class that implements <a href="../reference/api/org/eclipse/debug/core/model/IBreakpoint.html"><b>IBreakpoint</b></a>.&nbsp;
</p>
<p>Breakpoints are implemented using <a href="resAdv_markers.htm">resource markers</a>.&nbsp;
Recall that resource markers allow you to associate meta information about a
resource in the form of named attributes.&nbsp; By implementing a breakpoint
using markers, the debug model can make use of all the existing marker function
such as persistence, searching, adding, deleting, and displaying in editors.</p>
<p>Why is it important to know about markers when using breakpoints?&nbsp; When
you create a breakpoint type, you must also specify an associated marker
type.&nbsp; Every extension of <a href="../reference/extension-points/org_eclipse_debug_core_breakpoints.html"><b>org.eclipse.debug.core.breakpoints</b></a>
should be accompanied by an extension of <a href="../reference/extension-points/org_eclipse_core_resources_markers.html"><b>org.eclipse.core.resources.markers</b></a>.&nbsp;
This is best demonstrated by looking at the extensions defined by the Java
tooling for Java breakpoints.</p>
<pre><font color="#4444CC">&lt;extension id=&quot;javaBreakpointMarker&quot; point=&quot;org.eclipse.core.resources.markers&quot;&gt;
&lt;super type=&quot;<b>org.eclipse.debug.core.breakpointMarker</b>&quot;/&gt;
&lt;/extension&gt;
&lt;extension id=&quot;<b>javaExceptionBreakpointMarker</b>&quot; point=&quot;org.eclipse.core.resources.markers&quot;&gt;
&lt;super type=&quot;org.eclipse.jdt.debug.javaBreakpointMarker&quot;/&gt;
&lt;persistent value=&quot;true&quot;/&gt;
&lt;attribute name=&quot;org.eclipse.jdt.debug.core.caught&quot;/&gt;
&lt;attribute name=&quot;org.eclipse.jdt.debug.core.uncaught&quot;/&gt;
&lt;attribute name=&quot;org.eclipse.jdt.debug.core.checked&quot;/&gt;
&lt;/extension&gt;</font></pre>
<pre><font color="#4444CC">&lt;extension point=&quot;org.eclipse.debug.core.breakpoints&quot;&gt;
&lt;breakpoint
id=&quot;javaExceptionBreakpoint&quot;
markerType=&quot;<b>org.eclipse.jdt.debug.javaExceptionBreakpointMarker</b>&quot;
class=&quot;org.eclipse.jdt.internal.debug.core.breakpoints.JavaExceptionBreakpoint&quot;&gt;
&lt;/breakpoint&gt;
&lt;/extension&gt;</font></pre>
<p>The debug plug-in defines a special type of marker, <font SIZE="2"><b>org.eclipse.debug.core.breakpointMarker</b>.&nbsp;
When you define a marker, you should declare it using this marker as a super
type.&nbsp; This allows the debug model to find all possible breakpoints within
a source file by searching for subtypes of its marker.&nbsp; In the example
above, the <b>javaExceptionBreakpointMarker</b> has a super type, <b>javaBreakpointMarker</b>,
whose super type is the <b>breakpointMarker</b>.&nbsp; The <b>javaExceptionBreakpoint</b>&nbsp;
(defined in the breakpoint extension) designates the <b>javaExceptionBreakpointMarker</b>
as its marker.</font></p>
<p><font size="2">What does all of this mean?&nbsp; When the debug code obtains
a source code resource, it can search for all markers whose super type is <b>org.eclipse.debug.core.breakpointMarker</b>.&nbsp;
Having found all of the markers, it can then use the plug-in registry to map the
markers to their associated breakpoint classes.&nbsp; In this way, the platform
debug code can generically find all breakpoint types that have been set on a
particular source file. </font></p>
<p>&nbsp;</p>
<p><a href="../hglegal.htm"><img border="0" src="../ngibmcpy.gif" alt="Copyright IBM Corporation and others 2000, 2003." border="0" width="324" height="14"></a></p>
</BODY>
</HTML>