PageRenderTime 58ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 1ms

/html/docs-dbgp.php

https://github.com/WouterJ/xdebug.org
PHP | 2872 lines | 2867 code | 5 blank | 0 comment | 124 complexity | ce24263add14c081cf51441a69d630ea MD5 | raw file

Large files files are truncated, but you can click here to view the full file

  1. <?php $title = "Xdebug: Documentation - Protocol - DBGp"; include "include/header.php"; hits ('xdebug-docs-protocol'); ?>
  2. <tr>
  3. <td>&nbsp;</td>
  4. <td>
  5. <!-- MAIN FEATURE START -->
  6. <span class="sans">XDEBUG EXTENSION FOR PHP | DOCUMENTATION - PROTOCOL - DBGP</span><br />
  7. <?php include "include/menu-docs.php"; ?>
  8. <h1 class="title">DBGP - A common debugger protocol for languages and debugger UI communication</h1>
  9. <table class="docinfo" frame="void" rules="none">
  10. <col class="docinfo-name" />
  11. <col class="docinfo-content" />
  12. <tbody valign="top">
  13. <tr><th class="docinfo-name">Version:</th>
  14. <td>1.0</td></tr>
  15. <tr><th class="docinfo-name">Status:</th>
  16. <td>draft 17</td></tr>
  17. <tr><th class="docinfo-name">Authors:</th>
  18. <td>Shane Caraveo, ActiveState &lt;<a class="reference external" href="mailto:shanec&#64;ActiveState.com">shanec&#64;ActiveState.com</a>&gt;
  19. <br />Derick Rethans &lt;<a class="reference external" href="mailto:derick&#64;derickrethans.nl">derick&#64;derickrethans.nl</a>&gt;</td></tr>
  20. </tbody>
  21. </table>
  22. <div class="contents topic" id="contents">
  23. <p class="topic-title first">Contents</p>
  24. <ul class="simple">
  25. <li><a class="reference internal" href="#description" id="id11">1. Description</a></li>
  26. <li><a class="reference internal" href="#issues" id="id12">1.1 Issues</a></li>
  27. <li><a class="reference internal" href="#requirements" id="id13">2. Requirements</a></li>
  28. <li><a class="reference internal" href="#terminology" id="id14">3. Terminology</a></li>
  29. <li><a class="reference internal" href="#security" id="id15">4. Security</a></li>
  30. <li><a class="reference internal" href="#initiating-a-debugging-session" id="id16">5. Initiating a debugging session</a><ul>
  31. <li><a class="reference internal" href="#standard-dbgp-port" id="id17">5.1 Standard DBGP port</a></li>
  32. <li><a class="reference internal" href="#connection-initialization" id="id18">5.2 Connection Initialization</a></li>
  33. <li><a class="reference internal" href="#just-in-time-debugging-and-debugger-proxies" id="id19">5.3 Just in time debugging and debugger proxies</a><ul>
  34. <li><a class="reference internal" href="#init-packet-handling" id="id20">5.3.1 Init Packet Handling</a></li>
  35. <li><a class="reference internal" href="#proxy-errors" id="id21">5.3.2 Proxy Errors</a></li>
  36. <li><a class="reference internal" href="#proxy-ports" id="id22">5.3.3 Proxy Ports</a></li>
  37. </ul>
  38. </li>
  39. <li><a class="reference internal" href="#multiple-processes-or-threads" id="id23">5.4 Multiple Processes or Threads</a></li>
  40. <li><a class="reference internal" href="#feature-negotiation" id="id24">5.5 Feature Negotiation</a><ul>
  41. <li><a class="reference internal" href="#data-packet-negotiation" id="id25">Data packet negotiation</a></li>
  42. <li><a class="reference internal" href="#asynchronous-communications" id="id26">Asynchronous Communications</a></li>
  43. </ul>
  44. </li>
  45. </ul>
  46. </li>
  47. <li><a class="reference internal" href="#message-packets" id="id27">6. Message Packets</a><ul>
  48. <li><a class="reference internal" href="#why-not-xml-both-ways" id="id28">6.1 Why not XML both ways?</a></li>
  49. <li><a class="reference internal" href="#packet-communications" id="id29">6.2 Packet Communications</a></li>
  50. <li><a class="reference internal" href="#ide-to-debugger-engine-communications" id="id30">6.3 IDE to debugger engine communications</a></li>
  51. <li><a class="reference internal" href="#debugger-engine-to-ide-communications" id="id31">6.4 debugger engine to IDE communications</a></li>
  52. <li><a class="reference internal" href="#debugger-engine-errors" id="id32">6.5 debugger engine errors</a></li>
  53. <li><a class="reference internal" href="#error-codes" id="id33">6.5.1 Error Codes</a></li>
  54. <li><a class="reference internal" href="#file-paths" id="id34">6.6 file paths</a></li>
  55. <li><a class="reference internal" href="#dynamic-code-and-virtual-files" id="id35">6.7 Dynamic code and virtual files</a></li>
  56. </ul>
  57. </li>
  58. <li><a class="reference internal" href="#core-commands" id="id36">7. Core Commands</a><ul>
  59. <li><a class="reference internal" href="#status" id="id37">7.1 status</a></li>
  60. <li><a class="reference internal" href="#options-and-configuration" id="id38">7.2 Options and Configuration</a><ul>
  61. <li><a class="reference internal" href="#feature-names" id="id39">7.2.1 Feature Names</a></li>
  62. <li><a class="reference internal" href="#feature-get" id="id40">7.2.2 feature_get</a></li>
  63. <li><a class="reference internal" href="#feature-set" id="id41">7.2.3 feature_set</a></li>
  64. </ul>
  65. </li>
  66. <li><a class="reference internal" href="#continuation-commands" id="id42">7.5 continuation commands</a></li>
  67. <li><a class="reference internal" href="#breakpoints" id="id43">7.6 breakpoints</a><ul>
  68. <li><a class="reference internal" href="#id1" id="id44">7.6.1 breakpoint_set</a></li>
  69. <li><a class="reference internal" href="#id2" id="id45">7.6.2 breakpoint_get</a></li>
  70. <li><a class="reference internal" href="#id3" id="id46">7.6.3 breakpoint_update</a></li>
  71. <li><a class="reference internal" href="#id4" id="id47">7.6.4 breakpoint_remove</a></li>
  72. <li><a class="reference internal" href="#id5" id="id48">7.6.5 breakpoint_list</a></li>
  73. </ul>
  74. </li>
  75. <li><a class="reference internal" href="#stack-depth" id="id49">7.7 stack_depth</a></li>
  76. <li><a class="reference internal" href="#stack-get" id="id50">7.8 stack_get</a></li>
  77. <li><a class="reference internal" href="#context-names" id="id51">7.9 context_names</a></li>
  78. <li><a class="reference internal" href="#context-get" id="id52">7.10 context_get</a></li>
  79. <li><a class="reference internal" href="#properties-variables-and-values" id="id53">7.11 Properties, variables and values</a></li>
  80. <li><a class="reference internal" href="#data-types" id="id54">7.12 Data Types</a><ul>
  81. <li><a class="reference internal" href="#common-data-types" id="id55">7.12.1 Common Data Types</a></li>
  82. <li><a class="reference internal" href="#typemap-get" id="id56">7.12.2 typemap_get</a></li>
  83. </ul>
  84. </li>
  85. <li><a class="reference internal" href="#property-get-property-set-property-value" id="id57">7.13 property_get, property_set, property_value</a></li>
  86. <li><a class="reference internal" href="#source" id="id58">7.14 source</a></li>
  87. <li><a class="reference internal" href="#stdout-stderr" id="id59">7.15 stdout, stderr</a></li>
  88. </ul>
  89. </li>
  90. <li><a class="reference internal" href="#extended-commands" id="id60">8. Extended Commands</a><ul>
  91. <li><a class="reference internal" href="#stdin" id="id61">8.1 stdin</a></li>
  92. <li><a class="reference internal" href="#break" id="id62">8.2 break</a></li>
  93. <li><a class="reference internal" href="#eval" id="id63">8.3 eval</a><ul>
  94. <li><a class="reference internal" href="#expr" id="id64">8.3.1 expr</a></li>
  95. <li><a class="reference internal" href="#exec" id="id65">8.3.2 exec</a></li>
  96. </ul>
  97. </li>
  98. <li><a class="reference internal" href="#spawnpoints" id="id66">8.4 spawnpoints</a><ul>
  99. <li><a class="reference internal" href="#id6" id="id67">8.4.1 spawnpoint_set</a></li>
  100. <li><a class="reference internal" href="#id7" id="id68">8.4.2 spawnpoint_get</a></li>
  101. <li><a class="reference internal" href="#id8" id="id69">8.4.3 spawnpoint_update</a></li>
  102. <li><a class="reference internal" href="#id9" id="id70">8.4.4 spawnpoint_remove</a></li>
  103. <li><a class="reference internal" href="#id10" id="id71">8.4.5 spawnpoint_list</a></li>
  104. </ul>
  105. </li>
  106. <li><a class="reference internal" href="#notifications" id="id72">8.5 Notifications</a><ul>
  107. <li><a class="reference internal" href="#standard-notifications" id="id73">8.5.1 Standard Notifications</a></li>
  108. </ul>
  109. </li>
  110. <li><a class="reference internal" href="#interact-interactive-shell" id="id74">8.6 interact - Interactive Shell</a></li>
  111. </ul>
  112. </li>
  113. <li><a class="reference internal" href="#a-changelog" id="id75">A. ChangeLog</a></li>
  114. </ul>
  115. </div>
  116. <div class="section" id="description">
  117. <h1><a class="toc-backref" href="#id11">1. Description</a></h1>
  118. <p>This document describes a simple protocol for use with language tools
  119. and engines for the purpose of debugging applications. It does not
  120. describe user interfaces or interactions with the debugger. The
  121. protocol provides a means of communication between a debugger
  122. engine (scripting engine, vm, etc.) and a debugger IDE (IDE, etc.).
  123. Any references to the debugger IDE UI are recommendations only, and are
  124. provided for additional explanation or as reasoning for specific
  125. design decisions.</p>
  126. </div>
  127. <div class="section" id="issues">
  128. <h1><a class="toc-backref" href="#id12">1.1 Issues</a></h1>
  129. <p>1. The handling of proxy errors needs to be clarified. Without both
  130. IDE and debugger engine supporting commands to be received at
  131. arbitrary times, the proxy may have problems sending error or status
  132. information to either one. See section 5.3.2. We should think a bit
  133. more about what a proxy might need to do.</p>
  134. </div>
  135. <div class="section" id="requirements">
  136. <h1><a class="toc-backref" href="#id13">2. Requirements</a></h1>
  137. <ul class="simple">
  138. <li>extensibility, allow for vendor or language specific features</li>
  139. <li>backwards and forwards compatibility</li>
  140. <li>firewall and tunneling support</li>
  141. <li>support for multiple languages</li>
  142. <li>support for multiple processes or threads</li>
  143. <li>support for dynamic and possibly for compiled languages</li>
  144. </ul>
  145. </div>
  146. <div class="section" id="terminology">
  147. <h1><a class="toc-backref" href="#id14">3. Terminology</a></h1>
  148. <dl class="docutils">
  149. <dt>IDE</dt>
  150. <dd>An IDE, or other debugger UI IDE or tool.</dd>
  151. <dt>debugger engine</dt>
  152. <dd>The language engine being debugged.</dd>
  153. <dt>proxy</dt>
  154. <dd>An intermediary demon that acts as a proxy, and may also
  155. implement support for other features such as just in time
  156. debugging, ip security, etc.</dd>
  157. <dt>session</dt>
  158. <dd>a single thread in an application. multiple threads in an
  159. application will attach separately.</dd>
  160. <dt>TRUE</dt>
  161. <dd>a value defined as TRUE should be a numeric one.</dd>
  162. <dt>FALSE</dt>
  163. <dd>a value defined as FALSE should be a numeric zero.</dd>
  164. <dt>NUM</dt>
  165. <dd>a base 10 numeric value that is stringified.</dd>
  166. </dl>
  167. </div>
  168. <div class="section" id="security">
  169. <h1><a class="toc-backref" href="#id15">4. Security</a></h1>
  170. <p>It is expected that implementations will provide security, such as ip
  171. filtering, ssh tunneling, etc. This protocol itself does not provide
  172. a means of securing the debugging session.</p>
  173. </div>
  174. <div class="section" id="initiating-a-debugging-session">
  175. <h1><a class="toc-backref" href="#id16">5. Initiating a debugging session</a></h1>
  176. <p>The debugger engine initiates a debugging session. The debugger engine
  177. will make a connection to a listening IDE, then wait for the IDE to
  178. initiate commands. The debugger engine does not step into the first line of
  179. execution until the IDE issues one of the continuation commands.
  180. The first thing that should happen in a debug session is that the IDE
  181. negotiates features using the feature_get and feature_set commands, and sets
  182. any additional data, such as breakpoints. Debugger engine implementations
  183. should store and data it receives if it is unable to process them prior to
  184. compiling and/or executing code. Commands such as stack_get should not be
  185. expected to work during this phase, otherwise known as the 'starting' state (see
  186. section 7.1 for status levels).</p>
  187. <p>Likewise, at the end of a debug session, there is a 'stopping' state. This state
  188. is entered after all execution is complete. For most debugger engine implementations,
  189. only a 'stop' command can be accepted at this point, however some implementations
  190. may provide additional commands for retrieving various data from the engine for
  191. post debug session processing.</p>
  192. <div class="section" id="standard-dbgp-port">
  193. <h2><a class="toc-backref" href="#id17">5.1 Standard DBGP port</a></h2>
  194. <p>The IDE listens on port 9000 for debugger connections, unless the
  195. IDE is using a proxy, in which case it may listen on any port. In
  196. that case, the IDE will tell the proxy which port it is listening on, and the
  197. proxy should listen on port 9000. While this document defines port 9000
  198. as the standard DBGP port, an implementation may support the use of any
  199. port. Current implementations accept various forms of configuration that
  200. allow this port to be defined.</p>
  201. </div>
  202. <div class="section" id="connection-initialization">
  203. <h2><a class="toc-backref" href="#id18">5.2 Connection Initialization</a></h2>
  204. <p>When a debugger engine connects to either a IDE or proxy, it must send an
  205. init packet:</p>
  206. <pre class="literal-block">
  207. &lt;init appid=&quot;APPID&quot;
  208. idekey=&quot;IDE_KEY&quot;
  209. session=&quot;DBGP_COOKIE&quot;
  210. thread=&quot;THREAD_ID&quot;
  211. parent=&quot;PARENT_APPID&quot;
  212. language=&quot;LANGUAGE_NAME&quot;
  213. protocol_version=&quot;1.0&quot;
  214. fileuri=&quot;file://path/to/file&quot;&gt;
  215. </pre>
  216. <p>Attributes in the init element can include:</p>
  217. <blockquote>
  218. <table border="1" class="docutils">
  219. <colgroup>
  220. <col width="22%" />
  221. <col width="78%" />
  222. </colgroup>
  223. <thead valign="bottom">
  224. <tr><th class="head">Attribute</th>
  225. <th class="head">Description</th>
  226. </tr>
  227. </thead>
  228. <tbody valign="top">
  229. <tr><td>appid</td>
  230. <td>defined by the debugger engine</td>
  231. </tr>
  232. <tr><td>idekey</td>
  233. <td>defined by the user. The DBGP_IDEKEY environment
  234. variable SHOULD be used if it is available,
  235. otherwise setting this value is debugger engine
  236. implementation specific. This value may be empty.</td>
  237. </tr>
  238. <tr><td>session</td>
  239. <td>If the environment variable DBGP_COOKIE exists,
  240. then the init packet MUST contain a session
  241. attribute with the value of the variable. This
  242. allows an IDE to execute a debugger engine, and
  243. maintain some state information between the
  244. execution and the protocol connection. This value
  245. should not be expected to be set in 'remote'
  246. debugging situations where the IDE is not in
  247. control of the process.</td>
  248. </tr>
  249. <tr><td>thread</td>
  250. <td>the systems thread id</td>
  251. </tr>
  252. <tr><td>parent</td>
  253. <td>the appid of the application that spawned the
  254. process. When an application is executed, it
  255. should set it's APPID into the environment.
  256. If an APPID already exists, it should first
  257. read that value and use it as the PARENT_APPID.</td>
  258. </tr>
  259. <tr><td>language</td>
  260. <td>debugger engine specific, must not contain
  261. additional information, such as version, etc.</td>
  262. </tr>
  263. <tr><td>protocol_version</td>
  264. <td>The highest version of this protocol supported</td>
  265. </tr>
  266. <tr><td>fileuri</td>
  267. <td>URI of the script file being debugged</td>
  268. </tr>
  269. </tbody>
  270. </table>
  271. </blockquote>
  272. <p>The IDE responds by dropping socket connection, or starting with
  273. debugger commands.</p>
  274. <p>The init packet may have child elements for additional vendor specific
  275. data. These are entirely optional and must not effect behavior
  276. of the debugger interaction. Suggested child elements include:</p>
  277. <pre class="literal-block">
  278. &lt;engine version=&quot;1.abcd&quot;&gt;product title&lt;/engine&gt;
  279. &lt;author&gt;author&lt;/author&gt;
  280. &lt;company&gt;company&lt;/company&gt;
  281. &lt;license&gt;licensing info&lt;/license&gt;
  282. &lt;url&gt;url&lt;/url&gt;
  283. &lt;copyright&gt;xxx&lt;/copyright&gt;
  284. </pre>
  285. </div>
  286. <div class="section" id="just-in-time-debugging-and-debugger-proxies">
  287. <h2><a class="toc-backref" href="#id19">5.3 Just in time debugging and debugger proxies</a></h2>
  288. <p>Proxies are supported to allow multiuser systems work with a defined
  289. port for debugging. Each IDE would listen on a unique port and notify the
  290. proxy what port it is listening on, along with a key value that is used by
  291. the debugger engine to specify which IDE it should be connected with.</p>
  292. <p>With the exception of the init packet, all communications
  293. will be passed through without modifications. A proxy could also implement
  294. support for just in time debugging. In this case, a debugger engine would
  295. break (perhaps on an error or exception) and connect to the proxy. The proxy
  296. would then start the IDE (if it is not already running) and initiate a
  297. debugging session with it.</p>
  298. <p>The method for handling just in time debugging is not defined by the protocol
  299. and is implementation specific. One example of how this may work is that the
  300. proxy has a configuration file that defines key's for each user, along with
  301. the path to the executable that will provide the UI for that user. The debugger
  302. engine would have to know this key value in advance and provide it to the proxy
  303. in the init packet (see IDE_KEY in section 5.2). The proxy would know if the
  304. IDE is running, since the IDE should have communicated with the proxy already,
  305. if it has not, the proxy could execute the IDE directly.</p>
  306. <p>To support proxies and jit deamons, the IDE should be configured with
  307. and ip:port pointing to the proxy/jit. The IDE then makes a
  308. connection to the proxy when it starts and sends the following command:</p>
  309. <blockquote>
  310. <p>IDE command</p>
  311. <pre class="literal-block">
  312. proxyinit -a ip:port -k ide_key -m [0|1]
  313. </pre>
  314. <table border="1" class="docutils">
  315. <colgroup>
  316. <col width="3%" />
  317. <col width="97%" />
  318. </colgroup>
  319. <tbody valign="top">
  320. <tr><td>-p</td>
  321. <td>the port that the IDE listens for debugging on. The address
  322. is retrieved from the connection information.</td>
  323. </tr>
  324. <tr><td>-k</td>
  325. <td>a IDE key, which the debugger engine will also use in it's
  326. debugging init command. this allows the proxy to match
  327. request to IDE. Typically the user will provide the
  328. session key as a configuration item.</td>
  329. </tr>
  330. <tr><td>-m</td>
  331. <td>this tells the demon that the IDE supports (or doesn't)
  332. multiple debugger sessions. if -m is missing, zero or no
  333. support is default.</td>
  334. </tr>
  335. </tbody>
  336. </table>
  337. <p>IDE command</p>
  338. <pre class="literal-block">
  339. proxystop -k ide_key
  340. </pre>
  341. <p>The IDE sends a proxystop command when it wants the proxy
  342. server to stop listening for it.</p>
  343. </blockquote>
  344. <p>The proxy should respond with a simple XML statement alerting the
  345. IDE to an error, or the success of the initialization (see section
  346. 6.5 for more details on the error element).</p>
  347. <pre class="literal-block">
  348. &lt;proxyinit success=&quot;[0|1]&quot;
  349. idekey=&quot;{ID}&quot;
  350. address=&quot;{IP_ADDRESS}&quot;
  351. port=&quot;{NUM}&gt;
  352. &lt;error id=&quot;app_specific_error_code&quot;&gt;
  353. &lt;message&gt;UI Usable Message&lt;/message&gt;
  354. &lt;/error&gt;
  355. &lt;/proxyinit&gt;
  356. </pre>
  357. <p>Once the IDE has sent this command, and received a confirmation, it
  358. disconnects from the proxy. The IDE will only connect to the proxy
  359. when it initially wants to start accepting connections from the proxy,
  360. or when it wants to stop accepting connections from the proxy.</p>
  361. <p>The address and port attributes of the returned proxyinit element are the
  362. address and port that the proxy is configured to listen for DBGP connections on.
  363. This information is returned to the IDE so that it may pass this information on
  364. to build systems or the user via some UI.</p>
  365. <div class="section" id="init-packet-handling">
  366. <h3><a class="toc-backref" href="#id20">5.3.1 Init Packet Handling</a></h3>
  367. <p>If a proxy receives the init packet (see section 5.2), it will use the
  368. idekey attribute to pass the request to the correct IDE, or to do some
  369. other operation such as which may be required to implement security or
  370. initiate just in time debugging. The proxy will add the idekey as a attribute
  371. to the init packet when it passes it through to the IDE. The proxy may
  372. also add child elements with further information, and must add an
  373. attribute to the init element called 'proxied' with the attribute
  374. value being the ip address of the debugger engine. This is the only
  375. time the proxy should modify data being passed to the IDE.</p>
  376. </div>
  377. <div class="section" id="proxy-errors">
  378. <h3><a class="toc-backref" href="#id21">5.3.2 Proxy Errors</a></h3>
  379. <p>If the proxy must send error data to the IDE, it may send an XML
  380. message with the root element named 'proxyerror'. This message will
  381. be in the format of the error packets defined in 6.3 below.</p>
  382. <p>If the proxy must send error data to the debugger engine, it may
  383. send the proxyerror command defined in section 7 below.</p>
  384. </div>
  385. <div class="section" id="proxy-ports">
  386. <h3><a class="toc-backref" href="#id22">5.3.3 Proxy Ports</a></h3>
  387. <p>The proxy listens for IDE connections on port 9001, and for debugger
  388. engine connections on port 9000. As with section 5.1, these ports may
  389. be configurable in the implementation.</p>
  390. </div>
  391. </div>
  392. <div class="section" id="multiple-processes-or-threads">
  393. <h2><a class="toc-backref" href="#id23">5.4 Multiple Processes or Threads</a></h2>
  394. <p>The debugger protocol is designed to use a separate socket connection
  395. for each process or thread. The IDE may or may not support
  396. multiple debugger sessions. If it does not, the debugger engine must
  397. not attempt to start debug sessions for threads, and the IDE should
  398. not accept more than one socket connection for debugging. The
  399. IDE should tell the debugger engine whether it supports multiple
  400. debugger sessions, the debugger engine should assume that the IDE does
  401. not. The IDE can use the feature_set command with the feature name of
  402. 'multiple_sessions' to notify the debugger engine that it supports multiple
  403. session debugging. The IDE may also query the the debugger engine specifically
  404. for multithreaded debugging support by using the feature_get command with
  405. a feature name of 'language_supports_threads'.</p>
  406. </div>
  407. <div class="section" id="feature-negotiation">
  408. <h2><a class="toc-backref" href="#id24">5.5 Feature Negotiation</a></h2>
  409. <p>Although the IDE may at any time during the debugging session send
  410. feature_get or feature_set commands, the IDE should be designed to
  411. negotiate the base set of features up front. Differing languages and
  412. debugger engines may operate in many ways, and the IDE should be
  413. prepared to handle these differences. Likewise, the IDE may dictate
  414. certain features or capabilities be supported by the debugger engine.
  415. In any case, the IDE should strive to work with all debugger engines
  416. that support this protocol. Therefore, this section describes a
  417. minimal set of features the debugger engine must support. These
  418. required features are outlined here in the form of discussion,
  419. actual implementation of feature arguments are detailed in section 7
  420. under the feature_get and feature_set commands.</p>
  421. <div class="section" id="data-packet-negotiation">
  422. <h3><a class="toc-backref" href="#id25">Data packet negotiation</a></h3>
  423. <p>IDE's may want to limit the size of data that is retrieved from
  424. debugger engines. While the debugger engines will define their own
  425. base default values, the IDE should negotiate these terms if it
  426. needs to. The debugger engine must support these requests from the
  427. IDE. This includes limits to the data size of a property or
  428. variable, and the depth limit to arrays, hashes, objects, or other
  429. tree like structures. The data size excludes any the protocol
  430. overhead.</p>
  431. </div>
  432. <div class="section" id="asynchronous-communications">
  433. <h3><a class="toc-backref" href="#id26">Asynchronous Communications</a></h3>
  434. <p>While the protocol does not depend on asynchronous socket support,
  435. certain design considerations may require that the IDE and/or debugger
  436. engine treat incoming and outgoing data in an asynchronous fashion.</p>
  437. <p>For ease of design, some implementations may choose to utilize this
  438. protocol in a completely synchronous fashion, and not implement
  439. optional commands that require the debugger engine to behave in an
  440. asynchronous fashion. One example of this is the break command.</p>
  441. <p>The break command is sent from the IDE while the debugger engine is
  442. in a run state. To support this, the debugger engine must periodically
  443. peek at the socket to see if there are any incoming commands. For
  444. this reason the break command is optional. If a command requires
  445. this type of asynchronous behavior on the part of the debugger
  446. engine it must be optional for the debugger engine to support it.</p>
  447. <p>On the other hand, IDE's MUST at times behave in an asynchronous
  448. fashion. When an IDE tells the debugger engine to enter a 'run' state,
  449. it must watch the socket for incoming packets for stdout or stderr,
  450. if it has requested the data be sent to it from the debugger engine.</p>
  451. <p>The form of asynchronous communications that may occur in this
  452. protocol are defined further in section 6.2 below.</p>
  453. </div>
  454. </div>
  455. </div>
  456. <div class="section" id="message-packets">
  457. <h1><a class="toc-backref" href="#id27">6. Message Packets</a></h1>
  458. <p>The IDE sends simple ASCII commands to the debugger engine. The
  459. debugger engine responds with XML data. The XML data is prepended
  460. with a stringified integer representing the number of bytes in the XML data
  461. packet. The length and XML data are separated by a NULL byte. The
  462. XML data is ended with a NULL byte. Neither the IDE or debugger engine
  463. packets may contain NULL bytes within the packet since it is used as
  464. a separator. Data must be encoded using base64.</p>
  465. <pre class="literal-block">
  466. IDE: command [SPACE] [args] -- data [NULL]
  467. DEBUGGER: [NUMBER] [NULL] XML(data) [NULL]
  468. </pre>
  469. <p>Arguments to the IDE commands are in the same format as common command
  470. line arguments, and should be parseable by common code such as getopt,
  471. or Pythons Cmd module:</p>
  472. <pre class="literal-block">
  473. command -a value -b value ...
  474. </pre>
  475. <p>If a value for an option includes a space, the value needs to be
  476. encoded. You can encode values by encasing them in double quotes:</p>
  477. <pre class="literal-block">
  478. property_get -i 5 -n &quot;$x['a b']&quot; -d 0 -c 0 -p 0
  479. </pre>
  480. <p>It is also possible to use escape characters in quoted strings:</p>
  481. <pre class="literal-block">
  482. property_get -i 6 -n &quot;$x[\&quot;a b\&quot;]&quot; -d 0 -c 0 -p 0
  483. </pre>
  484. <p>All numbers in the protocol are base 10 string representations, unless
  485. the number is noted to be debugger engine specific (eg. the address
  486. attribute on property elements).</p>
  487. <div class="section" id="why-not-xml-both-ways">
  488. <h2><a class="toc-backref" href="#id28">6.1 Why not XML both ways?</a></h2>
  489. <p>The primary reason is to avoid the requirement that a debugger
  490. engine has an XML parser available. XML is easy to generate, but
  491. requires additional libraries for parsing.</p>
  492. </div>
  493. <div class="section" id="packet-communications">
  494. <h2><a class="toc-backref" href="#id29">6.2 Packet Communications</a></h2>
  495. <p>The IDE sends a command, then waits for a response from the
  496. debugger engine. If the command is not received in a reasonable
  497. time (implementation dependent) it may assume the debugger engine
  498. has entered a non-responsive state. The exception to this is when
  499. the IDE sends a 'continuation' command which may not have an immediate response.</p>
  500. <p>'continuation' commands include, but may not be limited to: run, step_into,
  501. step_over, step_out and eval. When the debugger engine
  502. receives such a command, it is considered to have entered a
  503. 'run state'.</p>
  504. <p>During a 'continuation' command, the IDE should expect to possibly receive
  505. stdin and/or stderr packets from the debugger engine prior to
  506. receiving a response to the command itself. It may also possibly
  507. receive error packets from either the debugger engine, or a proxy
  508. if one is in use, either prior to the 'continuation' response, or in response
  509. to any other command.</p>
  510. <p>Stdout and stderr, if requested by the IDE, may only be sent during
  511. commands that have put the debugger engine into a 'run' state.</p>
  512. <p>If the debugger engine supports asynchronous commands, the IDE may also
  513. send commands while the debugger engine is in a 'run' state. These
  514. commands should be limited to commands such as the 'break' or 'status'
  515. commands for performance reasons, but this protocol does not impose
  516. such limitations. The debugger engine MUST respond to these commands
  517. prior to responding to the original 'run' command.</p>
  518. <p>An example of communication between IDE and debugger engines. (this
  519. is not an example of the actual protocol.)</p>
  520. <pre class="literal-block">
  521. IDE: feature_get supports_async
  522. DBG: yes
  523. IDE: stdin redirect
  524. DBG: ok
  525. IDE: stderr redirect
  526. DBG: ok
  527. IDE: run
  528. DBG: stdin data...
  529. DBG: stdin data...
  530. DBG: reached breakpoint, done running
  531. IDE: give me some variables
  532. DBG: ok, here they are
  533. IDE: evaluate this expression
  534. DBG: stderr data...
  535. DBG: ok, done
  536. IDE: run
  537. IDE: break
  538. DBG: ok, breaking
  539. DBG: at breakpoint, done running
  540. IDE: stop
  541. DBG: good bye
  542. </pre>
  543. </div>
  544. <div class="section" id="ide-to-debugger-engine-communications">
  545. <h2><a class="toc-backref" href="#id30">6.3 IDE to debugger engine communications</a></h2>
  546. <p>A debugging IDE (IDE) sends commands to the debugger engine in
  547. the form of command line arguments. One argument that is included in
  548. all commands is the data length. The data itself is the last part of
  549. the command line, after the -- separator. The data must be base64 encoded.</p>
  550. <pre class="literal-block">
  551. command [SPACE] [arguments] [SPACE] -- base64(data) [NULL]
  552. </pre>
  553. <p>Standard arguments for all commands</p>
  554. <pre class="literal-block">
  555. -i Transaction ID
  556. unique numerical ID for each command generated by the IDE
  557. </pre>
  558. </div>
  559. <div class="section" id="debugger-engine-to-ide-communications">
  560. <h2><a class="toc-backref" href="#id31">6.4 debugger engine to IDE communications</a></h2>
  561. <p>The debugger engine always replies or sends XML data. The standard
  562. namespace for the root elements returned from the debugger
  563. engine MUST be &quot;<a class="reference external" href="urn:debugger_protocol_v1">urn:debugger_protocol_v1</a>&quot;. Namespaces have been left
  564. out in the examples in this document. The messages sent by the
  565. debugger engine must always be NULL terminated. The XML document tag
  566. must always be present to provide XML version and encoding information.</p>
  567. <p>Two base tags are used for the root tags:</p>
  568. <pre class="literal-block">
  569. data_length
  570. [NULL]
  571. &lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
  572. &lt;response command=&quot;command_name&quot;
  573. transaction_id=&quot;transaction_id&quot;/&gt;
  574. [NULL]
  575. data_length
  576. [NULL]
  577. &lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
  578. &lt;stream type=&quot;stdout|stderr&quot;&gt;...Base64 Data...&lt;/stream&gt;
  579. [NULL]
  580. </pre>
  581. <p>For simplification, data length and NULL bytes will be left out of the
  582. rest of the examples in this document.</p>
  583. </div>
  584. <div class="section" id="debugger-engine-errors">
  585. <h2><a class="toc-backref" href="#id32">6.5 debugger engine errors</a></h2>
  586. <p>A debugger engine may need to relay error information back to the IDE in
  587. response to any command. The debugger engine may add an error element
  588. as a child of the response element. Note that this is not the same
  589. as getting language error messages, such as exception data. This is
  590. specifically a debugger engine error in response to a IDE
  591. command. IDEs and debugger engines may elect to support additional
  592. child elements in the error element, but should namespace the elements
  593. to avoid conflicts with other implementations.</p>
  594. <pre class="literal-block">
  595. &lt;response command=&quot;command_name&quot;
  596. transaction_id=&quot;transaction_id&quot;&gt;
  597. &lt;error code=&quot;error_code&quot; apperr=&quot;app_specific_error_code&quot;&gt;
  598. &lt;message&gt;UI Usable Message&lt;/message&gt;
  599. &lt;/error&gt;
  600. &lt;/response&gt;
  601. </pre>
  602. </div>
  603. <div class="section" id="error-codes">
  604. <h2><a class="toc-backref" href="#id33">6.5.1 Error Codes</a></h2>
  605. <p>The following are predefined error codes for the response to commands:</p>
  606. <p>000 Command parsing errors</p>
  607. <pre class="literal-block">
  608. 0 - no error
  609. 1 - parse error in command
  610. 2 - duplicate arguments in command
  611. 3 - invalid options (ie, missing a required option, invalid value for a
  612. passed option)
  613. 4 - Unimplemented command
  614. 5 - Command not available (Is used for async commands. For instance
  615. if the engine is in state &quot;run&quot; then only &quot;break&quot; and &quot;status&quot;
  616. are available).
  617. </pre>
  618. <p>100 File related errors</p>
  619. <pre class="literal-block">
  620. 100 - can not open file (as a reply to a &quot;source&quot; command if the
  621. requested source file can't be opened)
  622. 101 - stream redirect failed
  623. </pre>
  624. <p>200 Breakpoint, or code flow errors</p>
  625. <pre class="literal-block">
  626. 200 - breakpoint could not be set (for some reason the breakpoint
  627. could not be set due to problems registering it)
  628. 201 - breakpoint type not supported (for example I don't support
  629. 'watch' yet and thus return this error)
  630. 202 - invalid breakpoint (the IDE tried to set a breakpoint on a
  631. line that does not exist in the file (ie &quot;line 0&quot; or lines
  632. past the end of the file)
  633. 203 - no code on breakpoint line (the IDE tried to set a breakpoint
  634. on a line which does not have any executable code. The
  635. debugger engine is NOT required to return this type if it
  636. is impossible to determine if there is code on a given
  637. location. (For example, in the PHP debugger backend this
  638. will only be returned in some special cases where the current
  639. scope falls into the scope of the breakpoint to be set)).
  640. 204 - Invalid breakpoint state (using an unsupported breakpoint state
  641. was attempted)
  642. 205 - No such breakpoint (used in breakpoint_get etc. to show that
  643. there is no breakpoint with the given ID)
  644. 206 - Error evaluating code (use from eval() (or perhaps
  645. property_get for a full name get))
  646. 207 - Invalid expression (the expression used for a non-eval()
  647. was invalid)
  648. </pre>
  649. <p>300 Data errors</p>
  650. <pre class="literal-block">
  651. 300 - Can not get property (when the requested property to get did
  652. not exist, this is NOT used for an existing but uninitialized
  653. property, which just gets the type &quot;uninitialised&quot; (See:
  654. PreferredTypeNames)).
  655. 301 - Stack depth invalid (the -d stack depth parameter did not
  656. exist (ie, there were less stack elements than the number
  657. requested) or the parameter was &lt; 0)
  658. 302 - Context invalid (an non existing context was requested)
  659. </pre>
  660. <p>900 Protocol errors</p>
  661. <pre class="literal-block">
  662. 900 - Encoding not supported
  663. 998 - An internal exception in the debugger occurred
  664. 999 - Unknown error
  665. </pre>
  666. </div>
  667. <div class="section" id="file-paths">
  668. <h2><a class="toc-backref" href="#id34">6.6 file paths</a></h2>
  669. <p>All file paths passed between the IDE and debugger engine must be in
  670. the URI format specified by IETF RFC 1738 and 2396, and must be
  671. absolute paths.</p>
  672. </div>
  673. <div class="section" id="dynamic-code-and-virtual-files">
  674. <h2><a class="toc-backref" href="#id35">6.7 Dynamic code and virtual files</a></h2>
  675. <p>The protocol reserves the URI scheme 'dbgp' for all virtual
  676. files generated and maintained by language engines. Such
  677. virtual files are usually managed by a language engine for
  678. dynamic code blocks, i.e. code created at runtime, without
  679. an association with a regular file. Any IDE seeing an URI
  680. with the 'dbgp' scheme has to use the 'source' command (See
  681. section 7.14) to obtain the contents of the file from the
  682. engine responsible for that URI.</p>
  683. <p>All URIs in that scheme have the form:</p>
  684. <blockquote>
  685. dbgp:engine-specific-identifier</blockquote>
  686. <p>The engine-specific-identifier is some string which the debugger engine
  687. uses to keep track of the specific virtual file. The IDE must return
  688. the URI to the debugger engine unchanged through the source command to
  689. retrieve the virtual file.</p>
  690. </div>
  691. </div>
  692. <div class="section" id="core-commands">
  693. <h1><a class="toc-backref" href="#id36">7. Core Commands</a></h1>
  694. <p>Both IDE and debugger engine must support all core commands.</p>
  695. <div class="section" id="status">
  696. <h2><a class="toc-backref" href="#id37">7.1 status</a></h2>
  697. <p>The status command is a simple way for the IDE to find out from
  698. the debugger engine whether execution may be continued or not.
  699. no body is required on request. If async support has been
  700. negotiated using feature_get/set the status command may be sent
  701. while the debugger engine is in a 'run state'.</p>
  702. <p>The status attribute values of the response may be:</p>
  703. <blockquote>
  704. <dl class="docutils">
  705. <dt>starting:</dt>
  706. <dd>State prior to execution of any code</dd>
  707. <dt>stopping:</dt>
  708. <dd>State after completion of code execution. This typically
  709. happens at the end of code execution, allowing the IDE to
  710. further interact with the debugger engine (for example, to
  711. collect performance data, or use other extended commands).</dd>
  712. <dt>stopped:</dt>
  713. <dd>IDE is detached from process, no further interaction is
  714. possible.</dd>
  715. <dt>running:</dt>
  716. <dd>code is currently executing. Note that this
  717. state would only be seen with async support
  718. turned on, otherwise the typical state during
  719. IDE/debugger interaction would be 'break'</dd>
  720. <dt>break:</dt>
  721. <dd>code execution is paused, for whatever reason
  722. (see below), and the IDE/debugger can pass
  723. information back and forth.</dd>
  724. </dl>
  725. </blockquote>
  726. <p>The reason attribute value may be:</p>
  727. <blockquote>
  728. <ul class="simple">
  729. <li>ok</li>
  730. <li>error</li>
  731. <li>aborted</li>
  732. <li>exception</li>
  733. </ul>
  734. </blockquote>
  735. <p>IDE</p>
  736. <pre class="literal-block">
  737. status -i transaction_id
  738. </pre>
  739. <p>debugger engine</p>
  740. <pre class="literal-block">
  741. &lt;response command=&quot;status&quot;
  742. status=&quot;starting&quot;
  743. reason=&quot;ok&quot;
  744. transaction_id=&quot;transaction_id&quot;&gt;
  745. message data
  746. &lt;/response&gt;
  747. </pre>
  748. </div>
  749. <div class="section" id="options-and-configuration">
  750. <h2><a class="toc-backref" href="#id38">7.2 Options and Configuration</a></h2>
  751. <p>The feature commands are used to request feature support from the debugger
  752. engine. This includes configuration options, some of which may be changed via
  753. feature_set, the ability to discover support for implemented commands, and to
  754. discover values for various features, such as the language version or name.</p>
  755. <p>An example of usage would be to send a feature request with the string 'stdin'
  756. to find out if the engine supports redirection of the stdin stream through the
  757. debugger socket. The debugger engine must consider all commands as keys for this
  758. command, but may also have keys that are for features that do not map directly
  759. to commands.</p>
  760. <div class="section" id="feature-names">
  761. <h3><a class="toc-backref" href="#id39">7.2.1 Feature Names</a></h3>
  762. <p>The following features strings MUST be available:</p>
  763. <blockquote>
  764. <table border="1" class="docutils">
  765. <colgroup>
  766. <col width="34%" />
  767. <col width="9%" />
  768. <col width="57%" />
  769. </colgroup>
  770. <tbody valign="top">
  771. <tr><td>language_supports_threads</td>
  772. <td>get</td>
  773. <td>[0|1]</td>
  774. </tr>
  775. <tr><td>language_name</td>
  776. <td>get</td>
  777. <td>{eg. PHP, Python, Perl}</td>
  778. </tr>
  779. <tr><td>language_version</td>
  780. <td>get</td>
  781. <td>{version string}</td>
  782. </tr>
  783. <tr><td>encoding</td>
  784. <td>get</td>
  785. <td>current encoding in use by the debugger
  786. session. The encoding can either be
  787. (7-bit) ASCII, or a code set which
  788. contains ASCII (Ex: ISO-8859-X, UTF-8)</td>
  789. </tr>
  790. <tr><td>protocol_version</td>
  791. <td>get</td>
  792. <td>{for now, always 1}</td>
  793. </tr>
  794. <tr><td>supports_async</td>
  795. <td>get</td>
  796. <td>{for commands such as break}</td>
  797. </tr>
  798. <tr><td>data_encoding</td>
  799. <td>get</td>
  800. <td>optional, allows to turn off
  801. the default base64 encoding of data. This
  802. should only be used for development and
  803. debugging of the debugger engines
  804. themselves, and not for general use. If
  805. implemented the value 'base64' must be
  806. supported to turn back on regular
  807. encoding. the value 'none' means no
  808. encoding is in use. all elements that use
  809. encoding must include an encoding
  810. attribute.</td>
  811. </tr>
  812. <tr><td>breakpoint_languages</td>
  813. <td>get</td>
  814. <td>some engines may support more than one
  815. language. This feature returns a string
  816. which is a comma separated list of
  817. supported languages. <strong>If the engine does
  818. not provide this feature, then it is
  819. assumed that the engine only supports the
  820. language defined in the feature
  821. language_name.</strong> One example of this is an
  822. XSLT debugger engine which supports XSLT,
  823. XML, HTML and XHTML. An IDE may need this
  824. information to to know what types of
  825. breakpoints an engine will accept.</td>
  826. </tr>
  827. <tr><td>breakpoint_types</td>
  828. <td>get</td>
  829. <td>returns a space separated list with all
  830. the breakpoint types that are supported.
  831. See <a class="reference internal" href="#breakpoints">7.6 breakpoints</a> for a list of the
  832. 6 defined breakpoint types.</td>
  833. </tr>
  834. <tr><td>multiple_sessions</td>
  835. <td>get|set</td>
  836. <td>{0|1}</td>
  837. </tr>
  838. <tr><td>encoding</td>
  839. <td>get|set</td>
  840. <td>{ISO8859-15, UTF-8, etc.}</td>
  841. </tr>
  842. <tr><td>max_children</td>
  843. <td>get|set</td>
  844. <td>max number of array or object
  845. children to initially retrieve</td>
  846. </tr>
  847. <tr><td>max_data</td>
  848. <td>get|set
  849. get|set</td>
  850. <td>max amount of variable data to
  851. initially retrieve.</td>
  852. </tr>
  853. <tr><td>max_depth</td>
  854. <td>get|set</td>
  855. <td>maximum depth that the debugger
  856. engine may return when sending arrays,
  857. hashs or object structures to the IDE.</td>
  858. </tr>
  859. </tbody>
  860. </table>
  861. </blockquote>
  862. <p>The following features strings MAY be available, if they are not, the IDE should
  863. assume that the feature is not available:</p>
  864. <blockquote>
  865. <table border="1" class="docutils">
  866. <colgroup>
  867. <col width="34%" />
  868. <col width="9%" />
  869. <col width="57%" />
  870. </colgroup>
  871. <tbody valign="top">
  872. <tr><td>supports_postmortem</td>
  873. <td>get</td>
  874. <td>[0|1] This feature lets an IDE know that
  875. there is benefit to continuing interaction
  876. during the STOPPING state (sect. 7.1).</td>
  877. </tr>
  878. <tr><td>show_hidden</td>
  879. <td>get|set</td>
  880. <td>[0|1] This feature can get set by the IDE
  881. if it wants to have more detailed internal
  882. information on properties (eg. private
  883. members of classes, etc.) Zero means that
  884. hidden members are not shown to the IDE.</td>
  885. </tr>
  886. <tr><td>notify_ok</td>
  887. <td>get|set</td>
  888. <td>[0|1] See section 8.5</td>
  889. </tr>
  890. </tbody>
  891. </table>
  892. </blockquote>
  893. <p>Additionally, all protocol commands supported must have a string,
  894. such as the following examples:</p>
  895. <pre class="literal-block">
  896. breakpoint_set
  897. break
  898. eval
  899. </pre>
  900. </div>
  901. <div class="section" id="feature-get">
  902. <h3><a class="toc-backref" href="#id40">7.2.2 feature_get</a></h3>
  903. <p>arguments for feature_get include:</p>
  904. <blockquote>
  905. <table border="1" class="docutils">
  906. <colgroup>
  907. <col width="5%" />
  908. <col width="95%" />
  909. </colgroup>
  910. <tbody valign="top">
  911. <tr><td>-n</td>
  912. <td>feature_name</td>
  913. </tr>
  914. </tbody>
  915. </table>
  916. </blockquote>
  917. <p>IDE</p>
  918. <pre class="literal-block">
  919. feature-get -i transaction_id -n feature_name
  920. </pre>
  921. <p>debugger engine</p>
  922. <pre class="literal-block">
  923. &lt;response command=&quot;feature_get&quot;
  924. feature_name=&quot;feature_name&quot;
  925. supported=&quot;0|1&quot;
  926. transaction_id=&quot;transaction_id&quot;&gt;
  927. feature setting or available options, such as a list of
  928. supported encodings
  929. &lt;/response&gt;
  930. </pre>
  931. <p>The 'supported' attribute does NOT mean that the feature is supported, this
  932. is encoded in the text child of the response tag. The 'supported' attribute
  933. informs whether the feature with 'feature_name' is supported by feature_get
  934. in the engine, or when the command with name 'feature_get' is supported by the
  935. engine.</p>
  936. <p>Example: Xdebug does not understand the 'breakpoint_languages' feature
  937. and will therefore set the supported attribute to '0'. It does however
  938. understand the feature 'language_supports_threads' and the 'supported'
  939. attribute is therefore set to '1', but as PHP does not support threads,
  940. the returned value is in this case &quot;0&quot;.</p>
  941. </div>
  942. <div class="section" id="feature-set">
  943. <h3><a class="toc-backref" href="#id41">7.2.3 feature_set</a></h3>
  944. <p>The feature set command allows a IDE to tell the debugger engine what additional
  945. capabilities it has. One example of this would be telling the debugger engine
  946. whether the IDE supports multiple debugger sessions (for threads, etc.). The
  947. debugger engine responds with telling the IDE whether it has enabled the feature
  948. or not.</p>
  949. <p>Note: The IDE does not have to listen for additional debugger connections if it
  950. does not support debugging multiple sessions. debugger engines must handle
  951. connection failures gracefully.</p>
  952. <p>arguments for feature_set include:</p>
  953. <blockquote>
  954. <table border="1" class="docutils">
  955. <colgroup>
  956. <col width="5%" />
  957. <col width="95%" />
  958. </colgroup>
  959. <tbody valign="top">
  960. <tr><td>-n</td>
  961. <td>feature_name</td>
  962. </tr>
  963. <tr><td>-v</td>
  964. <td>value to be set</td>
  965. </tr>
  966. </tbody>
  967. </table>
  968. </blockquote>
  969. <p>feature_set can be called at any time during a debug session to
  970. change values previously set. This allows a IDE to change
  971. encodings.</p>
  972. <p>IDE</p>
  973. <pre class="literal-block">
  974. feature_set -i transaction_id -n feature-name -v value
  975. </pre>
  976. <p>debugger engine</p>
  977. <pre class="literal-block">
  978. &lt;response command=&quot;feature_set&quot;
  979. feature=&quot;feature_name&quot;
  980. success=&quot;0|1&quot;
  981. transaction_id=&quot;transaction_id&quot;/&gt;
  982. </pre>
  983. </div>
  984. </div>
  985. <div class="section" id="continuation-commands">
  986. <h2><a class="toc-backref" href="#id42">7.5 continuation commands</a></h2>
  987. <p>resume the execution of the application.</p>
  988. <dl class="docutils">
  989. <dt>run:</dt>
  990. <dd>starts or resumes the script until a new breakpoint is reached,
  991. or the end of the script is reached.</dd>
  992. <dt>step_into:</dt>
  993. <dd>steps to the next statement, if there is a function call
  994. involved it will break on the first statement in that function</dd>
  995. <dt>step_over:</dt>
  996. <dd>steps to the next statement, if there is a function call on the
  997. line from which the step_over is issued then the debugger engine
  998. will stop at the statement after the function call in the same
  999. scope as from where the command was issued</dd>
  1000. <dt>step_out:</dt>
  1001. <dd>steps out of the current scope and breaks on the statement after
  1002. returning from the current function. (Also called 'finish' in
  1003. GDB)</dd>
  1004. <dt>stop:</dt>
  1005. <dd>ends execution of the script immediately, the debugger engine may
  1006. not respond, though if possible should be designed to do so.
  1007. The script will be terminated right away and be followed by a
  1008. disconnection of the network connection from the IDE (and debugger
  1009. engine if required in multi request apache processes).</dd>
  1010. <dt>detach (optional):</dt>
  1011. <dd>stops interaction with the debugger engine. Once this command
  1012. is executed, the IDE will no longer be able to communicate with
  1013. the debugger engine. This does not end execution of the script
  1014. as does the stop command above, but rather detaches from debugging.
  1015. Support of this continuation command is optional, and the IDE should
  1016. verify support for it via the feature_get command. If the IDE has
  1017. created stdin/stdout/stderr pipes for execution of the script
  1018. (eg. an interactive shell or other console to catch script output),
  1019. it should keep those open and usable by the process until the process
  1020. has terminated normally.</dd>
  1021. </dl>
  1022. <p>The response to a continue command is a status response (see
  1023. status above). The debugger engine does not send this response
  1024. immediately, but rather when it reaches a breakpoint, or ends
  1025. execution for any other reason.</p>
  1026. <p>IDE</p>
  1027. <pre class="literal-block">
  1028. run -i transaction_id
  1029. </pre>
  1030. <p>debugger engine</p>
  1031. <pre class="literal-block">
  1032. &lt;response command=&quot;run&quot;
  1033. status=&quot;starting&quot;
  1034. reason=&quot;ok&quot;
  1035. transaction_id=&quot;transaction_id&quot;/&gt;
  1036. </pre>
  1037. </div>
  1038. <div class="section" id="breakpoints">
  1039. <h2><a class="toc-backref" href="#id43">7.6 breakpoints</a></h2>
  1040. <p>Breakpoints are locations or conditions at which a debugger engine
  1041. pauses execution, responds to the IDE, and waits for further commands
  1042. from the IDE. A failure in any breakpoint commands results in an
  1043. error defined in <a class="reference internal" href="#debugger-engine-errors">section 6.5</a>.</p>
  1044. <p>The following DBGP commands relate to breakpoints:</p>
  1045. <blockquote>
  1046. <table border="1" class="docutils">
  1047. <colgroup>
  1048. <col width="27%" />
  1049. <col width="73%" />
  1050. </colgroup>
  1051. <tbody valign="top">
  1052. <tr><td><a class="reference internal" href="#id1">breakpoint_set</a></td>
  1053. <td>Set a new breakpoint on the session.</td>
  1054. </tr>
  1055. <tr><td><a class="reference internal" href="#id2">breakpoint_get</a></td>
  1056. <td>Get breakpoint info for the given breakpoint id.</td>
  1057. </tr>
  1058. <tr><td><a class="reference internal" href="#id3">breakpoint_update</a></td>
  1059. <td>Update one or more attributes of a breakpoint.</td>
  1060. </tr>
  1061. <tr><td><a class="reference internal" href="#id4">breakpoint_remove</a></td>
  1062. <td>Remove the given breakpoint on the session.</td>
  1063. </tr>
  1064. <tr><td><a class="reference internal" href="#id5">breakpoint_list</a></td>
  1065. <td>Get a list of all of the session's breakpoints.</td>
  1066. </tr>
  1067. </tbody>
  1068. </table>
  1069. </blockquote>
  1070. <p>There are six different breakpoints <em>types</em>:</p>
  1071. <blockquote>
  1072. <table border="1" class="docutils">
  1073. <colgroup>
  1074. <col width="21%" />
  1075. <col width="17%" />
  1076. <col width="62%" />
  1077. </colgroup>
  1078. <thead valign="bottom">
  1079. <tr><th class="head">Type</th>
  1080. <th class="head">Req'd Attrs</th>
  1081. <th class="head">Description</th>
  1082. </tr>
  1083. </thead>
  1084. <tbody valign="top">
  1085. <tr><td>line</td>
  1086. <td>filename,
  1087. lineno</td>
  1088. <td>break on the given lineno in the given
  1089. file</td>
  1090. </tr>
  1091. <tr><td>call</td>
  1092. <td>function</td>
  1093. <td>break on entry into new stack for
  1094. function name</td>
  1095. </tr>
  1096. <tr><td>return</td>
  1097. <td>function</td>
  1098. <td>break on exit from stack for function
  1099. name</td>
  1100. </tr>
  1101. <tr><td>exception</td>
  1102. <td>exception</td>
  1103. <td>break on exception of the given name</td>
  1104. </tr>
  1105. <tr><td>conditional</td>
  1106. <td>expression,
  1107. filename</td>
  1108. <td>break when the given expression is true
  1109. at the given filename and line number or
  1110. just in given filename</td>
  1111. </tr>
  1112. <tr><td>watch</td>
  1113. <td>expression</td>
  1114. <td>break on write of the variable or address
  1115. defined by the expression argument</td>
  1116. </tr>
  1117. </tbody>
  1118. </table>
  1119. </blockquote>
  1120. <p>A breakpoint has the following attributes. Note that some attributes are only
  1121. applicable for some breakpoint types.</p>
  1122. <blockquote>
  1123. <table border="1" class="docutils">
  1124. <colgroup>
  1125. <col width="24%" />
  1126. <col width="76%" />
  1127. </colgroup>
  1128. <tbody valign="top">
  1129. <tr><td>type</td>
  1130. <td>breakpoint type (see table above for valid types)</td>
  1131. </tr>
  1132. <tr><td>filename</td>
  1133. <td>The file the breakpoint is effective in. This must be
  1134. a &quot;<a class="reference external" href="file://">file://</a>&quot; or &quot;dbgp:&quot; (See <a class="reference internal" href="#dynamic-code-and-virtual-files">6.7 Dynamic code and
  1135. virtual files</a>) URI.</td>
  1136. </tr>
  1137. <tr><td>lineno</td>
  1138. <td>Line number on which breakpoint is effective

Large files files are truncated, but you can click here to view the full file