doc/classes/Breakpoint.html in ruby-breakpoint-0.5.0 vs doc/classes/Breakpoint.html in ruby-breakpoint-0.5.1
- old
+ new
@@ -1,540 +1,553 @@
-<?xml version="1.0" encoding="iso-8859-1"?>
-<!DOCTYPE html
- PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
- <title>Module: Breakpoint</title>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
- <meta http-equiv="Content-Script-Type" content="text/javascript" />
- <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
- <script type="text/javascript">
- // <![CDATA[
-
- function popupCode( url ) {
- window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
- }
-
- function toggleCode( id ) {
- if ( document.getElementById )
- elem = document.getElementById( id );
- else if ( document.all )
- elem = eval( "document.all." + id );
- else
- return false;
-
- elemStyle = elem.style;
-
- if ( elemStyle.display != "block" ) {
- elemStyle.display = "block"
- } else {
- elemStyle.display = "none"
- }
-
- return true;
- }
-
- // Make codeblocks hidden by default
- document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
-
- // ]]>
- </script>
-
-</head>
-<body>
-
-
-
- <div id="classHeader">
- <table class="header-table">
- <tr class="top-aligned-row">
- <td><strong>Module</strong></td>
- <td class="class-name-in-header">Breakpoint</td>
- </tr>
- <tr class="top-aligned-row">
- <td><strong>In:</strong></td>
- <td>
- <a href="../files/lib/breakpoint_rb.html">
- lib/breakpoint.rb
- </a>
- <br />
- </td>
- </tr>
-
- </table>
- </div>
- <!-- banner header -->
-
- <div id="bodyContent">
-
-
-
- <div id="contextContent">
-
-
-
- </div>
-
- <div id="method-list">
- <h3 class="section-bar">Methods</h3>
-
- <div class="name-list">
- <a href="#M000006">activate_drb</a>
- <a href="#M000005">assert</a>
- <a href="#M000004">breakpoint</a>
- <a href="#M000007">deactivate_drb</a>
- <a href="#M000008">use_drb?</a>
- </div>
- </div>
-
- </div>
-
-
- <!-- if includes -->
-
- <div id="section">
-
- <div id="class-list">
- <h3 class="section-bar">Classes and Modules</h3>
-
- Module <a href="Breakpoint/CommandBundle.html" class="link">Breakpoint::CommandBundle</a><br />
-Class <a href="Breakpoint/FailedAssertError.html" class="link">Breakpoint::FailedAssertError</a><br />
-
- </div>
-
- <div id="constants-list">
- <h3 class="section-bar">Constants</h3>
-
- <div class="name-list">
- <table summary="Constants">
- <tr class="top-aligned-row context-row">
- <td class="context-item-name">Version</td>
- <td>=</td>
- <td class="context-item-value">current_version</td>
- <td width="3em"> </td>
- <td class="context-item-desc">
-The Version of ruby-breakpoint you are using as String of the 1.2.3 form
-where the digits stand for release, major and minor version respectively.
-
-</td>
- </tr>
- </table>
- </div>
- </div>
-
-
-
- <div id="attribute-list">
- <h3 class="section-bar">Attributes</h3>
-
- <div class="name-list">
- <table>
- <tr class="top-aligned-row context-row">
- <td class="context-item-name">asserts_cause_exceptions</td>
- <td class="context-item-value"> [RW] </td>
- <td class="context-item-desc">
-Whether an Exception should be raised on failed asserts in non-$DEBUG code
-or not. By default this is disabled.
-
-</td>
- </tr>
- <tr class="top-aligned-row context-row">
- <td class="context-item-name">optimize_asserts</td>
- <td class="context-item-value"> [RW] </td>
- <td class="context-item-desc">
-Whether asserts should be ignored if not in debug mode. Debug mode can be
-enabled by running ruby with the -d switch or by setting $DEBUG to true.
-
-</td>
- </tr>
- </table>
- </div>
- </div>
-
-
-
- <!-- if method_list -->
- <div id="methods">
- <h3 class="section-bar">Public Instance methods</h3>
-
- <div id="method-M000006" class="method-detail">
- <a name="M000006"></a>
-
- <div class="method-heading">
- <a href="#M000006" class="method-signature">
- <span class="method-name">activate_drb</span><span class="method-args">(uri = nil, allowed_hosts = ['localhost', '127.0.0.1', '::1'], ignore_collisions = false)</span>
- </a>
- </div>
-
- <div class="method-description">
- <p>
-Will run <a href="Breakpoint.html">Breakpoint</a> in DRb mode. This will
-spawn a server that can be attached to via the breakpoint-client command
-whenever a breakpoint is executed. This is useful when you are debugging
-CGI applications or other applications where you can’t access debug
-sessions via the standard input and output of your application.
-</p>
-<p>
-You can specify an URI where the DRb server will run at. This way you can
-specify the port the server runs on. The default URI is
-druby://localhost:42531.
-</p>
-<p>
-Please note that breakpoints will be skipped silently in case the DRb
-server can not spawned. (This can happen if the port is already used by
-another instance of your application on CGI or another application.)
-</p>
-<p>
-Also note that by default this will only allow access from localhost. You
-can however specify a list of allowed hosts or nil (to allow access from
-everywhere). But that will still not protect you from somebody reading the
-data as it goes through the net.
-</p>
-<p>
-A good approach for getting security and remote access is setting up an SSH
-tunnel between the DRb service and the client. This is usually done like
-this:
-</p>
-<p>
-$ ssh -L20000:127.0.0.1:20000 -R10000:127.0.0.1:10000 example.com (This
-will connect port 20000 at the client side to port 20000 at the server
-side, and port 10000 at the server side to port 10000 at the client side.)
-</p>
-<p>
-After that do this on the server side: (the code being debugged) <a
-href="Breakpoint.html#M000006">Breakpoint.activate_drb</a>("druby://127.0.0.1:20000",
-"localhost")
-</p>
-<p>
-And at the client side: ruby breakpoint_client.rb -c
-druby://127.0.0.1:10000 -s druby://127.0.0.1:20000
-</p>
-<p>
-Running through such a SSH proxy will also let you use breakpoint.rb in
-case you are behind a firewall.
-</p>
-<p>
-Detailed information about running DRb through firewalls is available at <a
-href="http://www.rubygarden.org/ruby?DrbTutorial">www.rubygarden.org/ruby?DrbTutorial</a>
-</p>
-<h2>Security considerations</h2>
-<p>
-Usually you will be fine when using the default druby:// URI and the
-default access control list. However, if you are sitting on a machine where
-there are local users that you likely can not trust (this is the case for
-example on most web hosts which have multiple users sitting on the same
-physical machine) you will be better off by doing client/server
-communication through a unix socket. This can be accomplished by calling
-with a drbunix:/ style URI, e.g. <tt><a
-href="Breakpoint.html#M000006">Breakpoint.activate_drb</a>(‘drbunix:/tmp/breakpoint_server’)</tt>.
-This will only work on Unix based platforms.
-</p>
- <p><a class="source-toggle" href="#"
- onclick="toggleCode('M000006-source');return false;">[Source]</a></p>
- <div class="method-source-code" id="M000006-source">
-<pre>
- <span class="ruby-comment cmt"># File lib/breakpoint.rb, line 374</span>
-374: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">activate_drb</span>(<span class="ruby-identifier">uri</span> = <span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">allowed_hosts</span> = [<span class="ruby-value str">'localhost'</span>, <span class="ruby-value str">'127.0.0.1'</span>, <span class="ruby-value str">'::1'</span>],
-375: <span class="ruby-identifier">ignore_collisions</span> = <span class="ruby-keyword kw">false</span>)
-376:
-377: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@use_drb</span>
-378:
-379: <span class="ruby-identifier">uri</span> <span class="ruby-operator">||=</span> <span class="ruby-value str">'druby://localhost:42531'</span>
-380:
-381: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">allowed_hosts</span> <span class="ruby-keyword kw">then</span>
-382: <span class="ruby-identifier">acl</span> = [<span class="ruby-value str">"deny"</span>, <span class="ruby-value str">"all"</span>]
-383:
-384: <span class="ruby-constant">Array</span>(<span class="ruby-identifier">allowed_hosts</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">host</span><span class="ruby-operator">|</span>
-385: <span class="ruby-identifier">acl</span> <span class="ruby-operator">+=</span> [<span class="ruby-value str">"allow"</span>, <span class="ruby-identifier">host</span>]
-386: <span class="ruby-keyword kw">end</span>
-387:
-388: <span class="ruby-constant">DRb</span>.<span class="ruby-identifier">install_acl</span>(<span class="ruby-constant">ACL</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">acl</span>))
-389: <span class="ruby-keyword kw">end</span>
-390:
-391: <span class="ruby-ivar">@use_drb</span> = <span class="ruby-keyword kw">true</span>
-392: <span class="ruby-ivar">@drb_service</span> = <span class="ruby-constant">DRbService</span>.<span class="ruby-identifier">new</span>
-393: <span class="ruby-identifier">did_collision</span> = <span class="ruby-keyword kw">false</span>
-394: <span class="ruby-keyword kw">begin</span>
-395: <span class="ruby-ivar">@service</span> = <span class="ruby-constant">DRb</span>.<span class="ruby-identifier">start_service</span>(<span class="ruby-identifier">uri</span>, <span class="ruby-ivar">@drb_service</span>)
-396: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Errno</span><span class="ruby-operator">::</span><span class="ruby-constant">EADDRINUSE</span>
-397: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">ignore_collisions</span> <span class="ruby-keyword kw">then</span>
-398: <span class="ruby-keyword kw">nil</span>
-399: <span class="ruby-keyword kw">else</span>
-400: <span class="ruby-comment cmt"># The port is already occupied by another</span>
-401: <span class="ruby-comment cmt"># Breakpoint service. We will try to tell</span>
-402: <span class="ruby-comment cmt"># the old service that we want its port.</span>
-403: <span class="ruby-comment cmt"># It will then forward that request to the</span>
-404: <span class="ruby-comment cmt"># user and retry.</span>
-405: <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">did_collision</span> <span class="ruby-keyword kw">then</span>
-406: <span class="ruby-constant">DRbObject</span>.<span class="ruby-identifier">new</span>(<span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">uri</span>).<span class="ruby-identifier">collision</span>
-407: <span class="ruby-identifier">did_collision</span> = <span class="ruby-keyword kw">true</span>
-408: <span class="ruby-keyword kw">end</span>
-409: <span class="ruby-identifier">sleep</span>(<span class="ruby-value">10</span>)
-410: <span class="ruby-keyword kw">retry</span>
-411: <span class="ruby-keyword kw">end</span>
-412: <span class="ruby-keyword kw">end</span>
-413:
-414: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">true</span>
-415: <span class="ruby-keyword kw">end</span>
-</pre>
- </div>
- </div>
- </div>
-
- <div id="method-M000005" class="method-detail">
- <a name="M000005"></a>
-
- <div class="method-heading">
- <a href="#M000005" class="method-signature">
- <span class="method-name">assert</span><span class="method-args">(context = nil) {|| ...}</span>
- </a>
- </div>
-
- <div class="method-description">
- <p>
-This asserts that the block evaluates to true. If it doesn’t evaluate
-to true a breakpoint will automatically be created at that execution point.
-</p>
-<p>
-You can disable assert checking in production code by setting
-Breakpoint.optimize_asserts to true. (It will still be enabled when Ruby is
-run via the -d argument.)
-</p>
-<p>
-Example:
-</p>
-<pre>
- person_name = "Foobar"
- assert { not person_name.nil? }
-</pre>
-<p>
-Note: If you want to use this method from an unit test, you will have to
-call it by its full name, <a
-href="Breakpoint.html#M000005">Breakpoint.assert</a>.
-</p>
- <p><a class="source-toggle" href="#"
- onclick="toggleCode('M000005-source');return false;">[Source]</a></p>
- <div class="method-source-code" id="M000005-source">
-<pre>
- <span class="ruby-comment cmt"># File lib/breakpoint.rb, line 248</span>
-248: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">assert</span>(<span class="ruby-identifier">context</span> = <span class="ruby-keyword kw">nil</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">condition</span>)
-249: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">if</span> <span class="ruby-constant">Breakpoint</span>.<span class="ruby-identifier">optimize_asserts</span> <span class="ruby-keyword kw">and</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">$DEBUG</span>
-250: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">yield</span>
-251:
-252: <span class="ruby-identifier">callstack</span> = <span class="ruby-identifier">caller</span>
-253: <span class="ruby-identifier">callstack</span>.<span class="ruby-identifier">slice!</span>(<span class="ruby-value">0</span>, <span class="ruby-value">3</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">callstack</span>.<span class="ruby-identifier">first</span>[<span class="ruby-value str">"assert"</span>]
-254: <span class="ruby-identifier">file</span>, <span class="ruby-identifier">line</span>, <span class="ruby-identifier">method</span> = <span class="ruby-operator">*</span><span class="ruby-identifier">callstack</span>.<span class="ruby-identifier">first</span>.<span class="ruby-identifier">match</span>(<span class="ruby-regexp re">/^(.+?):(\d+)(?::in `(.*?)')?/</span>).<span class="ruby-identifier">captures</span>
-255:
-256: <span class="ruby-identifier">message</span> = <span class="ruby-node">"Assert failed at #{file}:#{line}#{" in `#{method}'" if method}."</span>
-257:
-258: <span class="ruby-keyword kw">if</span> <span class="ruby-constant">Breakpoint</span>.<span class="ruby-identifier">asserts_cause_exceptions</span> <span class="ruby-keyword kw">and</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">$DEBUG</span> <span class="ruby-keyword kw">then</span>
-259: <span class="ruby-identifier">raise</span>(<span class="ruby-constant">Breakpoint</span><span class="ruby-operator">::</span><span class="ruby-constant">FailedAssertError</span>, <span class="ruby-identifier">message</span>)
-260: <span class="ruby-keyword kw">end</span>
-261:
-262: <span class="ruby-identifier">message</span> <span class="ruby-operator">+=</span> <span class="ruby-value str">" Executing implicit breakpoint."</span>
-263:
-264: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">context</span> <span class="ruby-keyword kw">then</span>
-265: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">handle_breakpoint</span>(<span class="ruby-identifier">context</span>, <span class="ruby-identifier">message</span>, <span class="ruby-identifier">file</span>, <span class="ruby-identifier">line</span>)
-266: <span class="ruby-keyword kw">end</span>
-267:
-268: <span class="ruby-constant">Binding</span>.<span class="ruby-identifier">of_caller</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">context</span><span class="ruby-operator">|</span>
-269: <span class="ruby-identifier">handle_breakpoint</span>(<span class="ruby-identifier">context</span>, <span class="ruby-identifier">message</span>, <span class="ruby-identifier">file</span>, <span class="ruby-identifier">line</span>)
-270: <span class="ruby-keyword kw">end</span>
-271: <span class="ruby-keyword kw">end</span>
-</pre>
- </div>
- </div>
- </div>
-
- <div id="method-M000004" class="method-detail">
- <a name="M000004"></a>
-
- <div class="method-heading">
- <a href="#M000004" class="method-signature">
- <span class="method-name">breakpoint</span><span class="method-args">(id = nil, context = nil, &block)</span>
- </a>
- </div>
-
- <div class="method-description">
- <p>
-This will pop up an interactive ruby session at a pre-defined break point
-in a Ruby application. In this session you can examine the environment of
-the break point.
-</p>
-<p>
-You can get a list of variables in the context using local_variables via
-<tt>local_variables</tt>. You can then examine their values by typing their
-names.
-</p>
-<p>
-You can have a look at the call stack via <tt>caller</tt>.
-</p>
-<p>
-The source code around the location where the breakpoint was executed can
-be examined via <tt>source_lines</tt>. Its argument specifies how much
-lines of context to display. The default amount of context is 5 lines. Note
-that the call to <tt>source_lines</tt> can raise an exception when it
-isn’t able to read in the source code.
-</p>
-<p>
-breakpoints can also return a value. They will execute a supplied block for
-getting a default return value. A custom value can be returned from the
-session by doing +throw(:debug_return, value)+.
-</p>
-<p>
-You can also give names to break points which will be used in the message
-that is displayed upon execution of them.
-</p>
-<p>
-Here’s a sample of how breakpoints should be placed:
-</p>
-<pre>
- class Person
- def initialize(name, age)
- @name, @age = name, age
- breakpoint("Person#initialize")
- end
-
- attr_reader :age
- def name
- breakpoint("Person#name") { @name }
- end
- end
-
- person = Person.new("Random Person", 23)
- puts "Name: #{person.name}"
-</pre>
-<p>
-And here is a sample debug session:
-</p>
-<pre>
- Executing break point "Person#initialize" at file.rb:4 in `initialize'
- irb(#<Person:0x292fbe8>):001:0> local_variables
- => ["name", "age", "_", "__"]
- irb(#<Person:0x292fbe8>):002:0> [name, age]
- => ["Random Person", 23]
- irb(#<Person:0x292fbe8>):003:0> [@name, @age]
- => ["Random Person", 23]
- irb(#<Person:0x292fbe8>):004:0> self
- => #<Person:0x292fbe8 @age=23, @name="Random Person">
- irb(#<Person:0x292fbe8>):005:0> @age += 1; self
- => #<Person:0x292fbe8 @age=24, @name="Random Person">
- irb(#<Person:0x292fbe8>):006:0> exit
- Executing break point "Person#name" at file.rb:9 in `name'
- irb(#<Person:0x292fbe8>):001:0> throw(:debug_return, "Overriden name")
- Name: Overriden name
-</pre>
-<p>
-<a href="Breakpoint.html">Breakpoint</a> sessions will automatically have a
-few convenience methods available. See <a
-href="Breakpoint/CommandBundle.html">Breakpoint::CommandBundle</a> for a
-list of them.
-</p>
-<p>
-Breakpoints can also be used remotely over sockets. This is implemented by
-running part of the IRB session in the application and part of it in a
-special client. You have to call <a
-href="Breakpoint.html#M000006">Breakpoint.activate_drb</a> to enable
-support for remote breakpoints and then run breakpoint_client.rb which is
-distributed with this library. See the documentation of <a
-href="Breakpoint.html#M000006">Breakpoint.activate_drb</a> for details.
-</p>
- <p><a class="source-toggle" href="#"
- onclick="toggleCode('M000004-source');return false;">[Source]</a></p>
- <div class="method-source-code" id="M000004-source">
-<pre>
- <span class="ruby-comment cmt"># File lib/breakpoint.rb, line 110</span>
-110: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">breakpoint</span>(<span class="ruby-identifier">id</span> = <span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">context</span> = <span class="ruby-keyword kw">nil</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
-111: <span class="ruby-identifier">callstack</span> = <span class="ruby-identifier">caller</span>
-112: <span class="ruby-identifier">callstack</span>.<span class="ruby-identifier">slice!</span>(<span class="ruby-value">0</span>, <span class="ruby-value">3</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">callstack</span>.<span class="ruby-identifier">first</span>[<span class="ruby-value str">"breakpoint"</span>]
-113: <span class="ruby-identifier">file</span>, <span class="ruby-identifier">line</span>, <span class="ruby-identifier">method</span> = <span class="ruby-operator">*</span><span class="ruby-identifier">callstack</span>.<span class="ruby-identifier">first</span>.<span class="ruby-identifier">match</span>(<span class="ruby-regexp re">/^(.+?):(\d+)(?::in `(.*?)')?/</span>).<span class="ruby-identifier">captures</span>
-114:
-115: <span class="ruby-identifier">message</span> = <span class="ruby-value str">"Executing break point "</span> <span class="ruby-operator">+</span> (<span class="ruby-identifier">id</span> <span class="ruby-value">? </span><span class="ruby-node">"#{id.inspect} "</span> <span class="ruby-operator">:</span> <span class="ruby-value str">""</span>) <span class="ruby-operator">+</span>
-116: <span class="ruby-node">"at #{file}:#{line}"</span> <span class="ruby-operator">+</span> (<span class="ruby-identifier">method</span> <span class="ruby-value">? </span><span class="ruby-node">" in `#{method}'"</span> <span class="ruby-operator">:</span> <span class="ruby-value str">""</span>)
-117:
-118: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">context</span> <span class="ruby-keyword kw">then</span>
-119: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">handle_breakpoint</span>(<span class="ruby-identifier">context</span>, <span class="ruby-identifier">message</span>, <span class="ruby-identifier">file</span>, <span class="ruby-identifier">line</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
-120: <span class="ruby-keyword kw">end</span>
-121:
-122: <span class="ruby-constant">Binding</span>.<span class="ruby-identifier">of_caller</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">binding_context</span><span class="ruby-operator">|</span>
-123: <span class="ruby-identifier">handle_breakpoint</span>(<span class="ruby-identifier">binding_context</span>, <span class="ruby-identifier">message</span>, <span class="ruby-identifier">file</span>, <span class="ruby-identifier">line</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
-124: <span class="ruby-keyword kw">end</span>
-125: <span class="ruby-keyword kw">end</span>
-</pre>
- </div>
- </div>
- </div>
-
- <div id="method-M000007" class="method-detail">
- <a name="M000007"></a>
-
- <div class="method-heading">
- <a href="#M000007" class="method-signature">
- <span class="method-name">deactivate_drb</span><span class="method-args">()</span>
- </a>
- </div>
-
- <div class="method-description">
- <p>
-Deactivates a running <a href="Breakpoint.html">Breakpoint</a> service.
-</p>
- <p><a class="source-toggle" href="#"
- onclick="toggleCode('M000007-source');return false;">[Source]</a></p>
- <div class="method-source-code" id="M000007-source">
-<pre>
- <span class="ruby-comment cmt"># File lib/breakpoint.rb, line 418</span>
-418: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">deactivate_drb</span>
-419: <span class="ruby-constant">Thread</span>.<span class="ruby-identifier">exclusive</span> <span class="ruby-keyword kw">do</span>
-420: <span class="ruby-ivar">@service</span>.<span class="ruby-identifier">stop_service</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@service</span>.<span class="ruby-identifier">nil?</span>
-421: <span class="ruby-ivar">@service</span> = <span class="ruby-keyword kw">nil</span>
-422: <span class="ruby-ivar">@use_drb</span> = <span class="ruby-keyword kw">false</span>
-423: <span class="ruby-ivar">@drb_service</span> = <span class="ruby-keyword kw">nil</span>
-424: <span class="ruby-keyword kw">end</span>
-425: <span class="ruby-keyword kw">end</span>
-</pre>
- </div>
- </div>
- </div>
-
- <div id="method-M000008" class="method-detail">
- <a name="M000008"></a>
-
- <div class="method-heading">
- <a href="#M000008" class="method-signature">
- <span class="method-name">use_drb?</span><span class="method-args">()</span>
- </a>
- </div>
-
- <div class="method-description">
- <p>
-Returns true when Breakpoints are used over DRb. <a
-href="Breakpoint.html#M000006">Breakpoint.activate_drb</a> causes this to
-be true.
-</p>
- <p><a class="source-toggle" href="#"
- onclick="toggleCode('M000008-source');return false;">[Source]</a></p>
- <div class="method-source-code" id="M000008-source">
-<pre>
- <span class="ruby-comment cmt"># File lib/breakpoint.rb, line 429</span>
-429: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">use_drb?</span>
-430: <span class="ruby-ivar">@use_drb</span> <span class="ruby-operator">==</span> <span class="ruby-keyword kw">true</span>
-431: <span class="ruby-keyword kw">end</span>
-</pre>
- </div>
- </div>
- </div>
-
-
- </div>
-
-
- </div>
-
-
-<div id="validator-badges">
- <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
-</div>
-
-</body>
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>Module: Breakpoint</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
+ <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
+ <script type="text/javascript">
+ // <![CDATA[
+
+ function popupCode( url ) {
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
+ }
+
+ function toggleCode( id ) {
+ if ( document.getElementById )
+ elem = document.getElementById( id );
+ else if ( document.all )
+ elem = eval( "document.all." + id );
+ else
+ return false;
+
+ elemStyle = elem.style;
+
+ if ( elemStyle.display != "block" ) {
+ elemStyle.display = "block"
+ } else {
+ elemStyle.display = "none"
+ }
+
+ return true;
+ }
+
+ // Make codeblocks hidden by default
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
+
+ // ]]>
+ </script>
+
+</head>
+<body>
+
+
+
+ <div id="classHeader">
+ <table class="header-table">
+ <tr class="top-aligned-row">
+ <td><strong>Module</strong></td>
+ <td class="class-name-in-header">Breakpoint</td>
+ </tr>
+ <tr class="top-aligned-row">
+ <td><strong>In:</strong></td>
+ <td>
+ <a href="../files/lib/breakpoint_rb.html">
+ lib/breakpoint.rb
+ </a>
+ <br />
+ </td>
+ </tr>
+
+ </table>
+ </div>
+ <!-- banner header -->
+
+ <div id="bodyContent">
+
+
+
+ <div id="contextContent">
+
+
+
+ </div>
+
+ <div id="method-list">
+ <h3 class="section-bar">Methods</h3>
+
+ <div class="name-list">
+ <a href="#M000009">activate_drb</a>
+ <a href="#M000008">assert</a>
+ <a href="#M000007">breakpoint</a>
+ <a href="#M000010">deactivate_drb</a>
+ <a href="#M000011">use_drb?</a>
+ </div>
+ </div>
+
+ </div>
+
+
+ <!-- if includes -->
+
+ <div id="section">
+
+ <div id="class-list">
+ <h3 class="section-bar">Classes and Modules</h3>
+
+ Module <a href="Breakpoint/CommandBundle.html" class="link">Breakpoint::CommandBundle</a><br />
+Class <a href="Breakpoint/FailedAssertError.html" class="link">Breakpoint::FailedAssertError</a><br />
+
+ </div>
+
+ <div id="constants-list">
+ <h3 class="section-bar">Constants</h3>
+
+ <div class="name-list">
+ <table summary="Constants">
+ <tr class="top-aligned-row context-row">
+ <td class="context-item-name">Version</td>
+ <td>=</td>
+ <td class="context-item-value">current_version</td>
+ <td width="3em"> </td>
+ <td class="context-item-desc">
+The Version of ruby-breakpoint you are using as String of the 1.2.3 form
+where the digits stand for release, major and minor version respectively.
+
+</td>
+ </tr>
+ </table>
+ </div>
+ </div>
+
+
+
+ <div id="attribute-list">
+ <h3 class="section-bar">Attributes</h3>
+
+ <div class="name-list">
+ <table>
+ <tr class="top-aligned-row context-row">
+ <td class="context-item-name">asserts_cause_exceptions</td>
+ <td class="context-item-value"> [RW] </td>
+ <td class="context-item-desc">
+Whether an Exception should be raised on failed asserts in non-$DEBUG code
+or not. By default this is disabled.
+
+</td>
+ </tr>
+ <tr class="top-aligned-row context-row">
+ <td class="context-item-name">optimize_asserts</td>
+ <td class="context-item-value"> [RW] </td>
+ <td class="context-item-desc">
+Whether asserts should be ignored if not in debug mode. Debug mode can be
+enabled by running ruby with the -d switch or by setting $DEBUG to true.
+
+</td>
+ </tr>
+ </table>
+ </div>
+ </div>
+
+
+
+ <!-- if method_list -->
+ <div id="methods">
+ <h3 class="section-bar">Public Instance methods</h3>
+
+ <div id="method-M000009" class="method-detail">
+ <a name="M000009"></a>
+
+ <div class="method-heading">
+ <a href="#M000009" class="method-signature">
+ <span class="method-name">activate_drb</span><span class="method-args">(uri = nil, allowed_hosts = ['localhost', '127.0.0.1', '::1'],
ignore_collisions = false)</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ <p>
+Will run <a href="Breakpoint.html">Breakpoint</a> in DRb mode. This will
+spawn a server that can be attached to via the breakpoint-client command
+whenever a breakpoint is executed. This is useful when you are debugging
+CGI applications or other applications where you can’t access debug
+sessions via the standard input and output of your application.
+</p>
+<p>
+You can specify an URI where the DRb server will run at. This way you can
+specify the port the server runs on. The default URI is
+druby://localhost:42531.
+</p>
+<p>
+Please note that breakpoints will be skipped silently in case the DRb
+server can not spawned. (This can happen if the port is already used by
+another instance of your application on CGI or another application.)
+</p>
+<p>
+Also note that by default this will only allow access from localhost. You
+can however specify a list of allowed hosts or nil (to allow access from
+everywhere). But that will still not protect you from somebody reading the
+data as it goes through the net.
+</p>
+<p>
+A good approach for getting security and remote access is setting up an SSH
+tunnel between the DRb service and the client. This is usually done like
+this:
+</p>
+<p>
+$ ssh -L20000:127.0.0.1:20000 -R10000:127.0.0.1:10000 example.com (This
+will connect port 20000 at the client side to port 20000 at the server
+side, and port 10000 at the server side to port 10000 at the client side.)
+</p>
+<p>
+After that do this on the server side: (the code being debugged) <a
+href="Breakpoint.html#M000009">Breakpoint.activate_drb</a>("druby://127.0.0.1:20000",
+"localhost")
+</p>
+<p>
+And at the client side: ruby breakpoint_client.rb -c
+druby://127.0.0.1:10000 -s druby://127.0.0.1:20000
+</p>
+<p>
+Running through such a SSH proxy will also let you use breakpoint.rb in
+case you are behind a firewall.
+</p>
+<p>
+Detailed information about running DRb through firewalls is available at <a
+href="http://www.rubygarden.org/ruby?DrbTutorial">www.rubygarden.org/ruby?DrbTutorial</a>
+</p>
+<h2>Security considerations</h2>
+<p>
+Usually you will be fine when using the default druby:// URI and the
+default access control list. However, if you are sitting on a machine where
+there are local users that you likely can not trust (this is the case for
+example on most web hosts which have multiple users sitting on the same
+physical machine) you will be better off by doing client/server
+communication through a unix socket. This can be accomplished by calling
+with a drbunix:/ style URI, e.g. <tt><a
+href="Breakpoint.html#M000009">Breakpoint.activate_drb</a>(‘drbunix:/tmp/breakpoint_server’)</tt>.
+This will only work on Unix based platforms.
+</p>
+ <p><a class="source-toggle" href="#"
+ onclick="toggleCode('M000009-source');return false;">[Source]</a></p>
+ <div class="method-source-code" id="M000009-source">
+<pre>
+ <span class="ruby-comment cmt"># File lib/breakpoint.rb, line 398</span>
+398: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">activate_drb</span>(<span class="ruby-identifier">uri</span> = <span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">allowed_hosts</span> = [<span class="ruby-value str">'localhost'</span>, <span class="ruby-value str">'127.0.0.1'</span>, <span class="ruby-value str">'::1'</span>],
+399: <span class="ruby-identifier">ignore_collisions</span> = <span class="ruby-keyword kw">false</span>)
+400:
+401: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@use_drb</span>
+402:
+403: <span class="ruby-identifier">uri</span> <span class="ruby-operator">||=</span> <span class="ruby-value str">'druby://localhost:42531'</span>
+404:
+405: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">allowed_hosts</span> <span class="ruby-keyword kw">then</span>
+406: <span class="ruby-identifier">acl</span> = [<span class="ruby-value str">"deny"</span>, <span class="ruby-value str">"all"</span>]
+407:
+408: <span class="ruby-constant">Array</span>(<span class="ruby-identifier">allowed_hosts</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">host</span><span class="ruby-operator">|</span>
+409: <span class="ruby-identifier">acl</span> <span class="ruby-operator">+=</span> [<span class="ruby-value str">"allow"</span>, <span class="ruby-identifier">host</span>]
+410: <span class="ruby-keyword kw">end</span>
+411:
+412: <span class="ruby-constant">DRb</span>.<span class="ruby-identifier">install_acl</span>(<span class="ruby-constant">ACL</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">acl</span>))
+413: <span class="ruby-keyword kw">end</span>
+414:
+415: <span class="ruby-ivar">@use_drb</span> = <span class="ruby-keyword kw">true</span>
+416: <span class="ruby-ivar">@drb_service</span> = <span class="ruby-constant">DRbService</span>.<span class="ruby-identifier">new</span>
+417: <span class="ruby-identifier">did_collision</span> = <span class="ruby-keyword kw">false</span>
+418: <span class="ruby-keyword kw">begin</span>
+419: <span class="ruby-ivar">@service</span> = <span class="ruby-constant">DRb</span>.<span class="ruby-identifier">start_service</span>(<span class="ruby-identifier">uri</span>, <span class="ruby-ivar">@drb_service</span>)
+420: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Errno</span><span class="ruby-operator">::</span><span class="ruby-constant">EADDRINUSE</span>
+421: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">ignore_collisions</span> <span class="ruby-keyword kw">then</span>
+422: <span class="ruby-keyword kw">nil</span>
+423: <span class="ruby-keyword kw">else</span>
+424: <span class="ruby-comment cmt"># The port is already occupied by another
</span>
+425: <span class="ruby-comment cmt"># Breakpoint service. We will try to tell
</span>
+426: <span class="ruby-comment cmt"># the old service that we want its port.
</span>
+427: <span class="ruby-comment cmt"># It will then forward that request to the
</span>
+428: <span class="ruby-comment cmt"># user and retry.
</span>
+429: <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">did_collision</span> <span class="ruby-keyword kw">then</span>
+430: <span class="ruby-constant">DRbObject</span>.<span class="ruby-identifier">new</span>(<span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">uri</span>).<span class="ruby-identifier">collision</span>
+431: <span class="ruby-identifier">did_collision</span> = <span class="ruby-keyword kw">true</span>
+432: <span class="ruby-keyword kw">end</span>
+433: <span class="ruby-identifier">sleep</span>(<span class="ruby-value">10</span>)
+434: <span class="ruby-keyword kw">retry</span>
+435: <span class="ruby-keyword kw">end</span>
+436: <span class="ruby-keyword kw">end</span>
+437:
+438: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">true</span>
+439: <span class="ruby-keyword kw">end</span>
+</pre>
+ </div>
+ </div>
+ </div>
+
+ <div id="method-M000008" class="method-detail">
+ <a name="M000008"></a>
+
+ <div class="method-heading">
+ <a href="#M000008" class="method-signature">
+ <span class="method-name">assert</span><span class="method-args">(context = nil) {|| ...}</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ <p>
+This asserts that the block evaluates to true. If it doesn’t evaluate
+to true a breakpoint will automatically be created at that execution point.
+</p>
+<p>
+You can disable assert checking in production code by setting
+Breakpoint.optimize_asserts to true. (It will still be enabled when Ruby is
+run via the -d argument.)
+</p>
+<p>
+Example:
+</p>
+<pre>
+ person_name = "Foobar"
+ assert { not person_name.nil? }
+</pre>
+<p>
+Note: If you want to use this method from an unit test, you will have to
+call it by its full name, <a
+href="Breakpoint.html#M000008">Breakpoint.assert</a>.
+</p>
+ <p><a class="source-toggle" href="#"
+ onclick="toggleCode('M000008-source');return false;">[Source]</a></p>
+ <div class="method-source-code" id="M000008-source">
+<pre>
+ <span class="ruby-comment cmt"># File lib/breakpoint.rb, line 268</span>
+268: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">assert</span>(<span class="ruby-identifier">context</span> = <span class="ruby-keyword kw">nil</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">condition</span>)
+269: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">if</span> <span class="ruby-constant">Breakpoint</span>.<span class="ruby-identifier">optimize_asserts</span> <span class="ruby-keyword kw">and</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">$DEBUG</span>
+270: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">yield</span>
+271:
+272: <span class="ruby-identifier">callstack</span> = <span class="ruby-identifier">caller</span>
+273: <span class="ruby-identifier">callstack</span>.<span class="ruby-identifier">slice!</span>(<span class="ruby-value">0</span>, <span class="ruby-value">3</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">callstack</span>.<span class="ruby-identifier">first</span>[<span class="ruby-value str">"assert"</span>]
+274: <span class="ruby-identifier">file</span>, <span class="ruby-identifier">line</span>, <span class="ruby-identifier">method</span> = <span class="ruby-operator">*</span><span class="ruby-identifier">callstack</span>.<span class="ruby-identifier">first</span>.<span class="ruby-identifier">match</span>(<span class="ruby-regexp re">/^(.+?):(\d+)(?::in `(.*?)')?/</span>).<span class="ruby-identifier">captures</span>
+275:
+276: <span class="ruby-identifier">message</span> = <span class="ruby-node">"Assert failed at #{file}:#{line}#{" in `#{method}'" if method}."</span>
+277:
+278: <span class="ruby-keyword kw">if</span> <span class="ruby-constant">Breakpoint</span>.<span class="ruby-identifier">asserts_cause_exceptions</span> <span class="ruby-keyword kw">and</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">$DEBUG</span> <span class="ruby-keyword kw">then</span>
+279: <span class="ruby-identifier">raise</span>(<span class="ruby-constant">Breakpoint</span><span class="ruby-operator">::</span><span class="ruby-constant">FailedAssertError</span>, <span class="ruby-identifier">message</span>)
+280: <span class="ruby-keyword kw">end</span>
+281:
+282: <span class="ruby-identifier">message</span> <span class="ruby-operator">+=</span> <span class="ruby-value str">" Executing implicit breakpoint."</span>
+283:
+284: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">context</span> <span class="ruby-keyword kw">then</span>
+285: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">handle_breakpoint</span>(<span class="ruby-identifier">context</span>, <span class="ruby-identifier">message</span>, <span class="ruby-identifier">file</span>, <span class="ruby-identifier">line</span>)
+286: <span class="ruby-keyword kw">end</span>
+287:
+288: <span class="ruby-constant">Binding</span>.<span class="ruby-identifier">of_caller</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">context</span><span class="ruby-operator">|</span>
+289: <span class="ruby-identifier">handle_breakpoint</span>(<span class="ruby-identifier">context</span>, <span class="ruby-identifier">message</span>, <span class="ruby-identifier">file</span>, <span class="ruby-identifier">line</span>)
+290: <span class="ruby-keyword kw">end</span>
+291: <span class="ruby-keyword kw">end</span>
+</pre>
+ </div>
+ </div>
+ </div>
+
+ <div id="method-M000007" class="method-detail">
+ <a name="M000007"></a>
+
+ <div class="method-heading">
+ <a href="#M000007" class="method-signature">
+ <span class="method-name">breakpoint</span><span class="method-args">(id = nil, context = nil, &block)</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ <p>
+This will pop up an interactive ruby session at a pre-defined break point
+in a Ruby application. In this session you can examine the environment of
+the break point.
+</p>
+<p>
+You can get a list of variables in the context using local_variables via
+<tt>local_variables</tt>. You can then examine their values by typing their
+names.
+</p>
+<p>
+You can have a look at the call stack via <tt>caller</tt>.
+</p>
+<p>
+The source code around the location where the breakpoint was executed can
+be examined via <tt>source_lines</tt>. Its argument specifies how much
+lines of context to display. The default amount of context is 5 lines. Note
+that the call to <tt>source_lines</tt> can raise an exception when it
+isn’t able to read in the source code.
+</p>
+<p>
+breakpoints can also return a value. They will execute a supplied block for
+getting a default return value. A custom value can be returned from the
+session by doing <tt>throw(:debug_return, value)</tt>.
+</p>
+<p>
+You can also give names to break points which will be used in the message
+that is displayed upon execution of them.
+</p>
+<p>
+Here’s a sample of how breakpoints should be placed:
+</p>
+<pre>
+ class Person
+ def initialize(name, age)
+ @name, @age = name, age
+ breakpoint("Person#initialize")
+ end
+
+ attr_reader :age
+ def name
+ breakpoint("Person#name") { @name }
+ end
+ end
+
+ person = Person.new("Random Person", 23)
+ puts "Name: #{person.name}"
+</pre>
+<p>
+And here is a sample debug session:
+</p>
+<pre>
+ Executing break point "Person#initialize" at file.rb:4 in `initialize'
+ irb(#<Person:0x292fbe8>):001:0> local_variables
+ => ["name", "age", "_", "__"]
+ irb(#<Person:0x292fbe8>):002:0> [name, age]
+ => ["Random Person", 23]
+ irb(#<Person:0x292fbe8>):003:0> [@name, @age]
+ => ["Random Person", 23]
+ irb(#<Person:0x292fbe8>):004:0> self
+ => #<Person:0x292fbe8 @age=23, @name="Random Person">
+ irb(#<Person:0x292fbe8>):005:0> @age += 1; self
+ => #<Person:0x292fbe8 @age=24, @name="Random Person">
+ irb(#<Person:0x292fbe8>):006:0> exit
+ Executing break point "Person#name" at file.rb:9 in `name'
+ irb(#<Person:0x292fbe8>):001:0> throw(:debug_return, "Overriden name")
+ Name: Overriden name
+</pre>
+<p>
+<a href="Breakpoint.html">Breakpoint</a> sessions will automatically have a
+few convenience methods available. See <a
+href="Breakpoint/CommandBundle.html">Breakpoint::CommandBundle</a> for a
+list of them.
+</p>
+<p>
+Breakpoints can also be used remotely over sockets. This is implemented by
+running part of the IRB session in the application and part of it in a
+special client. You have to call <a
+href="Breakpoint.html#M000009">Breakpoint.activate_drb</a> to enable
+support for remote breakpoints and then run breakpoint_client.rb which is
+distributed with this library. See the documentation of <a
+href="Breakpoint.html#M000009">Breakpoint.activate_drb</a> for details.
+</p>
+<p>
+Please use breakpoint() instead of <a
+href="Breakpoint.html#M000007">Breakpoint.breakpoint</a>(). If you use <a
+href="Breakpoint.html#M000007">Breakpoint.breakpoint</a>() you might get a
+shell with a wrong self context meaning that you will not be able to access
+instance variables, call methods on the object where you are breakpointing
+and so on. You will however still be able to access local variables.
+</p>
+<p>
+The former is believed to be caused by a bug in Ruby and it has been
+reported to ruby-core: <a
+href="http://www.ruby-forum.com/topic/67255">www.ruby-forum.com/topic/67255</a>
+</p>
+ <p><a class="source-toggle" href="#"
+ onclick="toggleCode('M000007-source');return false;">[Source]</a></p>
+ <div class="method-source-code" id="M000007-source">
+<pre>
+ <span class="ruby-comment cmt"># File lib/breakpoint.rb, line 120</span>
+120: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">breakpoint</span>(<span class="ruby-identifier">id</span> = <span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">context</span> = <span class="ruby-keyword kw">nil</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
+121: <span class="ruby-identifier">callstack</span> = <span class="ruby-identifier">caller</span>
+122: <span class="ruby-identifier">callstack</span>.<span class="ruby-identifier">slice!</span>(<span class="ruby-value">0</span>, <span class="ruby-value">3</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">callstack</span>.<span class="ruby-identifier">first</span>[<span class="ruby-value str">"breakpoint"</span>]
+123: <span class="ruby-identifier">file</span>, <span class="ruby-identifier">line</span>, <span class="ruby-identifier">method</span> = <span class="ruby-operator">*</span><span class="ruby-identifier">callstack</span>.<span class="ruby-identifier">first</span>.<span class="ruby-identifier">match</span>(<span class="ruby-regexp re">/^(.+?):(\d+)(?::in `(.*?)')?/</span>).<span class="ruby-identifier">captures</span>
+124:
+125: <span class="ruby-identifier">message</span> = <span class="ruby-value str">"Executing break point "</span> <span class="ruby-operator">+</span> (<span class="ruby-identifier">id</span> <span class="ruby-value">? </span><span class="ruby-node">"#{id.inspect} "</span> <span class="ruby-operator">:</span> <span class="ruby-value str">""</span>) <span class="ruby-operator">+</span>
+126: <span class="ruby-node">"at #{file}:#{line}"</span> <span class="ruby-operator">+</span> (<span class="ruby-identifier">method</span> <span class="ruby-value">? </span><span class="ruby-node">" in `#{method}'"</span> <span class="ruby-operator">:</span> <span class="ruby-value str">""</span>)
+127:
+128: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">context</span> <span class="ruby-keyword kw">then</span>
+129: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">handle_breakpoint</span>(<span class="ruby-identifier">context</span>, <span class="ruby-identifier">message</span>, <span class="ruby-identifier">file</span>, <span class="ruby-identifier">line</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
+130: <span class="ruby-keyword kw">end</span>
+131:
+132: <span class="ruby-constant">Binding</span>.<span class="ruby-identifier">of_caller</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">binding_context</span><span class="ruby-operator">|</span>
+133: <span class="ruby-identifier">handle_breakpoint</span>(<span class="ruby-identifier">binding_context</span>, <span class="ruby-identifier">message</span>, <span class="ruby-identifier">file</span>, <span class="ruby-identifier">line</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
+134: <span class="ruby-keyword kw">end</span>
+135: <span class="ruby-keyword kw">end</span>
+</pre>
+ </div>
+ </div>
+ </div>
+
+ <div id="method-M000010" class="method-detail">
+ <a name="M000010"></a>
+
+ <div class="method-heading">
+ <a href="#M000010" class="method-signature">
+ <span class="method-name">deactivate_drb</span><span class="method-args">()</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ <p>
+Deactivates a running <a href="Breakpoint.html">Breakpoint</a> service.
+</p>
+ <p><a class="source-toggle" href="#"
+ onclick="toggleCode('M000010-source');return false;">[Source]</a></p>
+ <div class="method-source-code" id="M000010-source">
+<pre>
+ <span class="ruby-comment cmt"># File lib/breakpoint.rb, line 442</span>
+442: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">deactivate_drb</span>
+443: <span class="ruby-constant">Thread</span>.<span class="ruby-identifier">exclusive</span> <span class="ruby-keyword kw">do</span>
+444: <span class="ruby-ivar">@service</span>.<span class="ruby-identifier">stop_service</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@service</span>.<span class="ruby-identifier">nil?</span>
+445: <span class="ruby-ivar">@service</span> = <span class="ruby-keyword kw">nil</span>
+446: <span class="ruby-ivar">@use_drb</span> = <span class="ruby-keyword kw">false</span>
+447: <span class="ruby-ivar">@drb_service</span> = <span class="ruby-keyword kw">nil</span>
+448: <span class="ruby-keyword kw">end</span>
+449: <span class="ruby-keyword kw">end</span>
+</pre>
+ </div>
+ </div>
+ </div>
+
+ <div id="method-M000011" class="method-detail">
+ <a name="M000011"></a>
+
+ <div class="method-heading">
+ <a href="#M000011" class="method-signature">
+ <span class="method-name">use_drb?</span><span class="method-args">()</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ <p>
+Returns true when Breakpoints are used over DRb. <a
+href="Breakpoint.html#M000009">Breakpoint.activate_drb</a> causes this to
+be true.
+</p>
+ <p><a class="source-toggle" href="#"
+ onclick="toggleCode('M000011-source');return false;">[Source]</a></p>
+ <div class="method-source-code" id="M000011-source">
+<pre>
+ <span class="ruby-comment cmt"># File lib/breakpoint.rb, line 453</span>
+453: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">use_drb?</span>
+454: <span class="ruby-ivar">@use_drb</span> <span class="ruby-operator">==</span> <span class="ruby-keyword kw">true</span>
+455: <span class="ruby-keyword kw">end</span>
+</pre>
+ </div>
+ </div>
+ </div>
+
+
+ </div>
+
+
+ </div>
+
+
+<div id="validator-badges">
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
+</div>
+
+</body>
</html>
\ No newline at end of file