mirror of
https://github.com/EiffelSoftware/eiffel-org.git
synced 2026-03-22 17:51:15 +01:00
Author:halw
Date:2008-10-07T22:18:20.000000Z git-svn-id: https://svn.eiffel.com/eiffel-org/trunk@71 abb3cda0-5349-4a8f-a601-0c33ac3a8c38
This commit is contained in:
@@ -2,8 +2,6 @@
|
||||
[[Property:link_title|Debugging and Run-time Monitoring]]
|
||||
[[Property:weight|-2]]
|
||||
[[Property:uuid|a53f6a74-7145-35ab-ed5e-2905aeb88774]]
|
||||
[[Help reading the EiffelStudio Guided Tour|Help reading this manual]]
|
||||
|
||||
The next set of EiffelStudio capabilities enable you to control and monitor the execution of your systems. The obvious immediate application is to debugging; but the more general goal is to let you follow the execution of your systems, explore the object structures, and gain a better understanding of the software.
|
||||
<div>
|
||||
==A reminder about debugging in Eiffel==
|
||||
@@ -20,17 +18,25 @@ The facilities to be described now are also useful when you find such an error,
|
||||
To control the execution you will set breakpoints, indicating places where you want to interrupt the execution. You may set a breakpoint on an individual instruction of a routine, on the routine's precondition or postcondition, or on the routine as a whole, meaning its first operation (precondition or instruction).
|
||||
|
||||
A group of icons on the Project Toolbar help control breakpoints. They are known in EiffelStudio terminology as "''buttonholes''", meaning that they can serve both as buttons (you can click them to get some functions) and holes (you can pick-and-drop into them to get some other functions).
|
||||
<div> [[Image:index-82]] [[general/guided_tour/studio/index-82.png|(link)]] </div>
|
||||
|
||||
[[Image:index-82]]
|
||||
|
||||
The labels correspond to the icons' use as buttons: enable all set breakpoints, disable them all, clear all, display information on current breakpoints. The difference between "disabling" and "removing" is that disabling turns off breakpoints until further notice but remembers them, so that you can later re-enable them, whereas "removing" clears them for good.
|
||||
|
||||
Target a Development Window to the class <code> TESTROOT </code> and pick-and-drop the name of the procedure <code> make </code> (the first routine, after the declaration of the two attributes <code> o1 </code> and <code> o2 </code>) to the <code> Enable all </code> icon, used here as a hole. This sets and enables a breakpoint on the routine. Click the button labeled <code> Show/Hide information about breakpoints </code> above to get the list of breakpoints, as shown in the next figure.
|
||||
<div> [[Image:index-83]] [[general/guided_tour/studio/index-83.png|(link)]] </div>
|
||||
|
||||
[[Image:index-83]]
|
||||
|
||||
This shows that so far you have enabled only one breakpoint. For a finer degree of control, let's look at the feature's flat form. Pick-and-drop <code> make </code> to the Context Tool -- from the Context Tool itself, since its name appears there, or the Editing Tool); this sets the Context to the <code> Feature </code> Tab. Select the <code> Flat </code> view if that wasn't the last one used:
|
||||
<div> [[Image:index-84]] [[general/guided_tour/studio/index-84.png|(link)]] </div>
|
||||
|
||||
[[Image:index-84]]
|
||||
|
||||
The small circles on the left side of the Flat form indicate breakpoint positions. Empty ones are not set; enabled breakpoints are marked by a circle filled with red. At the moment only one is enabled, corresponding to the first instruction of the routine since, as noted, setting a breakpoint on a routine as a whole means setting it on its first operation.
|
||||
|
||||
By (left) clicking on a breakpoint mark, you toggle it between enabled and not set. You can also right-click on a mark to get a menu of possibilities. Try enabling and unsetting a few of these marks; you might get something like this:
|
||||
<div> [[Image:index-85]] [[general/guided_tour/studio/index-85.png|(link)]] </div>
|
||||
|
||||
[[Image:index-85]]
|
||||
|
||||
The breakpoint mark for the routine's third instruction, <code> create </code> <code> o2 </code>, is red but not filled; this means it is set but not enabled. You can obtain this by right-clicking on the mark and choosing <code> Disable breakpoint </code> on the menu that comes up. Any potential breakpoint will be in one of three states: not set; enabled; set but disabled.
|
||||
|
||||
You can see the list of enabled and disabled breakpoints by clicking the <code> Output </code> Tab, or the <code> Display info </code> button in the Project Toolbar.
|
||||
@@ -40,13 +46,17 @@ For the continuation of this tour it doesn't matter which exact breakpoints of <
|
||||
==Executing with breakpoints==
|
||||
|
||||
To execute, you will use the following Run buttons in the Project toolbar, or the corresponding entries in the <code> Debug </code> menu:
|
||||
<div> [[Image:index-82]] [[general/guided_tour/studio/index-82.png|(link)]] </div>
|
||||
|
||||
[[Image:index-82]]
|
||||
|
||||
The buttons are shown here in full bloom, but at any times some of them will be grayed out. <code> Terminate </code> is only active when execution has started and not terminated; <code> Interrupt </code> is only active when the execution is active (not stopped at a breakpoint).
|
||||
|
||||
The <code> Debug </code> menu entries will also remind you of shortcuts: F10 for <code> Step-by-step </code>, F11 for <code> Step into routine </code>, Shift-F11 for <code> Step out of routine </code>, CTRL-F5 for <code> Run without breakpoints </code>, F5 for <code> Run with breakpoints </code>, CTRL-Shift-F5 for <code> Interrupt </code>, Shift-F5 for <code> Terminate </code>.
|
||||
|
||||
Start execution of the compiled system by clicking <code> Run with breakpoints </code>. The display automatically switches to accommodate supplementary tools providing debugging information. Execution stops on the breakpoint that you have enabled on the first instruction of procedure <code> make </code>:
|
||||
<div> [[Image:index-87]] [[general/guided_tour/studio/index-87.png|(link)]] </div>
|
||||
|
||||
[[Image:index-87]]
|
||||
|
||||
The pane at the bottom left indicates that execution has stopped in <code> make </code>. The Context shows the flat form of that routine, with a new icon to indicate the stop point which execution has reached. At the bottom right is a new tool, the '''Object Editor''', which shows the content of current object and (later) related objects. At the moment you can see that:
|
||||
* The current object is an instance of class <code> TESTROOT </code>.
|
||||
* The class (as you could also see from its text in a Development Window) has two attributes <code> o1 </code> and <code> o2 </code>, for which the corresponding fields in the current object are both void; this is as expected since you haven't yet executed the two creation instructions <code> create </code> <code> { </code> <code> HEIR </code> <code> } </code> <code> o1 </code> and <code> create </code> <code> o2 </code>, as they come after the breakpoint.
|
||||
@@ -57,7 +67,9 @@ The execution-time objects that you may display in an Object Editor are our late
|
||||
==Monitoring progress==
|
||||
|
||||
Click twice on <code> Step-by-step </code> (or press the function key F10 twice). Monitor, in the flat form of <code> make </code>, the marker that shows execution progress; note that the marker always points to the <span>next</span> operation to be executed. After the two steps, the Context and Object Tools look like this:
|
||||
<div> [[Image:index-88]] [[general/guided_tour/studio/index-88.png|(link)]] </div>
|
||||
|
||||
[[Image:index-88]]
|
||||
|
||||
The last instruction that you executed is <code> create </code> <code> { </code> <code> HEIR </code> <code> } </code> <code> o1 </code>, meaning create an object and attach it to <code> o1 </code>, but instead of using the declared type <code> PARENT </code> of <code> o1 </code> use its proper descendant <code> HEIR </code>. As a result, the entry for <code> o1 </code> in the Object Tool no longer shows <code> Void </code> but an object of type <code> HEIR </code>. Note that all objects are identified by their addresses in hexadecimal; such an address is by itself meaningless, but enables you to see quickly whether two object references are attached to the same object. The addresses you see as you run the Guided Tour will -- except for some unlikely coincidence -- be different from the ones appearing here.
|
||||
|
||||
Note that since the garbage collector compacts memory and hence may move objects around, the address of a given object is not guaranteed to remain the same throughout a session.
|
||||
|
||||
Reference in New Issue
Block a user