Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
debugger.html278 linesDownload Raw Back to html
1
2
3<!DOCTYPE html>
4
5<html lang="en" data-content_root="./">
6  <head>
7    <meta charset="utf-8" />
8    <meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
9
10    <title>Debugger &#8212; pgAdmin 4 8.6 documentation</title>
11    <link rel="stylesheet" type="text/css" href="_static/pygments.css?v=fa44fd50" />
12    <link rel="stylesheet" type="text/css" href="_static/style.css?v=d36593c3" />
13    
14    <script src="_static/documentation_options.js?v=d4c83366"></script>
15    <script src="_static/doctools.js?v=9a2dae69"></script>
16    <script src="_static/sphinx_highlight.js?v=dc90522c"></script>
17    
18    <script src="_static/sidebar.js"></script>
19    
20    <link rel="index" title="Index" href="genindex.html" />
21    <link rel="search" title="Search" href="search.html" />
22    <link rel="next" title="Query Tool" href="query_tool.html" />
23    <link rel="prev" title="Developer Tools" href="developer_tools.html" /> 
24  </head><body>
25    <div class="related" role="navigation" aria-label="related navigation">
26      <h3>Navigation</h3>
27      <ul>
28        <li class="right" style="margin-right: 10px">
29          <a href="genindex.html" title="General Index"
30             accesskey="I">index</a></li>
31        <li class="right" >
32          <a href="query_tool.html" title="Query Tool"
33             accesskey="N">next</a> |</li>
34        <li class="right" >
35          <a href="developer_tools.html" title="Developer Tools"
36             accesskey="P">previous</a> |</li>
37        <li class="nav-item nav-item-0"><a href="index.html">pgAdmin 4 8.6 documentation</a> &#187;</li>
38          <li class="nav-item nav-item-1"><a href="developer_tools.html" accesskey="U">Developer Tools</a> &#187;</li>
39        <li class="nav-item nav-item-this"><a href="">Debugger</a></li> 
40      </ul>
41    </div>  
42
43    <div class="document">
44      <div class="documentwrapper">
45        <div class="bodywrapper">
46          <div class="body" role="main">
47            
48  <section id="debugger">
49<span id="id1"></span><h1><span class="target" id="index-0"></span>Debugger<a class="headerlink" href="#debugger" title="Link to this heading">¶</a></h1>
50<img alt="Debugger page" class="align-center" src="_images/debug_main.png" />
51<p>The debugger may be used to debug PL/pgSQL functions in PostgreSQL, as well as
52EDB-SPL functions, stored procedures and packages in EDB Postgres Advanced
53Server. The Debugger is available as an extension for your PostgreSQL
54installation, and is distributed as part of Advanced Server.  You must have
55superuser privileges to use the debugger.</p>
56<p>Before using the debugger, you must modify the <em>postgresql.conf</em> file, adding
57the server-side debugger components to the value of the
58<em>shared_preload_libraries</em> parameter, for example:</p>
59<blockquote>
60<div><p>shared_preload_libraries = ‘$libdir/plugin_debugger’</p>
61</div></blockquote>
62<p>After modifying the <em>shared_preload_libraries</em> parameter, restart the server to
63apply the changes.</p>
64<p>The debugger may be used for either in-context debugging or direct debugging of
65a target function or procedure.  When you use the debugger for in-context
66debugging, you set a breakpoint at the first line of a program; when a session
67invokes the target, control is transferred to the debugger. When using direct
68debugging, the debugger prompts you for any parameters required by the target,
69and then allows you to step through the code.</p>
70<section id="in-context-debugging">
71<h2>In-context Debugging<a class="headerlink" href="#in-context-debugging" title="Link to this heading">¶</a></h2>
72<p>To set a breakpoint at the first line of a program, right-click the name of the
73object you would like to debug, and select <em>Set breakpoint</em> from the <em>Debugging</em>
74sub-menu.  The debugger window will open, waiting for another session to invoke
75the program.</p>
76<img alt="Debugger set a breakpoint demo" class="align-center" src="_images/debug_set_breakpoint.png" />
77<p>When another session invokes the target, the debugger will display the code,
78allowing you to add break points, or step through line-by-line. The other
79session is suspended until the debugging completes; then control is returned
80to the session.</p>
81<img alt="Debugger step-in demo" class="align-center" src="_images/debug_ic_step_in.png" />
82</section>
83<section id="direct-debugging">
84<h2>Direct Debugging<a class="headerlink" href="#direct-debugging" title="Link to this heading">¶</a></h2>
85<p>To use the debugger for direct debugging, right click on the name of the object
86that you wish to debug in the pgAdmin tree control and select <em>Debug</em> from the
87<em>Debugging</em> sub-menu.  The debugger window will open, prompting you for any
88values required by the program:</p>
89<img alt="Debugger parameter dialog" src="_images/debug_params.png" />
90<p>Use the fields on the <em>Debugger</em> dialog to provide a value for each parameter:</p>
91<blockquote>
92<div><ul class="simple">
93<li><p>The <em>Name</em> field contains the formal parameter name.</p></li>
94<li><p>The <em>Type</em> field contains the parameter data type.</p></li>
95<li><p>Check the <em>Null?</em> checkbox to indicate that the parameter is a NULL value.</p></li>
96<li><p>Check the <em>Expression?</em> checkbox if the Value field contains an expression.</p></li>
97<li><p>Use the <em>Value</em> field to provide the parameter value that will be passed to
98the program.  When entering parameter values, type the value into the
99appropriate cell on the grid, or, leave the cell empty to represent NULL,
100enter ‘’ (two single quotes) to represent an empty string, or to enter a
101literal string consisting of just two single quotes, enter ''. PostgreSQL
1028.4 and above supports variadic function parameters. These may be entered as
103a comma-delimited list of values, quoted and/or cast as required.</p></li>
104<li><p>Check the <em>Use default?</em> checkbox to indicate that the program should use
105the value in the Default Value field.</p></li>
106<li><p>The <em>Default Value</em> field contains the default value of the parameter.</p></li>
107</ul>
108</div></blockquote>
109<p>Provide values required by the program, and click the <em>Debug</em> button to start
110stepping through the program.
111The values of the arguments provided here are saved. The values will be pre-filled
112next time the dialog opens. To clear the values, use the <em>Clear All</em> button.</p>
113<img alt="Debugger step-in demo" class="align-center" src="_images/debug_step_in.png" />
114</section>
115<section id="using-the-debugger">
116<h2>Using the Debugger<a class="headerlink" href="#using-the-debugger" title="Link to this heading">¶</a></h2>
117<p>The main debugger window consists of two panels and a context-sensitive toolbar.
118Use toolbar icons to manage breakpoints and step into or through code; hover
119over an icon for a tooltip that identifies the option associated with the icon.
120The toolbar options are:</p>
121<img alt="Debugger navigation toolbar" class="align-center" src="_images/debug_toolbar.png" />
122<table class="docutils align-default">
123<thead>
124<tr class="row-odd"><th class="head"><p>Option</p></th>
125<th class="head"><p>Action</p></th>
126</tr>
127</thead>
128<tbody>
129<tr class="row-even"><td><p><em>Step into</em></p></td>
130<td><p>Click the <em>Step into</em> icon to execute the currently highlighted line of code.</p></td>
131</tr>
132<tr class="row-odd"><td><p><em>Step over</em></p></td>
133<td><p>Click the <em>Step over</em> icon to execute a line of code, stepping over any sub-functions invoked by the code.
134The sub-function executes, but is not debugged unless it contains a breakpoint.</p></td>
135</tr>
136<tr class="row-even"><td><p><em>Continue/Start</em></p></td>
137<td><p>Click the <em>Continue/Start</em> icon to execute the highlighted code, and continue until the program
138encounters a breakpoint or completes.</p></td>
139</tr>
140<tr class="row-odd"><td><p><em>Toggle breakpoint</em></p></td>
141<td><p>Use the <em>Toggle breakpoint</em> icon to enable or disable a breakpoint (without removing the breakpoint).</p></td>
142</tr>
143<tr class="row-even"><td><p><em>Clear all breakpoints</em></p></td>
144<td><p>Click the <em>Clear all breakpoints</em> icon to remove all breakpoints from the program.</p></td>
145</tr>
146<tr class="row-odd"><td><p><em>Stop</em></p></td>
147<td><p>Click the <em>Stop</em> icon to halt the execution of a program.</p></td>
148</tr>
149<tr class="row-even"><td><p><em>Help</em></p></td>
150<td><p>Click the <em>Help</em> icon to open debugger documentation.</p></td>
151</tr>
152</tbody>
153</table>
154<p>The top panel of the debugger window displays the program body; click in the
155grey margin next to a line number to add a breakpoint.  The highlighted line in
156the top panel is the line that is about to execute.</p>
157<img alt="Debugger main window" class="align-center" src="_images/debug_main.png" />
158<p>The lower panel of the debugger window provides a set of tabs that allow you to
159review information about the program:</p>
160<blockquote>
161<div><ul class="simple">
162<li><p>The <em>Parameters</em> tab displays the value of each parameter.</p></li>
163<li><p>The <em>Local</em> variables tab displays the current value of the program variables.</p></li>
164<li><p>The <em>Messages</em> tab displays any messages returned by the server (errors,
165warnings and informational messages).</p></li>
166<li><p>The <em>Results</em> tab displays the server message when the program completes.</p></li>
167<li><p>The <em>Stack</em> tab displays the list of functions that have been invoked, but
168which have not yet completed.</p></li>
169</ul>
170</div></blockquote>
171<p>As you step through a program, the <em>Local variables</em> tab displays the current
172value of each variable:</p>
173<img alt="Debugger local variables tab" class="align-center" src="_images/debug_variables.png" />
174<p>When you step into a subroutine, the <em>Stack</em> tab displays the call stack,
175including the name of each caller, the parameter values for each caller (if
176any), and the line number within each caller:</p>
177<img alt="Debugger local stack tab" class="align-center" src="_images/debug_stack.png" />
178<p>Select a caller to change focus to that stack frame and display the state of
179the caller in the upper panel.</p>
180<p>When the program completes, the <em>Results</em> tab displays the message returned by
181the server.  If the program encounters an error, the <em>Messages</em> tab displays
182details:</p>
183<img alt="Debugger error message" class="align-center" src="_images/debug_error_message.png" />
184</section>
185</section>
186
187
188            <div class="clearer"></div>
189          </div>
190        </div>
191      </div>
192      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
193        <div class="sphinxsidebarwrapper">
194  <div>
195    <h3><a href="index.html">Table of Contents</a></h3>
196    <ul>
197<li><a class="reference internal" href="#">Debugger</a><ul>
198<li><a class="reference internal" href="#in-context-debugging">In-context Debugging</a></li>
199<li><a class="reference internal" href="#direct-debugging">Direct Debugging</a></li>
200<li><a class="reference internal" href="#using-the-debugger">Using the Debugger</a></li>
201</ul>
202</li>
203</ul>
204
205  </div>
206<h3><a href="index.html">Table of Contents</a></h3>
207<ul class="current">
208<li class="toctree-l1"><a class="reference internal" href="getting_started.html">Getting Started</a></li>
209<li class="toctree-l1"><a class="reference internal" href="external_database.html">External database for pgAdmin user settings</a></li>
210<li class="toctree-l1"><a class="reference internal" href="connecting.html">Connecting To A Server</a></li>
211<li class="toctree-l1"><a class="reference internal" href="managing_cluster_objects.html">Managing Cluster Objects</a></li>
212<li class="toctree-l1"><a class="reference internal" href="managing_database_objects.html">Managing Database Objects</a></li>
213<li class="toctree-l1"><a class="reference internal" href="modifying_tables.html">Creating or Modifying a Table</a></li>
214<li class="toctree-l1"><a class="reference internal" href="management_basics.html">Management Basics</a></li>
215<li class="toctree-l1"><a class="reference internal" href="backup_and_restore.html">Backup and Restore</a></li>
216<li class="toctree-l1 current"><a class="reference internal" href="developer_tools.html">Developer Tools</a><ul class="current">
217<li class="toctree-l2 current"><a class="current reference internal" href="#">Debugger</a></li>
218<li class="toctree-l2"><a class="reference internal" href="query_tool.html">Query Tool</a></li>
219<li class="toctree-l2"><a class="reference internal" href="editgrid.html">View/Edit Data</a></li>
220<li class="toctree-l2"><a class="reference internal" href="schema_diff.html">Schema Diff</a></li>
221<li class="toctree-l2"><a class="reference internal" href="erd_tool.html">ERD Tool</a></li>
222<li class="toctree-l2"><a class="reference internal" href="psql_tool.html">PSQL Tool</a></li>
223</ul>
224</li>
225<li class="toctree-l1"><a class="reference internal" href="processes.html">Processes</a></li>
226<li class="toctree-l1"><a class="reference internal" href="pgagent.html">pgAgent</a></li>
227<li class="toctree-l1"><a class="reference internal" href="contributions.html">pgAdmin Project Contributions</a></li>
228<li class="toctree-l1"><a class="reference internal" href="release_notes.html">Release Notes</a></li>
229<li class="toctree-l1"><a class="reference internal" href="licence.html">Licence</a></li>
230</ul>
231
232<search id="searchbox" style="display: none" role="search">
233  <h3 id="searchlabel">Quick search</h3>
234    <div class="searchformwrapper">
235    <form class="search" action="search.html" method="get">
236      <input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
237      <input type="submit" value="Go" />
238    </form>
239    </div>
240</search>
241<script>document.getElementById('searchbox').style.display = "block"</script>
242        </div>
243<div id="sidebarbutton" title="Collapse sidebar">
244<span>«</span>
245</div>
246
247      </div>
248      <div class="clearer"></div>
249    </div>
250    <div class="related" role="navigation" aria-label="related navigation">
251      <h3>Navigation</h3>
252      <ul>
253        <li class="right" style="margin-right: 10px">
254          <a href="genindex.html" title="General Index"
255             >index</a></li>
256        <li class="right" >
257          <a href="query_tool.html" title="Query Tool"
258             >next</a> |</li>
259        <li class="right" >
260          <a href="developer_tools.html" title="Developer Tools"
261             >previous</a> |</li>
262        <li class="nav-item nav-item-0"><a href="index.html">pgAdmin 4 8.6 documentation</a> &#187;</li>
263          <li class="nav-item nav-item-1"><a href="developer_tools.html" >Developer Tools</a> &#187;</li>
264        <li class="nav-item nav-item-this"><a href="">Debugger</a></li> 
265      </ul>
266    </div>
267    <div class="footer" role="contentinfo">
268        <div class="related" role="navigation" aria-label="related navigation">
269          <ul>
270              <li class="left" style="margin-left: 10px">&#169; Copyright (C) 2013 - 2024, The pgAdmin Development Team.</li>
271            <li class="right" style="margin-right: 10px"><a href="genindex.html" title="General Index" accesskey="I">index</a></li>
272            <li class="right" ><a href="query_tool.html" title="Query Tool" accesskey="N">next</a> |</li>
273            <li class="right" ><a href="developer_tools.html" title="Developer Tools" accesskey="P">previous</a> |</li>
274          </ul>
275        </div>
276    </div>
277  </body>
278</html>
codekingpro/portable-devtools · Team Ai