~ubuntu-branches/ubuntu/wily/tora/wily-proposed

« back to all changes in this revision

Viewing changes to doc/help/debugger.texi

  • Committer: Bazaar Package Importer
  • Author(s): Albin Tonnerre
  • Date: 2007-05-29 13:13:36 UTC
  • mfrom: (1.2.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20070529131336-85ygaddivvmkd3xc
Tags: 1.3.21pre22-1ubuntu1
* Merge from Debian unstable. Remaining Ubuntu changes:
  - debian/rules: call dh_iconcache
  - Remove g++ build dependency
* Modify Maintainer value to match Debian-Maintainer-Field Spec

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
@node debugger
 
2
@section PL/SQL Debugger
 
3
@cindex PL/SQL Debugger
 
4
 
 
5
This tool provides you with an advanced editor and debugger for developing PL/SQL objects.
 
6
 
 
7
@image{images/debugger}
 
8
 
 
9
@subheading Elements of the debugger window
 
10
 
 
11
On the top of the screen is the toolbar for the debugger.
 
12
 
 
13
Below that to the left are two panes. The top one Objects contains the available objects in the selected schema. The schema is selectable through the toolbar. Select the code object you want to debug or edit in this list or start a new object before starting to edit the code.
 
14
 
 
15
The lower pane Contents contains the structure of the selected object. Here you can find declared methods of packages and also variables or even anonymous blocks in your code. Selecting a line in this pane will move the cursor to where the element is in your code, for instance where a variable or method is declared.
 
16
 
 
17
To the right is a large editor area where you can edit the current object. The editor is describe more later.
 
18
 
 
19
The last part of the screen is not always visible and contain information about the currently running debugging session.
 
20
 
 
21
@subheading Toolbar & menu
 
22
 
 
23
The toolbar and menu contain pretty much the same commands with a few exceptions.
 
24
 
 
25
 
 
26
@table @asis
 
27
@item @strong{Refresh object list}      
 
28
      Update the @strong{Object} list to the left of the screen. This is first on the toolbar and close to the end in the menu. 
 
29
      The keyboard shortcut for this is @strong{F5}. 
 
30
      Observe that this list is read from the object cache and will not be updated unless you reread the object cache as well 
 
31
      (Available from the File menu.
 
32
@item @strong{Select schema}
 
33
      In the toolbar this is a combobox listing the available schemas. Changing the schema will change the objects displayed in the @strong{Object} list.
 
34
      Selecting it in the menu (Close to the end) or selecting the @strong{ALT+S} keyboard shortcut will move the keyboard focus to the toolbar combobox.
 
35
@item @strong{New sheet}
 
36
      Start editing a new object.     
 
37
@item @strong{Scan source}
 
38
      Update the @strong{Contents} list to the left on the screen according to the source currently in the editor. 
 
39
      TOra will try to keep up with this as you write, but new blocks and declarations will only show up if you rescan the source. 
 
40
      The keyboard shortcut for this is @strong{CTRL+F9}.
 
41
@item @strong{Compile}
 
42
      Compile the current editor. This will compile the procedure with the debug option, 
 
43
      if you don't have the debug options you need to recompile it in order to be able to see watches. The keyboard shortcut for this is @strong{F9}.
 
44
@item @strong{Execute}
 
45
      Call the method, procedure or function closest to the cursor. 
 
46
      It's off course only when you edit packages that there are several methods to choose from in the current editor. 
 
47
      If you have changed the source TOra will ask you if you want to recompile and start over or simply continue without recompiling. 
 
48
      The keyboard shortcut for this is @strong{CTRL+Return}.
 
49
@item @strong{Stop}
 
50
      Halt the currently running execution. The keyboard shortcut for this is @strong{F12}.    
 
51
@item @strong{Step into}
 
52
      Step into any functions or procedures called on the current line of execution. The keyboard shortcut for this is @strong{F7}.    
 
53
@item @strong{Step over}
 
54
      Step to the next line of the current editor. The keyboard shortcut for this is @strong{F8}
 
55
@item @strong{Return from.}
 
56
      Continue running until returned from the current function or procedure. The keyboard shortcut for this is @strong{F6}.
 
57
@item @strong{Head editor}
 
58
      Switch between the head and body editor. For more information see the editor section below. The keyboard shortcut for this is @strong{CTRL+Space}.
 
59
@item @strong{Debug pane}
 
60
      Display or hide the debugging pane at the bottom of the debugging window. The keyboard shortcut for this is @strong{F11}.
 
61
@item @strong{Next error}
 
62
      Move the cursor to the next syntax error in the current editor. For more information about syntax errors in editors see the editor section. 
 
63
      The keyboard shortcut for this is @strong{CTRL+N}.
 
64
@item @strong{Previous error}
 
65
      Move the cursor to the previous syntax error in the current editor. For more information about syntax errors in editors see the editor section. 
 
66
      The keyboard shortcut for this is CTRL+P.
 
67
@item @strong{Toggle breakpoint}
 
68
      Add or remove a breakpoint on the current line of the editor. 
 
69
      Breakpoints are indicated with a small stop sign to the right of the line in the editor. The keyboard shortcut for this is @strong{CTRL+F5}.
 
70
@item @strong{Disable breakpoint}
 
71
      Will disable or enable a breakpoint on the current editor. 
 
72
      A disabled breakpoint will be seen is grayed out in the margin of the editor of the line it is on. 
 
73
      The keyboard shortcut for this is @strong{CTRL+F6}.
 
74
@item @strong{Add watch}
 
75
      Add a watched variable. See here for more information about watches. The keyboard shortcut for this is @strong{F4}.      
 
76
@item @strong{Delete watch}
 
77
      Remove a watched variable. The keyboard shortcut for this is @strong{CTRL+Del}.
 
78
@item @strong{Change watch}
 
79
      Change the value of a watch. See here for more information about watches. The keyboard shortcut for this is @strong{CTRL+F4}.
 
80
@item @strong{Erase runtime log}
 
81
      Remove the content of the runtime log which is in the rightmost pane of the debugger info.
 
82
@end table
 
83
 
 
84
@subheading Debugger editor
 
85
 
 
86
There are a few things that are special to the PL/SQL debugger compared to other editors in TOra. First of all there are actually two editors. In one you edit the declaration of a package this is called the @strong{head} editor. The other one is used to edit the implementation of a package and is called the @strong{body} editor. If you are editing procedures or functions you will only use the @strong{body} editor. You switch between the editors using the @strong{CTRL+Space} keyboard shortcut or with the @strong{head editor} toolbar button or menu entry. This also mean that when you run a program and make a change, but still decide to keep stepping through your program without restarting you can have one other changed file plus the current file, if you try to step to another object TOra will ask if you want to continue until you are back in the edited files or recompile.
 
87
 
 
88
Another thing special in this editor is that the PL/SQL editor will show you errors in the package. The errors are highlighted with a special background color (The default is red, but this is configurable in the options(@pxref{preferences,Options}). You can also use the @strong{next error} or @strong{previous error} toolbar button/menu entries to step between the errors.
 
89
 
 
90
Next thing to know about the debugger is breakpoints. You can set a breakpoint either by selecting the @strong{toggle breakpoint} toolbar button or menu entry. This will add a breakpoint to the line you are currently on in the editor. To remove the breakpoint simply select @strong{toggle breakpoint} again. 
 
91
Another way to add or remove breakpoints is to double-click in the left margin of the editor where you also see where the breakpoints are. They are indicated by a small stop sign in the margin. If you want to temporarily disable a breakpoint that you might need to enable again later you can also choose @strong{disable breakpoint}, this is also a toggle so selecting the command again will re-enable the breakpoint. For those of you who don't know breakpoints means that when execution of the object comes to the line containing the breakpoint the debugger will stop and allow you to inspect the data.
 
92
 
 
93
Which brings us to the last special thing in this editor which is the current line of execution, this is an indication of where the execution currently is at. This line is indicated by a special background (Default is green, but that is configurable in the options(@pxref{preferences,Options})).
 
94
 
 
95
@subheading Debugger information
 
96
 
 
97
Information about the current state of execution is shown in the pane at the bottom of the debugger window which you can be hidden. You hide or show this by selecting the command @strong{debug pane} command or by pressing the @strong{F11} key. The debug pane consist of several tabs containing the following information.
 
98
 
 
99
@table @asis
 
100
 
 
101
@item @strong{Stack trace}
 
102
      Contains the current stack trace. This means the list of called objects that have lead to the current line of execution. Selecting a line will bring up the object and line where the the call to the next object was made except for the last line which is the current line of execution.
 
103
@item @strong{Watches}
 
104
      Watches is where you can inspect variables in your PL/SQL code while running. They are explained in more detail later.
 
105
@item @strong{Breakpoints}
 
106
      A list of where you current have your breakpoints and their status. The status can be @strong{enabled} or @strong{disabled} which are pretty self explanatory. 
 
107
      It can also be @strong{deferred} which means that some error have occurred setting the breakpoint. 
 
108
      Every time execution is restarted TOra tries to set any breakpoints that are @strong{deferred}.
 
109
@item @strong{Parameters}
 
110
      This displays the input and output parameters that you passed to the original call that started the debugging. The output parameters are off course not available until the execution is finished.
 
111
@item @strong{Debug output}
 
112
      Any DBMS_OUTPUT output from your debugging session will end up in this window. For more information about using this see the output tool.
 
113
@item @strong{Runtime log}
 
114
      This is simply a log displaying what is happening in the target debugging thread and probably not of much interest to anybody except TOra developers. One exception is that if you somehow get an SQL error when you function or procedure of choice is executed those errors will end up here.
 
115
 
 
116
@subheading Watches
 
117
Watches are a way to inspect the contents of variables in a running program. 
 
118
When you add a watch using the @strong{add watch} command you are presented with the following dialog.
 
119
 
 
120
@image{images/addwatch}
 
121
 
 
122
First of all you need to select the scope the variable is declared in. The @strong{local} scope is variables only declared in the current context, like for instance this function or procedure. The @strong{head} and @strong{body} are variables declared in packages. Variables in packages are usually also available in the global scope. When you declare a watch in any scope except for @strong{local} you should also indicate the object in which the variable is declared in the format schema.object.variable. The current object is prepended to the variable name when you select anything but the @strong{local} scope.
 
123
 
 
124
Finally you have to fill out the variable name. If you have the cursor on a variable in the editor that name is the default when you add the watch.
 
125
 
 
126
You can then see the contents of this variable in the @strong{watch} pane of the debugger info. The value will be updated every time execution stops while you are debugging. If the variable can not be found it will be @strong{@{Unavailable@}}. If all variables are unavailable even though they shouldn't you have probably forgotten to compile the object with the debug option. You can remedy this by simply using the @strong{compile} command. TOra will always compile programs using the debug option when in the PL/SQL debugger.
 
127
 
 
128
TOra can also inspect list and table object which will show up as child items in the list to the variable. When this is a case you can also see how many items an array is having in the parent of the actual data items.
 
129
 
 
130
You can remove a watch by selecting it in the watch list and selecting the @strong{remove watch} command.
 
131
 
 
132
You can also change the content of a watch. First you select the watch you want to change in the watch list, then you select the @strong{change watch} command. You will be shown this dialog.
 
133
 
 
134
@image{images/changewatch}
 
135
 
 
136
If you have selected the parent of an array watch you will be able to select the index you want to assign a new value with the @strong{index} indicator to right. Then you enter the new value in the text field or check the @strong{NULL} indicator to set the value to NULL.
 
137
 
 
138
@end table