codekingpro's picture
Add files using upload-large-folder tool
66b3b8e verified
Raw
History Blame Contribute Delete
15.8 kB
<!DOCTYPE html>
<html lang="en" data-content_root="./">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Debugger &#8212; pgAdmin 4 8.6 documentation</title>
<link rel="stylesheet" type="text/css" href="_static/pygments.css?v=fa44fd50" />
<link rel="stylesheet" type="text/css" href="_static/style.css?v=d36593c3" />
<script src="_static/documentation_options.js?v=d4c83366"></script>
<script src="_static/doctools.js?v=9a2dae69"></script>
<script src="_static/sphinx_highlight.js?v=dc90522c"></script>
<script src="_static/sidebar.js"></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="Query Tool" href="query_tool.html" />
<link rel="prev" title="Developer Tools" href="developer_tools.html" />
</head><body>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="query_tool.html" title="Query Tool"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="developer_tools.html" title="Developer Tools"
accesskey="P">previous</a> |</li>
<li class="nav-item nav-item-0"><a href="index.html">pgAdmin 4 8.6 documentation</a> &#187;</li>
<li class="nav-item nav-item-1"><a href="developer_tools.html" accesskey="U">Developer Tools</a> &#187;</li>
<li class="nav-item nav-item-this"><a href="">Debugger</a></li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<section id="debugger">
<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>
<img alt="Debugger page" class="align-center" src="_images/debug_main.png" />
<p>The debugger may be used to debug PL/pgSQL functions in PostgreSQL, as well as
EDB-SPL functions, stored procedures and packages in EDB Postgres Advanced
Server. The Debugger is available as an extension for your PostgreSQL
installation, and is distributed as part of Advanced Server. You must have
superuser privileges to use the debugger.</p>
<p>Before using the debugger, you must modify the <em>postgresql.conf</em> file, adding
the server-side debugger components to the value of the
<em>shared_preload_libraries</em> parameter, for example:</p>
<blockquote>
<div><p>shared_preload_libraries = ‘$libdir/plugin_debugger’</p>
</div></blockquote>
<p>After modifying the <em>shared_preload_libraries</em> parameter, restart the server to
apply the changes.</p>
<p>The debugger may be used for either in-context debugging or direct debugging of
a target function or procedure. When you use the debugger for in-context
debugging, you set a breakpoint at the first line of a program; when a session
invokes the target, control is transferred to the debugger. When using direct
debugging, the debugger prompts you for any parameters required by the target,
and then allows you to step through the code.</p>
<section id="in-context-debugging">
<h2>In-context Debugging<a class="headerlink" href="#in-context-debugging" title="Link to this heading"></a></h2>
<p>To set a breakpoint at the first line of a program, right-click the name of the
object you would like to debug, and select <em>Set breakpoint</em> from the <em>Debugging</em>
sub-menu. The debugger window will open, waiting for another session to invoke
the program.</p>
<img alt="Debugger set a breakpoint demo" class="align-center" src="_images/debug_set_breakpoint.png" />
<p>When another session invokes the target, the debugger will display the code,
allowing you to add break points, or step through line-by-line. The other
session is suspended until the debugging completes; then control is returned
to the session.</p>
<img alt="Debugger step-in demo" class="align-center" src="_images/debug_ic_step_in.png" />
</section>
<section id="direct-debugging">
<h2>Direct Debugging<a class="headerlink" href="#direct-debugging" title="Link to this heading"></a></h2>
<p>To use the debugger for direct debugging, right click on the name of the object
that you wish to debug in the pgAdmin tree control and select <em>Debug</em> from the
<em>Debugging</em> sub-menu. The debugger window will open, prompting you for any
values required by the program:</p>
<img alt="Debugger parameter dialog" src="_images/debug_params.png" />
<p>Use the fields on the <em>Debugger</em> dialog to provide a value for each parameter:</p>
<blockquote>
<div><ul class="simple">
<li><p>The <em>Name</em> field contains the formal parameter name.</p></li>
<li><p>The <em>Type</em> field contains the parameter data type.</p></li>
<li><p>Check the <em>Null?</em> checkbox to indicate that the parameter is a NULL value.</p></li>
<li><p>Check the <em>Expression?</em> checkbox if the Value field contains an expression.</p></li>
<li><p>Use the <em>Value</em> field to provide the parameter value that will be passed to
the program. When entering parameter values, type the value into the
appropriate cell on the grid, or, leave the cell empty to represent NULL,
enter ‘’ (two single quotes) to represent an empty string, or to enter a
literal string consisting of just two single quotes, enter ''. PostgreSQL
8.4 and above supports variadic function parameters. These may be entered as
a comma-delimited list of values, quoted and/or cast as required.</p></li>
<li><p>Check the <em>Use default?</em> checkbox to indicate that the program should use
the value in the Default Value field.</p></li>
<li><p>The <em>Default Value</em> field contains the default value of the parameter.</p></li>
</ul>
</div></blockquote>
<p>Provide values required by the program, and click the <em>Debug</em> button to start
stepping through the program.
The values of the arguments provided here are saved. The values will be pre-filled
next time the dialog opens. To clear the values, use the <em>Clear All</em> button.</p>
<img alt="Debugger step-in demo" class="align-center" src="_images/debug_step_in.png" />
</section>
<section id="using-the-debugger">
<h2>Using the Debugger<a class="headerlink" href="#using-the-debugger" title="Link to this heading"></a></h2>
<p>The main debugger window consists of two panels and a context-sensitive toolbar.
Use toolbar icons to manage breakpoints and step into or through code; hover
over an icon for a tooltip that identifies the option associated with the icon.
The toolbar options are:</p>
<img alt="Debugger navigation toolbar" class="align-center" src="_images/debug_toolbar.png" />
<table class="docutils align-default">
<thead>
<tr class="row-odd"><th class="head"><p>Option</p></th>
<th class="head"><p>Action</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p><em>Step into</em></p></td>
<td><p>Click the <em>Step into</em> icon to execute the currently highlighted line of code.</p></td>
</tr>
<tr class="row-odd"><td><p><em>Step over</em></p></td>
<td><p>Click the <em>Step over</em> icon to execute a line of code, stepping over any sub-functions invoked by the code.
The sub-function executes, but is not debugged unless it contains a breakpoint.</p></td>
</tr>
<tr class="row-even"><td><p><em>Continue/Start</em></p></td>
<td><p>Click the <em>Continue/Start</em> icon to execute the highlighted code, and continue until the program
encounters a breakpoint or completes.</p></td>
</tr>
<tr class="row-odd"><td><p><em>Toggle breakpoint</em></p></td>
<td><p>Use the <em>Toggle breakpoint</em> icon to enable or disable a breakpoint (without removing the breakpoint).</p></td>
</tr>
<tr class="row-even"><td><p><em>Clear all breakpoints</em></p></td>
<td><p>Click the <em>Clear all breakpoints</em> icon to remove all breakpoints from the program.</p></td>
</tr>
<tr class="row-odd"><td><p><em>Stop</em></p></td>
<td><p>Click the <em>Stop</em> icon to halt the execution of a program.</p></td>
</tr>
<tr class="row-even"><td><p><em>Help</em></p></td>
<td><p>Click the <em>Help</em> icon to open debugger documentation.</p></td>
</tr>
</tbody>
</table>
<p>The top panel of the debugger window displays the program body; click in the
grey margin next to a line number to add a breakpoint. The highlighted line in
the top panel is the line that is about to execute.</p>
<img alt="Debugger main window" class="align-center" src="_images/debug_main.png" />
<p>The lower panel of the debugger window provides a set of tabs that allow you to
review information about the program:</p>
<blockquote>
<div><ul class="simple">
<li><p>The <em>Parameters</em> tab displays the value of each parameter.</p></li>
<li><p>The <em>Local</em> variables tab displays the current value of the program variables.</p></li>
<li><p>The <em>Messages</em> tab displays any messages returned by the server (errors,
warnings and informational messages).</p></li>
<li><p>The <em>Results</em> tab displays the server message when the program completes.</p></li>
<li><p>The <em>Stack</em> tab displays the list of functions that have been invoked, but
which have not yet completed.</p></li>
</ul>
</div></blockquote>
<p>As you step through a program, the <em>Local variables</em> tab displays the current
value of each variable:</p>
<img alt="Debugger local variables tab" class="align-center" src="_images/debug_variables.png" />
<p>When you step into a subroutine, the <em>Stack</em> tab displays the call stack,
including the name of each caller, the parameter values for each caller (if
any), and the line number within each caller:</p>
<img alt="Debugger local stack tab" class="align-center" src="_images/debug_stack.png" />
<p>Select a caller to change focus to that stack frame and display the state of
the caller in the upper panel.</p>
<p>When the program completes, the <em>Results</em> tab displays the message returned by
the server. If the program encounters an error, the <em>Messages</em> tab displays
details:</p>
<img alt="Debugger error message" class="align-center" src="_images/debug_error_message.png" />
</section>
</section>
<div class="clearer"></div>
</div>
</div>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<div>
<h3><a href="index.html">Table of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#">Debugger</a><ul>
<li><a class="reference internal" href="#in-context-debugging">In-context Debugging</a></li>
<li><a class="reference internal" href="#direct-debugging">Direct Debugging</a></li>
<li><a class="reference internal" href="#using-the-debugger">Using the Debugger</a></li>
</ul>
</li>
</ul>
</div>
<h3><a href="index.html">Table of Contents</a></h3>
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="getting_started.html">Getting Started</a></li>
<li class="toctree-l1"><a class="reference internal" href="external_database.html">External database for pgAdmin user settings</a></li>
<li class="toctree-l1"><a class="reference internal" href="connecting.html">Connecting To A Server</a></li>
<li class="toctree-l1"><a class="reference internal" href="managing_cluster_objects.html">Managing Cluster Objects</a></li>
<li class="toctree-l1"><a class="reference internal" href="managing_database_objects.html">Managing Database Objects</a></li>
<li class="toctree-l1"><a class="reference internal" href="modifying_tables.html">Creating or Modifying a Table</a></li>
<li class="toctree-l1"><a class="reference internal" href="management_basics.html">Management Basics</a></li>
<li class="toctree-l1"><a class="reference internal" href="backup_and_restore.html">Backup and Restore</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="developer_tools.html">Developer Tools</a><ul class="current">
<li class="toctree-l2 current"><a class="current reference internal" href="#">Debugger</a></li>
<li class="toctree-l2"><a class="reference internal" href="query_tool.html">Query Tool</a></li>
<li class="toctree-l2"><a class="reference internal" href="editgrid.html">View/Edit Data</a></li>
<li class="toctree-l2"><a class="reference internal" href="schema_diff.html">Schema Diff</a></li>
<li class="toctree-l2"><a class="reference internal" href="erd_tool.html">ERD Tool</a></li>
<li class="toctree-l2"><a class="reference internal" href="psql_tool.html">PSQL Tool</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="processes.html">Processes</a></li>
<li class="toctree-l1"><a class="reference internal" href="pgagent.html">pgAgent</a></li>
<li class="toctree-l1"><a class="reference internal" href="contributions.html">pgAdmin Project Contributions</a></li>
<li class="toctree-l1"><a class="reference internal" href="release_notes.html">Release Notes</a></li>
<li class="toctree-l1"><a class="reference internal" href="licence.html">Licence</a></li>
</ul>
<search id="searchbox" style="display: none" role="search">
<h3 id="searchlabel">Quick search</h3>
<div class="searchformwrapper">
<form class="search" action="search.html" method="get">
<input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
<input type="submit" value="Go" />
</form>
</div>
</search>
<script>document.getElementById('searchbox').style.display = "block"</script>
</div>
<div id="sidebarbutton" title="Collapse sidebar">
<span>«</span>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="query_tool.html" title="Query Tool"
>next</a> |</li>
<li class="right" >
<a href="developer_tools.html" title="Developer Tools"
>previous</a> |</li>
<li class="nav-item nav-item-0"><a href="index.html">pgAdmin 4 8.6 documentation</a> &#187;</li>
<li class="nav-item nav-item-1"><a href="developer_tools.html" >Developer Tools</a> &#187;</li>
<li class="nav-item nav-item-this"><a href="">Debugger</a></li>
</ul>
</div>
<div class="footer" role="contentinfo">
<div class="related" role="navigation" aria-label="related navigation">
<ul>
<li class="left" style="margin-left: 10px">&#169; Copyright (C) 2013 - 2024, The pgAdmin Development Team.</li>
<li class="right" style="margin-right: 10px"><a href="genindex.html" title="General Index" accesskey="I">index</a></li>
<li class="right" ><a href="query_tool.html" title="Query Tool" accesskey="N">next</a> |</li>
<li class="right" ><a href="developer_tools.html" title="Developer Tools" accesskey="P">previous</a> |</li>
</ul>
</div>
</div>
</body>
</html>