forked from docs/doc-exports
Reviewed-by: Hasko, Vladimir <vladimir.hasko@t-systems.com> Co-authored-by: Lu, Huayi <luhuayi@huawei.com> Co-committed-by: Lu, Huayi <luhuayi@huawei.com>
59 lines
15 KiB
HTML
59 lines
15 KiB
HTML
<a name="EN-US_TOPIC_0000001098993176"></a><a name="EN-US_TOPIC_0000001098993176"></a>
|
|
|
|
<h1 class="topictitle1">Controlling Execution</h1>
|
|
<div id="body8662426"><p id="EN-US_TOPIC_0000001098993176__en-us_topic_0185264594_p58633867">Topics in this section include:</p>
|
|
<ul id="EN-US_TOPIC_0000001098993176__en-us_topic_0185264594_ul3178185420"><li id="EN-US_TOPIC_0000001098993176__en-us_topic_0185264594_li10178281148"><a href="#EN-US_TOPIC_0000001098993176__en-us_topic_0185264594_section1360793411367">Starting Debugging</a></li><li id="EN-US_TOPIC_0000001098993176__en-us_topic_0185264594_li1156789545"><a href="#EN-US_TOPIC_0000001098993176__en-us_topic_0185264594_section49567323716">Single Stepping a PL/SQL Function</a></li><li id="EN-US_TOPIC_0000001098993176__en-us_topic_0185264594_li12697230542"><a href="#EN-US_TOPIC_0000001098993176__en-us_topic_0185264594_ref471314683">Continuing the Debugging</a></li><li id="EN-US_TOPIC_0000001098993176__en-us_topic_0185264594_li1491213411048"><a href="#EN-US_TOPIC_0000001098993176__en-us_topic_0185264594_viewcallstack">Viewing Callstack</a></li></ul>
|
|
<div class="section" id="EN-US_TOPIC_0000001098993176__en-us_topic_0185264594_section1360793411367"><a name="EN-US_TOPIC_0000001098993176__en-us_topic_0185264594_section1360793411367"></a><a name="en-us_topic_0185264594_section1360793411367"></a><h4 class="sectiontitle">Starting Debugging</h4><p id="EN-US_TOPIC_0000001098993176__en-us_topic_0185264594_p1631613394364">Select the function that you want to debug in the <strong id="EN-US_TOPIC_0000001098993176__en-us_topic_0185264594_b5405549346">Object Browser</strong> pane. Start debugging by clicking <span><img id="EN-US_TOPIC_0000001098993176__en-us_topic_0185264594_image58557380" width="15.96" height="15.96" src="figure/en-us_image_0000001098833258.jpg" title="Click to enlarge" class="imgResize"></span> on the toolbar or using any other method mentioned in previous sections. If no breakpoint is set or the breakpoint set is invalid, the debugging operation is performed without stopping any statement and Data Studio will simply execute the object and display the results (if any).</p>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0000001098993176__en-us_topic_0185264594_section49567323716"><a name="EN-US_TOPIC_0000001098993176__en-us_topic_0185264594_section49567323716"></a><a name="en-us_topic_0185264594_section49567323716"></a><h4 class="sectiontitle">Single Stepping a PL/SQL Function</h4><p id="EN-US_TOPIC_0000001098993176__en-us_topic_0185264594_p45527359">You can run the command for single stepping in the toolbar to debug a function. This allows you to debug the program line by line. When a breakpoint occurs during the operation of single stepping, the operation will be suspended and the program will be stopped.</p>
|
|
<p id="EN-US_TOPIC_0000001098993176__en-us_topic_0185264594_p3770133983420">Single stepping means executing one statement at a time. Once a statement is executed, you can see the execution result in other debugging tabs.</p>
|
|
<div class="note" id="EN-US_TOPIC_0000001098993176__en-us_topic_0185264594_note63837475"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p class="text" id="EN-US_TOPIC_0000001098993176__en-us_topic_0185264594_p37666363">A maximum of 100 <strong id="EN-US_TOPIC_0000001098993176__en-us_topic_0185264594_b49965631">PL/SQL Viewer</strong> tabs can be displayed at a time. If more than 100 tabs are opened, the tabs of function calls will be closed. For example, if 100 tabs are opened and a new debugging object is called, Data Studio will close the tabs of function calls and open the tab of the new debugging object.</p>
|
|
</div></div>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0000001098993176__en-us_topic_0185264594_section16046409366"><h4 class="sectiontitle">Step Into</h4><p id="EN-US_TOPIC_0000001098993176__en-us_topic_0185264594_p012893682011">To execute the code by statement, select <strong id="EN-US_TOPIC_0000001098993176__en-us_topic_0185264594_b51811544155216">Step Into</strong> from the <strong id="EN-US_TOPIC_0000001098993176__en-us_topic_0185264594_b101819444523">Debug</strong> menu, or click <span><img id="EN-US_TOPIC_0000001098993176__en-us_topic_0185264594_image151831644115220" src="figure/en-us_image_0000001098993394.jpg" width="15.96" height="13.965" title="Click to enlarge" class="imgResize"></span>, or press <strong id="EN-US_TOPIC_0000001098993176__en-us_topic_0185264594_b101831644105212">F7</strong>.</p>
|
|
</div>
|
|
<p id="EN-US_TOPIC_0000001098993176__en-us_topic_0185264594_p1763915407369">When stepping into a function, Data Studio executes the current statement and then enters the debugging mode. The debugged line will be indicated by an arrow <span><img id="EN-US_TOPIC_0000001098993176__image147482317292" src="figure/en-us_image_0000001145513399.jpg" width="14.9625" height="12.967500000000001" title="Click to enlarge" class="imgResize"></span> on the left. If the executed statement calls another function, Data Studio will step into that function. Once you have stepped through all the statements in that function, Data Studio jumps to the next statement of the function it was called from.</p>
|
|
<p id="EN-US_TOPIC_0000001098993176__en-us_topic_0185264594_p12639640123615">Press <strong id="EN-US_TOPIC_0000001098993176__b890454912294">F7</strong> to go to the next statement. If you click <strong id="EN-US_TOPIC_0000001098993176__b19904194992919">Continue</strong>, PL/SQL code execution will continue.</p>
|
|
<p id="EN-US_TOPIC_0000001098993176__en-us_topic_0185264594_p12639640193619">An example is as follows:</p>
|
|
<p id="EN-US_TOPIC_0000001098993176__en-us_topic_0185264594_p86391840163614">When entering line 8, enter <strong id="EN-US_TOPIC_0000001098993176__b299411379188">m := F3_TEST();</strong>. That is, go to line 9 in <strong id="EN-US_TOPIC_0000001098993176__b970615421810">f3_test()</strong>. You can step through all the statements in <strong id="EN-US_TOPIC_0000001098993176__b179861412191919">f3_test()</strong> by pressing <strong id="EN-US_TOPIC_0000001098993176__b316533710312">F7</strong> repeatedly to step into each line. Once you have stepped through all the statements in that function, Data Studio jumps to line 10 in <strong id="EN-US_TOPIC_0000001098993176__b147448108188">f2_test()</strong>.</p>
|
|
<p id="EN-US_TOPIC_0000001098993176__en-us_topic_0185264594_p263994011363">The currently debugged object is marked with the <span><img id="EN-US_TOPIC_0000001098993176__image6201328123311" src="figure/en-us_image_0000001145833249.jpg" width="15.96" height="15.96" title="Click to enlarge" class="imgResize"></span> symbol in the tab title, which indicates the function name.</p>
|
|
<p id="EN-US_TOPIC_0000001098993176__en-us_topic_0185264594_p930254353910"><span><img id="EN-US_TOPIC_0000001098993176__en-us_topic_0185264594_image03021743153918" src="figure/en-us_image_0000001098993258.jpg" height="219.45000000000002" width="523.6875" title="Click to enlarge" class="imgResize"></span></p>
|
|
<div class="section" id="EN-US_TOPIC_0000001098993176__en-us_topic_0185264594_section66365173377"><h4 class="sectiontitle">Stepping Over</h4><p id="EN-US_TOPIC_0000001098993176__en-us_topic_0185264594_p828564832013">Stepping over is the same as Stepping into, except that when it reaches a call for another function, it will not step into the function. The function will run, and you will be brought to the next statement in the current function. <strong id="EN-US_TOPIC_0000001098993176__b1668345203414">F8</strong> is the shortcut key for <strong id="EN-US_TOPIC_0000001098993176__b1468335153414">Step Over</strong>. However, if there is a breakpoint set inside the called function, <strong id="EN-US_TOPIC_0000001098993176__b9980312183410">Step Over</strong> will enter the function, and hit the set breakpoint.</p>
|
|
</div>
|
|
<p id="EN-US_TOPIC_0000001098993176__en-us_topic_0185264594_p11639134053618">In the following example, when you click <strong id="EN-US_TOPIC_0000001098993176__b1495152003410">Step Over</strong> in line 10, Data Studio executes the <strong id="EN-US_TOPIC_0000001098993176__b8967517152115">f3_test()</strong> function.</p>
|
|
<p id="EN-US_TOPIC_0000001098993176__en-us_topic_0185264594_p0789455143918"><span><img id="EN-US_TOPIC_0000001098993176__en-us_topic_0185264594_image1789155512390" src="figure/en-us_image_0000001098673432.jpg"></span></p>
|
|
<p id="EN-US_TOPIC_0000001098993176__en-us_topic_0185264594_p463914405361">The cursor will be moved to the next statement in <strong id="EN-US_TOPIC_0000001098993176__b01291644132111">f2_test()</strong>, that is, line 11 in <strong id="EN-US_TOPIC_0000001098993176__b2888125710214">f2_test()</strong>.</p>
|
|
<p id="EN-US_TOPIC_0000001098993176__en-us_topic_0185264594_p1476620664018"><span><img id="EN-US_TOPIC_0000001098993176__en-us_topic_0185264594_image17766106154014" src="figure/en-us_image_0000001145713179.jpg"></span></p>
|
|
<p id="EN-US_TOPIC_0000001098993176__en-us_topic_0185264594_p864074012363">You can step over a function when you are familiar with the way the function works and ensure that its execution will not affect the debugging.</p>
|
|
<div class="note" id="EN-US_TOPIC_0000001098993176__en-us_topic_0185264594_note146401340113620"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p class="text" id="EN-US_TOPIC_0000001098993176__en-us_topic_0185264594_p1564004017361">Stepping over a line of code that does not contain a function call executes the line just like stepping into the line.</p>
|
|
</div></div>
|
|
<div class="section" id="EN-US_TOPIC_0000001098993176__en-us_topic_0185264594_section1856923733710"><h4 class="sectiontitle">Stepping Out</h4><p id="EN-US_TOPIC_0000001098993176__en-us_topic_0185264594_p8612165912015">Stepping out of a sub-program continues execution of the function and then suspends execution after the function returns to its calling function. You can step out of a long function when you have determined that the rest of the function is not significant to debug. However, if a breakpoint is set in the remaining part of the function, then that breakpoint will be hit before returning to the calling function.</p>
|
|
</div>
|
|
<p id="EN-US_TOPIC_0000001098993176__en-us_topic_0185264594_p1364084016361">A function will be executed when you step over or step out of it. <strong id="EN-US_TOPIC_0000001098993176__b5247193410233">Shift+F7</strong> is the shortcut key for <strong id="EN-US_TOPIC_0000001098993176__b281425592314">Step Out</strong>.</p>
|
|
<p id="EN-US_TOPIC_0000001098993176__en-us_topic_0185264594_p653231517409"><span><img id="EN-US_TOPIC_0000001098993176__en-us_topic_0185264594_image3532141544010" src="figure/en-us_image_0000001145713175.jpg" height="230.4225" width="523.6875" title="Click to enlarge" class="imgResize"></span></p>
|
|
<p id="EN-US_TOPIC_0000001098993176__en-us_topic_0185264594_p13640640133620"></p>
|
|
<p id="EN-US_TOPIC_0000001098993176__en-us_topic_0185264594_p166401640123620">In the preceding example:</p>
|
|
<ul id="EN-US_TOPIC_0000001098993176__en-us_topic_0185264594_ul6640164003617"><li id="EN-US_TOPIC_0000001098993176__en-us_topic_0185264594_li1864014014361">Choose <strong id="EN-US_TOPIC_0000001098993176__b2022411818247">Debug</strong> > <strong id="EN-US_TOPIC_0000001098993176__b1484772082414">Step Into</strong> to step into <strong id="EN-US_TOPIC_0000001098993176__b1518242722419">f3_test()</strong>.</li><li id="EN-US_TOPIC_0000001098993176__en-us_topic_0185264594_li18640104017367">Choose <strong id="EN-US_TOPIC_0000001098993176__b340610401243">Debug</strong> > <strong id="EN-US_TOPIC_0000001098993176__b593584217247">Step Out</strong> to step out of <strong id="EN-US_TOPIC_0000001098993176__b1080111022518">f3_test()</strong>.</li></ul>
|
|
<div class="section" id="EN-US_TOPIC_0000001098993176__en-us_topic_0185264594_ref471314683"><a name="EN-US_TOPIC_0000001098993176__en-us_topic_0185264594_ref471314683"></a><a name="en-us_topic_0185264594_ref471314683"></a><h4 class="sectiontitle">Continuing the Debugging</h4><p id="EN-US_TOPIC_0000001098993176__en-us_topic_0185264594_p33770688">When the debugged process stops at a specific location, you can select <strong id="EN-US_TOPIC_0000001098993176__en-us_topic_0185264594_b3194617">Continue</strong> (<strong id="EN-US_TOPIC_0000001098993176__en-us_topic_0185264594_b34680106183311">F9</strong>) from the <strong id="EN-US_TOPIC_0000001098993176__en-us_topic_0185264594_b28751554">Debug</strong> menu, or click <span><img id="EN-US_TOPIC_0000001098993176__en-us_topic_0185264594_image56987454" width="15.96" height="15.96" src="figure/en-us_image_0000001098833260.jpg" title="Click to enlarge" class="imgResize"></span> in the toolbar to continue the PL/SQL function execution.</p>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0000001098993176__en-us_topic_0185264594_viewcallstack"><a name="EN-US_TOPIC_0000001098993176__en-us_topic_0185264594_viewcallstack"></a><a name="en-us_topic_0185264594_viewcallstack"></a><h4 class="sectiontitle">Viewing Callstack</h4><p id="EN-US_TOPIC_0000001098993176__en-us_topic_0185264594_p52581080">The <strong id="EN-US_TOPIC_0000001098993176__en-us_topic_0185264594_b63040734">Callstack</strong> pane displays the chain of functions as they are called. The <strong id="EN-US_TOPIC_0000001098993176__b201971519102717">Callstack</strong> pane can be opened from the minimized window. The most recent functions are listed at the top, and the least recent at the bottom. At the end of each function name is the current line number in that function.</p>
|
|
<p id="EN-US_TOPIC_0000001098993176__en-us_topic_0185264594_p12446250">You can double-click the function names in the <strong id="EN-US_TOPIC_0000001098993176__b15728840143814">Callstack</strong> pane to open panes of different functions. For example, when <strong id="EN-US_TOPIC_0000001098993176__b3511164112300">f2_test()</strong> calls line 10 of <strong id="EN-US_TOPIC_0000001098993176__b1149455433011">f3_test()</strong>, the debugging pointer will point to the first executable line (that is, line 9 in the preceding example) in the function call.</p>
|
|
<p id="EN-US_TOPIC_0000001098993176__en-us_topic_0185264594_p13620192">In this case, the <strong id="EN-US_TOPIC_0000001098993176__b1931156153913">Callstack</strong> pane will be displayed as follows.</p>
|
|
<p id="EN-US_TOPIC_0000001098993176__en-us_topic_0185264594_p29493756"><span><img id="EN-US_TOPIC_0000001098993176__en-us_topic_0185264594_image57075007" src="figure/en-us_image_0000001145513261.jpg" width="332.46675" height="135.16125" title="Click to enlarge" class="imgResize"></span></p>
|
|
<div class="note" id="EN-US_TOPIC_0000001098993176__en-us_topic_0185264594_note40183996"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p class="text" id="EN-US_TOPIC_0000001098993176__en-us_topic_0185264594_p26111645">Press <strong id="EN-US_TOPIC_0000001098993176__b18647181093913">Alt+J</strong> to copy the content in the <strong id="EN-US_TOPIC_0000001098993176__b1464791093917">Callstack</strong> pane.</p>
|
|
</div></div>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="DWS_DS_62.html">Debugging a PL/SQL Function</a></div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<script language="JavaScript">
|
|
<!--
|
|
image_size('.imgResize');
|
|
var msg_imageMax = "view original image";
|
|
var msg_imageClose = "close";
|
|
//--></script> |