The Wang Symbolic DebuggerPart Two of a series |
|
From "VS Workshop", Access to Wang, July 1993 |
|
[ Prior Article ] [ Return to the Catalog of articles ] [ Next Article ] |
Since last month's column, I have heard some comments from programmers about the Debugger that illustrated some of the problems VS users have in using it. The Debugger uses a combined key and command mode of operation, and many VS users are confused by that. Actions may be performed one of several ways: through a PF key (if defined); by entering the command at the prompt; and by writing a macro that may combine one or both of these approaches. The choices offered here are not unusual in the PC world - just look at how many ways there are to perform the same task in Microsoft Windows - but there are few other examples in the VS world.
Differences aside, there are many powerful features that warrant your attention. Here are a few more.
One of the most unusual aspects of the Debugger is the manner in which search strings are selected and found. Unlike the operation of most other Wang utilities, the Debugger uses a two-step process to search for text: first, the text string must be defined using the FIND and MATCH commands, then the search must be launched using SEARCH, SEARCH BACKWARD, or LOCATE. This approach is awkward in comparison to the method used by DISPLAY and EDITOR - a single motion of choosing the search function and entering the text to be found. There are important differences between the Debugger's selection and search options that reveal some of the reasons for this difference in operation.
Of the two methods of selection, the FIND, SEARCH FORWARD, and SEARCH BACKWARD operations are most like other Wang programs. FIND accepts text as it is typed, with all text characters considered. For example, entering FIND ' CALL "STRING' will search for calls to the STRING subroutine that appear exactly as typed. As with other utilities, SEARCH FORWARD will look from the current cursor position down, SEARCH BACKWARD will scan upwards, and CASE specifies whether the search will be case-sensitive. Once the search direction is selected, only the SEARCH command is necessary to continue in that direction.
The MATCH command extends the power of a search by providing additional criteria. It uses a syntax of pattern matching known as regular expressions, common in the Unix and C programming world, that allows powerful search capabilities. The command MATCH ON enables these features, while MATCH OFF (the default) disables them. In either case, the FIND command is still used to specify the search string. (The choice between MATCH modes must be deliberately made, because the meaning of search string characters will change.)
In the search example above, the FIND selection will not locate the following text:
CALL "STRING" USING STRING-FUNCTIONbecause it has three space characters between the CALL and "STRING text elements instead of one. A revised selection using MATCH ON could be used to correct this situation:
MATCH ON FIND ' CALL +"STRING' SEARCH FORWARDThe plus sign in the selection string indicates that the space character may be repeated one or more times. Note that under this definition it must be present at least once; the asterisk could be used to signify a repeat of zero or more times.
A complete discussion of regular expressions is beyond the scope of this article, but here is a condensed summary of their use:
Character Usage + (plus sign) Represents one or more instances of the preceding character. * (asterisk) Represents zero or more instances of the preceding character. (Note difference with Wang and MS-DOS wild card conventions. . (period) Represents a single unknown character. [] (brackets) Contain a group or range that a character can be present in. A carat symbol (^) indicates that the character is not present in the group or range. ? (question mark) The prior expression can appear zero or once. (Note difference with Wang and MS-DOS wild card conventions. $ (dollar sign) Indicates the search expression must be at the end of a line. / (forward slash) Allows literal interpretation of a character otherwise considered a special character. For example, /$ signifies that the dollar sign is part of the text to be searched - not at the end of the line. More information on the Debugger's search capabilities is available in the VS Program Development Tools Reference (Publication 715-0384). Further information on regular expressions can be found in books on Unix, C, or the AWK programming language.
Traps provide an alternative to single steps through the program during execution. By setting traps at relevant portions of the program and checking values, it is possible to review the operation of a program without the time required to wade through single program steps.
Perhaps the most frequently-used program trap is the break trap, which always stops the program at a given point. Break traps are most useful when you wish to review results after a specific code section has been executed. The BREAK command can be used by positioning the cursor to the line to be stopped prior to executing the command, or by entering the statement number after the command (example: BREAK 551). Note that the numbers are those that appear on the compiler listing and are not related to the line numbers of the original program.
The INSIDE and OUTSIDE traps work with marked areas of the program, stopping execution whenever inside or outside the marked section. As with the BREAK trap, statement numbers may also be used (example: INSIDE 401 479). Another method is to mark specific sections and execute INSIDE or OUTSIDE without any other arguments.
The MODTRAP trap is one of the most useful of the traps. It allows you to review the contents of a register, address, or variable and stop execution whenever those contents change. The most practical use of this feature is in monitoring the behavior of variables, particularly those variables used as flags for state changes. For example, suppose you had the a variable that indicated whether a condition was met; the statement MODTRAP VARIABLE REC-FOUND-FLAG would stop program execution each time that a record was found and the variable changed.
The Debugger allows new commands to be defined as macros, functionally extended the command set. A macro consists of a single label and the commands that would be typed at the prompt. For example, a macro named STARTDSB could be defined to set up the screen like this:
DEFINE STARTDSB CURSOR DOWN 5; WINDOW 2As you can see, multiple commands may be entered when separated by a semicolon. The label name should not be the name of a standard function; a macro defined with such a name removes that function from use. Macros can be removed by defining another with the same name, like this:
DEFINE STARTDSB STARTDSBMacros can also be built into the standard DEBSTART (Debugger start) file or in private start files for your own use.
With its powerful search and trap facilities and integrated development tools, the Wang programming environment remains a comfortable workbench for the application programmer. Many of the features in the Wang Debugger are present in other COBOL environments, but rarely with the degree of integration found on the VS. Hopefully, this environment will be retained as Wang development moves to other environments.
I mentioned last time some that our shop had changed the standard DEBSTART file so that the PF keys were closer to Wang conventions. The modified table is shown in Figure 1, below. Naturally, other functions could be assigned to any of the keys according to your wishes.
The April column on Winloc 3.1 stirred some interest among readers in problems configuring and using Wang's Windows-based terminal emulation products - particularly in combination with other products, including Wang's PCLIS, Macsoft's Lightspeed MVS products, and most any network software. Configuring Wang terminal cards and the Winloc software is not trivial; there are many situations where software and hardware conflicts can corrupt a network session or cause the PC to lock up, and seemingly harmless user behavior can precipitate a problem. I offer the following suggestions for setting up a Wang Local Office Connection (WLOC) card and software:
Before attempting to set up a WLOC card or software, carefully review any information you have on memory and hardware interrupt usage for products you currently use. Compare this with the strap settings available for the WLOC card. Check this information with a utility that shows the actual interrupts used, such as MANIFEST (part of Quarterdeck's Expanded Memory Manager product (QEMM)) or Microsoft's MSD (bundled with Windows 3.1 or available from the Microsoft Download Service bulletin board (206-637-9009)).
When setting up a WLOC card, start with the simplest configuration possible. Temporarily remark out any TSR (Terminate and Stay Resident) software from your AUTOEXEC.BAT and CONFIG.SYS files, and run the MS-DOS version of the terminal software if you have it. Add more items gradually until you reach a full configuration (or bomb out).
Try to use the default WLOC board settings whenever possible. If you need to change the address of the board, change the I/O address first. Ignore the instructions that tell you to set the board for IRQ 5 or 7 for use with Windows.
There were three generations of WLOC cards manufactured and each seems to work differently with certain PCs and applications. If you have the opportunity to exchange cards, see if that helps resolve any problems. If you are purchasing used cards from an equipment vendor, make compatibility with your applications a condition of product acceptance.
If you have trouble getting enough conventional memory after setting up a WLOC card and are using a 386-class PC or better, consider using an expanded memory manager like QEMM (mentioned above) or Microsoft's MemMaker and EMM386. (MemMaker is a art of MS-DOS 6.0; EMM386 is shipped with Windows.)
EMM386 has been known to conflict with Winloc, particularly on 386 machines with math coprocessors.
If nothing else works, be prepared to produce a volume of information on your PC's configuration for the technical analysts - right down to the video and ROM-BIOS manufacturer, version, and date. Microsoft's MSD works well for this purpose.
(Thanks to my co-worker David Unruh for technical information on PC setups with Wang products.)
Do you have any other suggestions on configuring WLOC boards or related software? If so, forward them to me and I will pass them along.
Figure 1: Revised Version of DEBSTART
* * PF keys revised to match Wang key conventions better * and set up LISTING and DATA windows * assign 1 Variable assign 2 First assign 3 Last assign 4 Previous assign 5 Next assign 6 Previous 1 assign 7 Next 1 assign 8 Find assign 9 Search assign 10 Step 1 assign 11 Break assign 12 Delete assign 13 Help assign 14 Continue assign 15 Deactivate assign 16 Cancel assign 17 Clear assign 18 Data assign 19 Listing assign 20 Traps assign 21 State assign 22 Hex assign 23 Substring assign 24 Alter assign 25 Search Backward assign 26 Step Into 1 assign 27 Step Instruction 1 assign 28 Stacktrace assign 29 Training assign 30 Continue Trace assign 31 Activate assign 32 Close * * Set up window locations and types * Open with a LISTING window of five lines, with * the remaining area used for a DATA window. * Attributes are turned OFF for more data area. * w 3 attributes off cursor down 5 w 2
Copyright © 1993 Dennis S. Barnes
Reprints of this article are permitted without notification
if the source of the information is clearly identified