home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Professional / OS2PRO194.ISO / os2 / prgramer / mltiscop / tutor.doc < prev    next >
Text File  |  1989-07-28  |  40KB  |  982 lines

  1.  
  2.            The Logitech MultiScope(tm) Trial Version Tutorial 
  3.           ====================================================
  4.  
  5.   This tutorial provides an overview of MultiScope features and commands
  6.   you need to debug your program.  It discusses the basic strategies for
  7.   debugging and provides a brief introduction to the debugging process.
  8.   You will learn how to
  9.  
  10.     * Start the MultiScope debuggers.
  11.     * Get on-line help.
  12.     * Execute your program in steps.
  13.     * Look at your program's modules.
  14.     * Examine your program's source code.
  15.     * Browse through your program's data structures.
  16.     * Modify a variable.
  17.     * View a graphic data representation.
  18.     * Set simple and conditional breakpoints.
  19.     * Look at your program's memory.
  20.  
  21.  
  22. The Debugging Process
  23. ---------------------
  24.  
  25.  MultiScope is a programmer's tool that lets you find and diagnose
  26.  programming errors.  Programmers usually follow three basic steps
  27.  when debugging a program:
  28.  
  29.     * Finding an error.
  30.     * Diagnosing an error.
  31.     * Fixing an error.
  32.  
  33.  The first step in the debugging process is to find the errors in
  34.  your program.  It is a common for beta testers or quality assurance
  35.  personnel to test your program to help find errors.  The testers
  36.  prepare "bug reports" detailing the program  errors.  However,
  37.  diagnosing the problems that led to the errors is not always
  38.  possible.
  39.  
  40.  The second step in the debugging process is diagnosing the cause of
  41.  the error.  Errors are common during software development and may
  42.  take many hours, and sometimes days, to properly diagnose.  Often
  43.  errors happen the first time you test your program, but many times
  44.  they arise only after repeated testing.  If your program terminates
  45.  abnormally (crashes) diagnosing the cause of the crash can be
  46.  difficult if not impossible.
  47.  
  48.  With MultiScope it is easy to find and diagnose errors because you can
  49.  
  50.     * Control the execution of your program.
  51.     * Inspect your program in easy to understand views.
  52.     * Pinpoint the location of errors at the source code level.
  53.  
  54.  The final step of the debugging process is fixing your program.
  55.  Although MultiScope can make the first two steps of the debugging
  56.  process easier, it cannot fix your program's errors.  How you fix
  57.  these is up to you.
  58.  
  59.  The best way to learn how to use MultiScope is to jump right in and
  60.  start debugging a program.  An example tutorial program has been
  61.  provided for this tutorial.
  62.  
  63.  Note:  When you are instructed to "click" on an item in this tutorial,
  64.  you should press and release the left mouse button on the indicated
  65.  item.
  66.  
  67.  
  68. 1.  Your First Look at MultiScope
  69. ---------------------------------
  70.  
  71.  This section explains how to start the Run-Time Debugger, and get help.
  72.  and quit the program.  To start the MultiScope Run-Time Debugger tutorial,
  73.  follow steps 1 and 2.
  74.  
  75.  Step 1:  Move to the MultiScope trial version directory.  Before you
  76.   can start the MultiScope debugger, you must move to the directory
  77.   where your MultiScope program files reside.  From the OS/2 command
  78.   line, type:
  79.  
  80.     C:
  81.     CD \MSCOPE
  82.  
  83.   where C:\MSCOPE is the path and directory you specified during
  84.   the installation of the trial version of MultiScope.
  85.  
  86.  Step 2:  Start the Run-Time Debugger tutorial.  To start the debugger
  87.   and this tutorial, type
  88.  
  89.     MSDEMO
  90.  
  91.   The Presentation Manager Run-Time Debugger is then loaded.  Take
  92.   a quick look  at Multiscope's default screen configuration on your
  93.   screen. This screen, which can be customized, has 1 main window that
  94.   contains 13 subwindows.  The main window's title bar reads "MultiScope
  95.   Debugger".  Each of the subwindows is either open or identified by an
  96.   icon at the bottom of the screen. The subwindow's title bar identifies
  97.   the information the window contains.  For example, the Source window
  98.   displays the source code of the program you are debugging.
  99.  
  100.  Step 3:  Look at the global menu bar.  Multiscope's global menu bar,
  101.   located under the title bar of the main window, has these pull-down
  102.   menus:  Program, Windows, Go, Setup, and Others.  Global menus contain
  103.   commands that you can execute at any time in the debugging session with
  104.   either the mouse or the keyboard.
  105.  
  106.  Step 4:  Open a global menu.  Move  the pointer to the Windows menu.
  107.   Click to open the Windows menu.
  108.  
  109.   Notice that the menu commands are displayed on the left side and the
  110.   corresponding accelerator keys on the right. Once a menu is open,
  111.   you can select a command by clicking on it with the mouse or
  112.   highlighting it with the arrow keys and pressing Enter.
  113.  
  114.  Step 5:  Close Windows menu.  Click outside the menu.
  115.  
  116.  Step 6:  Activate a window.   Press Ctrl-D to activate the Data window.
  117.   To activate a window, press Ctrl plus the letter that corresponds with
  118.   the window's name.
  119.  
  120.   Note:  The accelerator key for the Memory window is Ctrl-E.
  121.  
  122.  Step 7:  Open a local menu.  Under the title bar of each subwindow are
  123.   the local menus.  Local menus are only available when that window is
  124.   active. In this case the Data window is active, so the View, Watch, and
  125.   Others menus are available.  Move the pointer to the View menu and
  126.   click.
  127.  
  128.   To select a local menu command, click on it with the mouse or highlight
  129.   it with the arrow keys and then press Enter.  Most local commands are
  130.   available without opening the menu by using an accelerator key.  The
  131.   accelerator keys for local commands are always Alt plus a letter, such
  132.   as Alt-C to execute the Child/Contents command on the View menu.
  133.  
  134.  Step 8:  Close View menu.  Click the pointer outside the menu.
  135.  
  136.  Step 9:  Select the Data window.  Press Ctrl-D to activate the Data window.
  137.  
  138.  Step 10:  Get Help.  Press F1 to get help.  Since the Data window is
  139.   active, the Help window displays the local index for that window.
  140.  
  141.  Step 11:  View Help.  Double-click the left mouse button on Child/Contents
  142.   to view the Help screen for this command.
  143.  
  144.  Step 12:  Leave the local index.  Double-click the right mouse button to
  145.   return to the local index.
  146.  
  147.  Step 13:  Leave Help.  Press F1 to exit from Help and return to
  148.   MultiScope's main window.
  149.  
  150.  
  151.   In summary, you can use MultiScope's interface effectively by following
  152.   the basic keystroke and mouse guidelines shown below.
  153.  
  154.     * To execute global commands, press Ctrl plus a corresponding key or
  155.       select the command from the global menu with the mouse or keyboard.
  156.  
  157.     * To execute local commands, press Alt plus a corresponding key or
  158.       select the command from the local menu with the mouse or keyboard.
  159.  
  160.     * To execute Go commands, press the first letter of the Go command.
  161.  
  162.     * To execute certain commands quickly, for example, to get information
  163.       about the Help index items, double-click the mouse.
  164.  
  165.     * To maximize or minimize a window, click on the appropriate icon in
  166.       the window's upper right corner.
  167.  
  168.  
  169. 2.  Customizing Your Screen
  170. ---------------------------
  171.  
  172.  Customizing your screen allows you to restore, resize, maximize, or
  173.  move a window. For example, you may want to maximize the Source
  174.  window to display more code or restore a window to view its
  175.  contents, or change a window's background and text colors.
  176.  
  177.  Step 1:  Maximize the MultiScope window.  Click on the maximize icon
  178.   (the up arrow) in the upper right corner of the main window.  The window
  179.   expands and occupies the entire Presentation Manager screen.
  180.  
  181.  Step 2:  Restore an icon to a window.  Double-click on the Log window
  182.   icon to restore (or open) the window from an icon. The Log window is
  183.   restored, but you may need to resize it to see its contents.
  184.  
  185.  Step 3:  Resize a window.  Place the pointer over the left border of the
  186.   Log window. The pointer changes into a two-way arrow that points either
  187.   horizontally, vertically, or diagonally.  Click and drag the mouse to
  188.   enlarge the window.  A shaded box marks the borders of the window and
  189.   expands as you move your mouse. Release the mouse button to anchor the
  190.   window at its new location.
  191.  
  192.  Step 4:  Move a window.  Position the pointer over the Log window's
  193.  title bar. Press and hold the left mouse button.  Click and drag the
  194.  mouse to move the window to a new location on the screen. Release
  195.  the mouse button to set the window at its new location.
  196.  
  197.  Step 5:  Maximize a window.  Click on the maximize icon (the up arrow)
  198.   in the upper right corner of the Log window.  The window expands and
  199.   occupies MultiScope's entire main window.
  200.  
  201.  Step 6:  Minimize a window.  Click on the minimize icon (the down arrow)
  202.  in the upper right corner of the Log window.  The window becomes an icon
  203.  and is displayed at the bottom of the main window.
  204.  
  205.  Step 7:  Change a window's color.  Press Ctrl-S to make the Source window
  206.   active if it is not already.  Press Ctrl-Keypad+, and the Source window's
  207.   background color changes.  Press Ctrl-Keypad-, and the window returns to
  208.   its original color.
  209.  
  210.   Pressing Ctrl-Keypad+ and Ctrl-Keypad- cycles the active window's
  211.   background color through a set of color combinations.
  212.  
  213.   You can also change all the colors of a window with the Color Panel
  214.   command in the global Setup menu.
  215.  
  216.  Step 8:  Change the text size in a window.  Press Ctrl-1, and the text
  217.   in the Source window changes to a smaller font.  Press Ctrl-3, and the
  218.   text becomes larger.  Press Ctrl-2, and the text returns to the original
  219.   font size in between the two.
  220.  
  221.  Step 9:  (Optional) Save your screen configuration.  You can save the
  222.   screen configuration now or wait until you have customized your screen
  223.   before saving it. To save the screen configuration, select Save Setup
  224.   from the global Setup menu.
  225.  
  226.  
  227. 3.  Executing Your Program
  228. --------------------------
  229.  
  230.  This section is your first chance to execute your program in the
  231.  Run-Time Debugger.  You will begin by using the Find Procedure/Line
  232.  command to locate a procedure and a line number in the Source window.
  233.  Next, you will execute TUTOR to a selected line and look at TUTOR's
  234.  output.  Finally, you will step through your program with the Go
  235.  commands at the source and assembly level.
  236.  
  237.  
  238.  3.1  Executing to a Selected Line
  239.  ---------------------------------
  240.  
  241.  You can search for a procedure or a line number in your source code
  242.  with the Find Procedure/Line command. This is the quickest way to find
  243.  a procedure or line without scrolling through lines and lines of code.
  244.  One reason you would move to a particular line is to execute
  245.  to that line.
  246.  
  247.  Step 1:  Make the Source window active.  Press Ctrl-S to make the Source
  248.   window active.
  249.  
  250.  Step 2:  Search for a line number.  From the local Find menu, select Find
  251.   Procedure/Line. MultiScope prompts you with a dialog box.  Enter the line
  252.   number.  Enter
  253.  
  254.     63
  255.  
  256.   The Source window updates and shows the code for line 63,  which is
  257.   highlighted.
  258.  
  259.  Step 3:  Execute the program to the selected line.  Double-click on
  260.  
  261.     ChooseMe(1,"MultiScope",3);
  262.  
  263.   This selects this line and executes the application program to that
  264.   line.  The screen displays the application's output for only a moment
  265.   before returning to the debugger's screen.  In the next step, you will
  266.   learn how to hold the Output screen open. 
  267.                                
  268.   The ">" symbol, which indicates that the program has executed to this
  269.   line, is now displayed to the left of the selected line.
  270.  
  271.  Step 4:  Look at the output of the program.  Press Ctrl-O to view TUTOR's
  272.   output. (You can also double-click on the output icon to view the output
  273.   screen.)  The Output screen shows the application's output.  After a few
  274.   seconds, the debugger screen reappears.
  275.  
  276.  
  277.  3.2  Executing with Go Commands
  278.  -------------------------------
  279.  
  280.  Go commands, found only in the Run-Time Debugger, let you step through
  281.  your program and pass over sections of code.  These commands are useful,
  282.  for example, when you want to go directly to the area of the program
  283.  that you suspect contains bugs.  In this section, you will use the Go
  284.  commands to execute TUTOR by stepping across and into a procedure call,
  285.  and then returning from the call.
  286.  
  287.  
  288.  3.2.1  Source Level Go Commands
  289.  -------------------------------
  290.  
  291.  Step 1:  Step across a procedure call.  From the global Go menu, select
  292.   Flat.  The current statement is a procedure call that TUTOR executes
  293.   until the procedure call has returned.  The Source window's selected
  294.   line advances one statement in the current module.
  295.  
  296.  Step 2:  Step into a procedure  call.  From the global Go menu, select
  297.   Statement.  Statement is similar to Flat, but if the current statement
  298.   is a call to a procedure, it stops your application at the entry of the
  299.   called procedure.  The Source window displays the source code of the
  300.   procedure.
  301.  
  302.  Step 3:  Return to the calling procedure.  From the global Go menu, select
  303.   Return.  The Source window now shows the statement where the function
  304.   returned.
  305.  
  306.   If you step into a procedure and realize it is not the procedure you
  307.   wanted to step through, select Go Return.  At that point, MultiScope
  308.   executes the rest of the procedure, but once it finishes that MultiScope
  309.   stops execution at the return address of that procedure.
  310.  
  311.  
  312.  3.2.2  Assembly Level Go Commands
  313.  ---------------------------------
  314.  
  315.  Step 1:  Restore the Assembly window.  Double-click on the Assembly
  316.   window's icon and resize the window so that its contents are visible.
  317.   (If the Assembly icon is hidden, press Ctrl-A to make it active.)
  318.  
  319.  Step 2:  Execute for one assembly instruction.  From the global Go
  320.   menu, select Assembly Trace.  Your program executes one assembly
  321.   instruction.  The Assembly and Source windows update and show the
  322.   current execution location.
  323.  
  324.  Step 3:  Execute to the next instruction.  From the global Go menu,
  325.   select Assembly Next.  The application program executes to the next
  326.   assembly instruction.
  327.  
  328.   Assembly Trace lets you step through the program's code at the assembly
  329.   level instruction by instruction.  Assembly Next works the same way, but
  330.   the debugger does not trace into procedure calls.  You could also think
  331.   of Go Trace as an assembly version of Go Statement and Go Next as an
  332.   assembly version of Go Flat.
  333.  
  334.  Step 4:  Minimize the Assembly window.  Click on the minimize icon
  335.   (the down arrow) in the upper right corner of the Assembly window.
  336.   This changes the Assembly window to an icon.  In most cases there is no
  337.   reason to have the Assembly window open if you are working at the source
  338.   level; therefore, you should minimize the Assembly window.
  339.  
  340.   Keep in mind that the Go commands are global; therefore, the Source or
  341.   Assembly windows do not have to be active to execute a Go command.  This
  342.   is helpful, for example, when you are stepping through your program and
  343.   looking at the Data window to see the values of your variables change.
  344.  
  345.  
  346. 4.  Viewing Data
  347. ----------------
  348.  
  349.  MultiScope's multiple windows provide numerous ways to view your program's
  350.  data.  In this section, you will examine data by browsing through data
  351.  structures, looking at arrays, and displaying a graphic data
  352.  representation.
  353.  
  354.  This tutorial uses C language data structures to demonstrate data browsing.
  355.  Other languages, such as Pascal and Modula-2, have similar structures, but
  356.  the syntax is different.  Therefore, this section should be easy to follow
  357.  if you are familiar with one of these languages.
  358.  
  359.  
  360.  4.1  Looking at Variables
  361.  -------------------------
  362.  
  363.  In this section, you will learn how to use the Module and the Call window
  364.  commands to display global and local data in the Data window.
  365.  
  366.  
  367.  4.1.1  Global Data
  368.  ------------------
  369.  
  370.  MultiScope's Module window displays a list of the modules included in
  371.  your program. The Module window's local commands let you display the
  372.  module's source or data or both.
  373.  
  374.  Step 1:  View the module list.  Press Ctrl-M to make the Module window
  375.   active.  The Module window displays a list of the modules in TUTOR.EXE.
  376.   TUTOR is the selected module because the highlighter bar is on that
  377.   item.
  378.  
  379.  Step 2:  Select another module.  Double-click on the module's name to
  380.   select another module.  Double-click on LLRAS.  When you double-click
  381.   on a module name, the Source and Data windows update and show the source
  382.   code and global data for that module.
  383.  
  384.  Step 3:  Look at the global data in LLRAS.  Press Ctrl-D to make the Data
  385.   window active.  Resize the Data window so that its contents are visible.
  386.   The Data window now displays two variables, "llras" and "numList".  The
  387.   current values and types of the variables are displayed.
  388.  
  389.  
  390.  4.1.2  Local Data
  391.  -----------------
  392.  
  393.  The call chain is the list of procedure calls that have been made in the
  394.  current thread. The Call window displays the call chain and allows you to
  395.  view the local data of procedure calls.
  396.  
  397.  Step 1:  Restore the Call window.  Double-click on the Call window icon.
  398.   (If the icon is hidden,  press Ctrl-C to make it active.)
  399.  
  400.   The Call window shows that so far in the execution of the application
  401.   program, the application's process (in the current thread) has called
  402.   the procedure "main" of the module TUTOR.
  403.  
  404.  Step 2:  View the local data of a procedure in the call chain.  Double-
  405.   click on "main" in the Call window.  The Source and Data windows update
  406.   and show the text, local variables, and parameters of the procedure
  407.   main.
  408.  
  409.   In the Data window, the names of all the variables declared in the
  410.   procedure "main" are on the left.  Their values are displayed in the
  411.   center, and their types are displayed on the right.
  412.  
  413.  Step 3:  Activate the Data window.  Press Ctrl-D to make the Data window
  414.   active.
  415.  
  416.  
  417.  4.2  Looking at Data Structures
  418.  -------------------------------
  419.  
  420.  You can browse through your program's data structures by using several
  421.  commands in the Data window.  You can follow pointers to examine child
  422.  structures, look at fields in records, view arrays, and display a graphic
  423.  representation of complex data structures.
  424.  
  425.  Step 1:  Select a module.  Let's take a closer look at the variable "llras"
  426.   that you saw in the global data of the module LLRAS.  Double-click on the
  427.   module name LLRAS to update both the Data and the Source window.
  428.  
  429.  Step 2:  Activate the Data window.  Press Ctrl-D to make the Data window
  430.   active.  Notice that the variable "llras" is selected.
  431.  
  432.  Step 3:  Step into the data structure.  From the local View menu, select
  433.   Child/Contents.  The Data window displays the fields in the record to
  434.   which llras points.  The Data window's header shows the current path
  435.   of the data display.
  436.  
  437.  Step 4:  Execute the Child/Contents command.  Double-click on the field
  438.   "next" to execute the Child/Contents command.  The Data window updates
  439.   and displays the fields of the next structure in the list.
  440.  
  441.  Step 5:  Execute the Parent command.  Double-click the right mouse button
  442.   in the Data window to execute the Parent command.  The Data window updates
  443.   and displays the parent record.
  444.  
  445.  Step 6:  Return to the top variable.  From the local View menu, select
  446.   Variable Level to return to the top variable of the data.  The Data window
  447.   updates and shows the original global variables of the LLRAS module.
  448.  
  449.  
  450.  4.3  Looking at Arrays
  451.  ----------------------
  452.  
  453.  You can use the Child/Contents and other commands, such as Right (next
  454.  element) or Left (prev. element), to display the contents of an array.
  455.  
  456.  Step 1:  Look at the global data of another module.  Double-click on TUTOR
  457.   in the Module window.  The Source and Data windows update to show TUTOR's
  458.   source text and global data.
  459.  
  460.  Step 2:  Activate the Data window.  Press Ctrl-D to make the Data window
  461.   active.
  462.  
  463.  Step 3:  View the array elements.  Double-click on "array" to execute the
  464.   Child/Contents command and display the contents of the array.  The Data
  465.   window shows the index numbers on the left and the element values on
  466.   the right.  "array" is an array of records, so you must open a record to
  467.   examine its fields.
  468.  
  469.  Step 4:  View the fields of the record.  Double-click on array element 1.
  470.   The Data window shows the fields of element 1's record.
  471.  
  472.  Step 5:  View more of the array elements.  From the local View menu, select
  473.   Right (next element).  The Data window shows the data in the next element
  474.   in the array.
  475.  
  476.  Step 6:  Decrement the index.  From the local View menu, select Left
  477.  (prev. element) to decrement the index and return to the previous index.
  478.  The Right and Left commands are shortcuts for examining the contents of
  479.  arrays to avoid going one level up, selecting another index, and then
  480.  displaying the Child/Contents of that index.
  481.  
  482.  Step 7:  Select a specific index.  From the local View menu, select
  483.   Specific Index.  MultiScope prompts you for a new value.
  484.  
  485.  Step 8:  Enter a new value.  Type 5 and press Enter.  The Data window
  486.  updates and shows the fields of the fifth element in the array.
  487.  
  488.  Step 9:  Return to the variable declaration level.  From the local View
  489.   menu, select Variable Level.  The Data window updates and displays the
  490.   original list of global variables.
  491.  
  492.  
  493.  4.4 Looking at a Graphic Data Representation
  494.  --------------------------------------------
  495.  
  496.  Graphic data representation, just one of Multiscope's unique features,
  497.  allows you to display complex data structures as a graph in a Presentation
  498.  Manager window.  In the past you had to draw a graph of the data structure
  499.  manually.  You no longer have to draw these graphs because MultiScope
  500.  prepares a graph of a selected data structure for you.
  501.  
  502.  Step 1:  Select a module.  Double-click on the module name LLRAS to update
  503.   both the Data and the Source window.
  504.  
  505.  Step 1:  Configure your screen.  Double-click on the Graphic Data icon to
  506.   restore it.  (If the icon is hidden, press Ctrl-G to make it active.)
  507.   Position both windows on the screen so that the Data window and the
  508.   Graphic Data window are visible.
  509.  
  510.  Step 2:  Activate the Data window.  Press Ctrl-D to make the Data window
  511.   active.
  512.  
  513.  Step 3:  Select a variable.  Select the variable "llras" by clicking on
  514.  
  515.     llras       0227:0FAEh  * ListOfList
  516.  
  517.  Step 4:  Display graphic representation.  From the local View menu, select
  518.   Graphic Data Structure.  It takes a moment for MultiScope to lay out and
  519.   draw the graph; the hourglass icon appears during this process.  When the
  520.   graphic data structure appears, click on the maximize arrow in the Graphic
  521.   Data window.  The graphic representation of the variable is displayed in
  522.   the Graphic window.
  523.  
  524.   The variable "llras" is the top left node pointing to the first record
  525.   of type ListOfList.  The "next" field in each record points to the next
  526.   record of the same type (list of ListOfList).  The field "list" points
  527.   down to another type of record (list of List).
  528.  
  529.  Step 4:  Zoom in on the graph.  Double-click the left mouse button inside
  530.   a box in the Graphic Data window to zoom in on the area.  Zoom in until
  531.   the structure is large enough for you to see the graph node comments
  532.   inside each box.
  533.  
  534.  Step 5:  Zoom out.  From the local Zoom menu, select Zoom Out. The graph
  535.   shrinks and shows more of the graph, but the detail inside the boxes may
  536.   disappear.  You can also zoom out on an area by double-clicking the right
  537.   mouse button inside a box in the Graphic Data window.
  538.  
  539.  Step 6:  Reset to initial position.  From the local Zoom menu, select Zoom
  540.   Reset.  The Graphic Data window displays the original graph.
  541.  
  542.  Step 7:  Restore the Graph window to an icon.  Click on the minimize icon
  543.   to restore the window.
  544.  
  545.  
  546.  4.5  Looking at Memory Locations
  547.  --------------------------------
  548.  
  549.  In this section, you will learn to use the Memory window to view the
  550.  contents of memory in various formats.  Later in the tutorial, you will
  551.  learn how to change the value of a memory location.
  552.  
  553.  Step 1:  Restore the Memory window.  Double-click on the Memory window
  554.   icon to restore it.  (If the icon is hidden, press Ctrl-E to make it
  555.   active.)  Resize it so that the contents are visible.
  556.  
  557.  Step 2:  Activate the Data window.  Press Ctrl-D to make the Data window
  558.   active.
  559.  
  560.  Step 3:  Select a variable.  Select the variable "numList" in the Data
  561.   window by clicking on the variable.  Notice that it is an integer with
  562.   a value of 4.
  563.  
  564.  Step 4:  View the address of the selected variable.  From the local Others
  565.   menu, select Data Address.  A message box displays the variable's address.
  566.   Press Enter to clear the box.
  567.  
  568.   The Memory window updates and displays the memory locations around the
  569.   address, formatted as two-byte hexadecimal numbers.
  570.  
  571.  Step 5:  Make the Memory window active.  Press Ctrl-E.  Notice that the
  572.   selected location indicates the memory location of the variable "numList".
  573.  
  574.  Step 6:  Change the display format.  From the local View menu, select
  575.   Integer.  The Memory window updates and displays memory in the Integer
  576.   format.  Notice the integer value 4.
  577.  
  578.  
  579. 5.  Modifying Data
  580. ------------------
  581.  
  582.  This section explains how to modify a variable or a memory location in
  583.  your program.  You will modify the value of the variable first with a
  584.  constant, and then with an expression.
  585.  
  586.  
  587.  5.1  Modifying a Variable
  588.  -------------------------
  589.  
  590.  Step 1:  Make the Data window active.  Press Ctrl-D.
  591.  
  592.  Step 2:  Select a variable to modify.  Select the variable "numList" by
  593.   clicking on it.
  594.  
  595.  Step 3:  Change the value of the variable.  From the local Others menu,
  596.   select Modify Value.  MultiScope prompts you to enter an expression for
  597.   the new value.
  598.  
  599.  Step 4:  Enter a new value.  Type
  600.  
  601.     123
  602.  
  603.   and press Enter.  The dialog box disappears, and the variable is updated
  604.   with the new value.
  605.  
  606.  Step 5:  Replace the value of the variable with an expression.  Press
  607.   Alt-M to open an Expression box.  Type the expression
  608.  
  609.     TUTOR.count * 3
  610.  
  611.  The value of "numList" is now 6, as shown in the Data window.
  612.  
  613.  
  614.  5.2  Modifying Memory
  615.  ---------------------
  616.  
  617.  Step 1:  Select the Memory window.  Press Ctrl-E to select the memory
  618.   window without changing the current selection.  (The current selection
  619.   is the memory location of the variable "numList".)
  620.  
  621.  Step 2:  Modify memory.  Press Alt-M for Modify.  Enter an expression
  622.   for the new value.  Type
  623.  
  624.     TUTOR.count
  625.  
  626.   The selected memory location is updated and displays the value you
  627.   entered - the value of the variable "count" in the TUTOR module
  628.   (which is 2).
  629.  
  630.  Step 3:  Minimize the Memory window.  Click on the minimize icon.
  631.  
  632.  
  633. 6.  Setting Breakpoints
  634. -----------------------
  635.  
  636.  Breakpoints are set in your program's source code where you want the
  637.  program's execution to stop.  You can then examine the variables and
  638.  data structures in your program.
  639.  
  640.  Before you set a breakpoint, you must decide three things:  its location
  641.  in the program, the circumstances that trigger it, and the result of
  642.  triggering it.
  643.  
  644.  You may also assign a condition to a breakpoint on an expression, which
  645.  is called a conditional breakpoint.  In this section, you will learn how
  646.  to set both an unconditional and a conditional breakpoint.
  647.  
  648.  A breakpoint is either triggered always when an expression is true or
  649.  when a pass count reaches its limit.  When a breakpoint is triggered,
  650.  the execution of the program stops at that point.
  651.  
  652.  Breakpoints may be set in either the Source window or the Assembly
  653.  window.  A breakpoint that is set so that it is always triggered when
  654.  it is reached is called an unconditional breakpoint.
  655.  
  656.  Step 1:  Select the main module.  Double-click on the TUTOR entry
  657.   in the module window to select the TUTOR module.
  658.  
  659.  Step 2:  Make the Source window active.  Press Ctrl-S.  The Source
  660.   window displays the source code of the module TUTOR.  (Notice the
  661.   header of the Source window.)
  662.  
  663.  Step 3: Search for a procedure. From the local Find menu, select Find
  664.   Procedure.  MultiScope prompts you for the name of the procedure.
  665.   Type
  666.  
  667.     BreakMe
  668.  
  669.   The Source window updates and displays the source code at the location
  670.   of the procedure "BreakMe".
  671.  
  672.  Step 4:  Select another line.  Click on
  673.  
  674.     ++count;
  675.  
  676.  Step 5:  Set a breakpoint.  From the local Bpt menu, select Set
  677.   Breakpoint.  An expression dialog box is displayed.  Press Enter to
  678.   set an unconditional breakpoint.  An asterisk (*) appears to the left
  679.   of the selected line to indicate the presence of a breakpoint.
  680.  
  681.  Step 6:  Execute the program to the set breakpoint.  From the global
  682.   Go menu, select Breakpoint.  The program executes to the breakpoint.
  683.   When the execution stops, the asterisk (*) is replaced by a number
  684.   sign (#) indicating that the program stopped executing at the
  685.   breakpoint.
  686.  
  687.  Step 7:  Clear the breakpoint.  From the local Bpt menu, select Clear
  688.   Breakpoint to clear the breakpoint from the selected line.
  689.  
  690.  Step 8:  Set a conditional breakpoint at the same line.  From the local
  691.   Bpt menu, select Set Breakpoint.  In the expression dialog box, type
  692.  
  693.     count > 5
  694.  
  695.  The expression "count > 5" is the breakpoint condition that stops the
  696.  execution of the program when the value of the variable "count" becomes
  697.  greater than 5.
  698.  
  699.  Step 9:  Execute the program until the breakpoint's condition becomes
  700.   true.  From the global Go menu select Breakpoint.  The * becomes a #,
  701.   indicating that the program stopped at the breakpoint.
  702.  
  703.   With a conditional breakpoint, the program stops only if the breakpoint
  704.   is passed while the expression is true.  Here the program executes until
  705.   the value of "count" is greater than 5.
  706.  
  707.  Step 10:  Check the breakpoint's condition.  Press Ctrl-D to make the Data
  708.   window active.  Notice that the value of the variable "count" is greater
  709.   than 5.
  710.  
  711.  Step 11:  Check the breakpoint's status.  Double-click on the Breakpoint
  712.   icon to restore the window.  (If the icon is hidden, press Ctrl-B to
  713.   make it active.)  Then resize it so that the contents are visible.  The
  714.   Breakpoint window contains the list of all the breakpoints currently
  715.   defined in your program.
  716.  
  717.   The breakpoint information is displays the module name, procedure name
  718.   line number, address, limit, count, and expression of each breakpoint
  719.   set in the program.
  720.  
  721.  Step 12:  Kill all breakpoints.  From the local Commands menu, select
  722.   Kill All Breakpoints.  All the breakpoints are cleared from the program.
  723.  
  724.  Step 13:  Minimize the Breakpoint window.  Click on the minimize icon
  725.   in the Breakpoint window.
  726.  
  727.  
  728. 7.  Looking at Threads
  729. ----------------------
  730.  
  731.  An OS/2 thread is a task that has its own stack and registers but
  732.  shares its address space with other threads in a process.  The Thread
  733.  window lists all of the threads in a process.  You can use the Thread
  734.  window to examine a thread's status, registers, call chain, data, and
  735.  current execution location.
  736.  
  737.  Step 1:  Restore the Thread window.  Double-click on the Thread window's
  738.   icon.  (If the icon is hidden, press Ctrl-T to make it active.)  Resize
  739.   it so that its contents are visible.
  740.  
  741.   The Thread window indicates that there are currently two threads running
  742.   in the program.  Both are thawed and runnable.
  743.  
  744.  Step 2:  Restore the Register window.  Double-click on the Register
  745.   window's icon to restore it.  (If the icon is hidden, press Ctrl-R
  746.   to make it active.)  Then resize it so that the contents are visible.
  747.  
  748.  Step 3:  Set the screen.  Arrange the screen so that the Call, Thread,
  749.   Register, Data, and Source windows are visible.
  750.  
  751.  Step 4:  Select a thread and update the Source, Data, Call, Register,
  752.   and Assembly windows.  Double-click on thread number 2 in the Thread
  753.   window.  The Source, Call, Data, and Register windows update and show
  754.   the state of the execution thread.
  755.  
  756.  Step 5:  Determine what thread 1 was executing.  It is possible to update
  757.   a window for another thread without updating all the other windows. For
  758.   example, to display the source code where thread 1 executed, select
  759.   thread 1 in the Thread window.  Press Alt-S.  The Source window updates
  760.   and shows where thread 1 stopped executing.
  761.  
  762.  Step 6:  Minimize the Thread, Register, Data and Call windows.  Click on
  763.   the minimize arrow in the Thread, Register, and Call windows.
  764.  
  765.  
  766. 8.  Executing Your Program to the End
  767. -------------------------------------
  768.  
  769.  In the final step of the Run-Time Debugger tutorial, you will execute
  770.  TUTOR.EXE to the end, look at its output, and exit the debugger.
  771.  
  772.  Step 1:  Execute the program to the end.  From the global Go menu, select
  773.   End Program.  TUTOR executes until it terminates.  A message box is
  774.   displayed indicating that the program ended.  Press Enter to clear the
  775.   message.
  776.  
  777.  Step 2:  Look at your program's output.  Press Ctrl-O to display the
  778.   Output screen.
  779.  
  780.  Step 3:  Exit from the debugger.   From the global Program menu, select
  781.   Exit.  MultiScope exits and returns control to OS/2.
  782.  
  783.  
  784.  
  785. Get the Most from MultiScope
  786. ============================
  787.  
  788.  Logitech's MultiScope Debugger offers you the most advanced features
  789.  available in any debugging tool.  This sophisticated program is a
  790.  significant step forward in debugger technology that will make your
  791.  debugging chores much easier. MultiScope is the only debugger
  792.  designed to take full advantage of all the extra functionality of the
  793.  high-powered OS/2 operating environment.
  794.  
  795.  Use MultiScope to debug the most commonly used OS/2 languages.  Because
  796.  it is so well integrated with OS/2, MultiScope lets you debug even the
  797.  most complex programs quickly and effortlessly.  We've built in both
  798.  run-time and post-mortem debugging options to handle any debugging
  799.  situation: you can examine your program both during and after a run-time
  800.  exception.  You have never before used a tool that provides such a clear
  801.  vision of your program's inner workings.
  802.  
  803.  MultiScope uses either a Presentation Manager or an OS/2 text mode
  804.  user interface to provide you with the perfect interface for your
  805.  requirements.   Both execution modes are compatible with the Common
  806.  User Access of the IBM Systems Application Architecture for maximum
  807.  ease or learning and use.
  808.  
  809.  Logitech has created the debugger that finally has the muscle and
  810.  functionality to really get the job done.
  811.  
  812. * Debug Multiple Languages:
  813.  
  814.   o IBM C/2
  815.   o IBM Pascal/2
  816.   o IBM Macro Assembler/2
  817.   o Microsoft C
  818.   o Microsoft Pascal
  819.   o Microsoft Assembler
  820.   o Logitech Modula OS/2
  821.  
  822. * Two Debugging Options:
  823.  
  824.   o Runtime
  825.      MultiScope allows you to monitor the execution of a program
  826.      with conditional or unconditional breakpoints, and memory or
  827.      symbolic watchdogs.  While you are stepping in your program
  828.      execution, MultiScope allows you to modify memory or data
  829.      contents, suspend or resume thread execution.
  830.  
  831.   o Post-Mortem
  832.      This debugging mode gives all the MultiScope debugging power
  833.      for examining a program after the occurrence of an OS/2
  834.      protection trap, stack overflow or other run-time exception.
  835.  
  836. * Graphical Representation:
  837.   Only the Logitech MultiScope Debugger permits the graphical
  838.   representation of your program's data structures.  This feature,
  839.   which operates under Presentation Manager, allows you to explore
  840.   your dynamically allocated data structures and their internal
  841.   relationships.
  842.  
  843. * Maximum Performance In Two Modes:
  844.  
  845.   o Presentation Manager Mode
  846.      MultiScope takes full advantage of Presentation Manager's
  847.      graphics, multiple fonts, overlapping windows and standard
  848.      user interface.
  849.  
  850.   o OS/2 Text Mode
  851.      MultiScope offers a text mode user interface with a very
  852.      easy-to-use windowing system for the EGA and VGA graphic
  853.      adaptors.  This execution mode is the perfect solution for
  854.      debugging Presentation Manager applications.
  855.  
  856.   Pull down menus that respond to single-key commands make your
  857.   debugging faster and easier.  Create your own custom configuration
  858.   of these windows to see exactly what you need.  Reduced currently
  859.   unused windows to icons for easy recall.
  860.  
  861.  
  862. * MultiScope gives you 13 different views into your program:
  863.  
  864.   o Source View
  865.      Look at source code, set breakpoints, find symbols
  866.  
  867.   o Data View
  868.      Display and modify local and global symbolic data,
  869.      records, arrays, and set watchpoints
  870.  
  871.   o Graphic View
  872.      In Presentation Manager mode, see a graphic representation
  873.      of any selected data structure
  874.  
  875.   o Assembly View
  876.      See the assembly decode of the program, complete with the
  877.      display of corresponding source lines and local and global
  878.      data
  879.  
  880.   o Thread View
  881.      Observe threads belonging to your application, and suspend
  882.      threads, resume threads, update views according to new threads
  883.  
  884.   o Breakpoint View
  885.      Display the current breakpoint locations, count and limit
  886.  
  887.   o Watch View
  888.      Display the current watch variables or memory location
  889.  
  890.   o Register View
  891.      Display and modify the current value of the CPU registers
  892.  
  893.   o Output View
  894.      Examine the application screen
  895.  
  896.   o Module View
  897.      Choose between different data object modules of the
  898.      application and view the corresponding source or data
  899.  
  900.   o Call View
  901.      Display the source position, local data and parameters of a
  902.      particular call
  903.  
  904.   o Memory View
  905.      Display raw memory in various formats: byte, char, text,
  906.      unsigned word, signed word, address, double word, real, etc;
  907.      modify memory contents; set watchpoints
  908.  
  909.   o Log View
  910.      Log debugger events
  911.  
  912.  
  913. * MultiScope allows you to execute your program until:
  914.  
  915.   o the next conditional breakpoint is true
  916.   o the next high level instruction
  917.   o the next line
  918.   o the next assembly instruction
  919.   o the return from the current procedure
  920.   o the next call from a current procedure
  921.   o the next child process load
  922.   o an OS/2 protection violation or other runtime exception
  923.  
  924. * Evaluate Expressions
  925.   MultiScope allows you to evaluate C, Pascal and Modula-2
  926.   expressions using symbols defined in your program.
  927.  
  928. * Function Calls
  929.   MultiScope is the only OS/2 debugger which can execute calls to your
  930.   own code during the debugging session.  Use your own procedures to
  931.   print out data structures, or experiment with calls with different
  932.   parameter values.
  933.  
  934. * Child Process Debugging
  935.   When your program executes another program, MultiScope allows you to
  936.   continue debugging the old process.
  937.  
  938. * Dynamic Link Libraries
  939.   The full power of MultiScope is available for debugging your dynamic
  940.   link libraries.
  941.  
  942. * Remote and Dual Monitor Debugging:
  943.  
  944.   o Remote:
  945.      MultiScope allows you to debug a program executing on another
  946.      computer through a serial line.  This feature allows your
  947.      application to keep all the resources of the computer for its
  948.      execution.
  949.  
  950.   o Dual Monitor:
  951.      MultiScope allows you to use a second monochrome monitor for
  952.      the display of debugger views while your program is executing.
  953.  
  954. * System Requirements
  955.  
  956.   o IBM XT/286, AT, PS/2 model 50, 60, 70, 80 or 100% compatibles
  957.   o OS/2 Standard Edition 1.1 or Extended Edition 1.1
  958.   o One high density diskette drive and hard disk
  959.  
  960.  
  961. For More Information on MultiScope
  962. ==================================
  963.  
  964. For more information on MultiScope, please contact:
  965.  
  966.         Logitech, Inc.
  967.         Attn: Susanne Gahnstedt
  968.         6505 Kaiser Drive
  969.         Fremont, CA 94555
  970.  
  971.         Tel: (800) 231-7717
  972.  
  973.         Fax: (415) 792-8901
  974.  
  975.  
  976. ----------------------------------------------------------------------
  977.  
  978. Copyright (C) 1989 Logitech, Inc.  All rights reserved.
  979. Logitech and MultiScope are trademarks of Logitech, Inc.
  980. All other trademarks are the property of their respective owners.
  981.  
  982.