Chapter Contents

Previous

Next
Debugger PROFILEs, Configuration Files, and EXECs

Setting Up a Debugger PROFILE

The debugger PROFILE is a debugger feature that enables you to create an EXEC or a CLIST that contains a set of debugger commands. This PROFILE executes at initial entry to the program that is being run under the debugger. If you usually issue a certain set of commands when you first begin to debug a program, then using a debugger PROFILE saves time.

Note:    You cannot use a PROFILE with debugger sessions in OS/390 batch.  [cautionend]

A PROFILE can contain any of the debugger commands in the following list (in addition to standard CLIST or EXEC commands that you need):

abort install
auto
on
break
query
config file
set
define
system
disable
trace
drop
undef
enable
window off
exec
% (TSO only)
help
user-installed commands
ignore

Note:    The config file command is used to specify your configuration file as described in Setting Up a Configuration File. Additional details about using the exec command in a PROFILE are provided in Executing EXECs or CLISTs from the Debugger.  [cautionend]

When you start your program under the debugger (by specifying '=d'), your PROFILE executes automatically. Next, the debugger passes control to the terminal on entry to main (or, if the indep option is used, to the first function that is called in your program) and sends the Cdebug: prompt.

When your PROFILE executes, no function is active (including main). For this reason, commands such as list and continue, which require a function to be active, do not work in a PROFILE. Similarly, the assign, copy, and dump commands, which require a variable or object to be visible, do not work because none have been defined on entry to the debugger. If the PROFILE contains a user-installed command or an exec (or %) command, the same commands can be used in the called EXEC or CLIST as in the PROFILE itself.


Setting Up a PROFILE under CMS

Write an EXEC named PROFILE CDEBUG that contains all the debugger commands to issue when the debugger starts to run. You pass the filename of the program as the only parameter.

PROFILE CDEBUG can be written in REXX or EXEC2. Debugger PROFILE CDEBUG (CMS) illustrates a debugger PROFILE CDEBUG under CMS.


Debugger PROFILE CDEBUG (CMS)
/* Sample DEBUGGER PROFILE CDEBUG */ /* */ config file myconfig
[1] arg filename say '****** Start of Debugger PROFILE' [2] say 'Running file' filename if filename = 'WORDCOUN' then do [3] 'exec wordcoun' else do [4] 'on main return break' 'exec gencmds' end 'break main *' [5] 'query' [6] say '******' rc 'actions active' [7] say '****** End of Debugger PROFILE' exit

The numbers in the previous example correspond to the following items:

  1. The configuration file named MYCONFIG is specified.

  2. Two SAY statements output a banner and the source filename.

  3. The EXEC checks that the filename is WORDCOUN. If it is, the debugger command exec wordcoun is executed. WORDCOUN is the name of an EXEC that contains CMS commands.

  4. If the filename is not WORDCOUN, the debugger performs an on command to break on return to main; then, the debugger performs another exec command by using the CMS EXEC GENCMDS.

  5. A breakpoint is requested at every hook in main.

  6. The query command is issued.

  7. The REXX rc variable displays the number of debugger actions in effect as returned by query.


Setting Up a PROFILE under TSO

To set up a PROFILE under TSO, do the following:

  1. Write a CLIST or REXX EXEC that contains the debugger commands in the order that you want to issue them. If you are using a REXX EXEC, the following address command must be issued from the EXEC before any debugger commands are issued:
    address 'CDEBUG'

  2. Put the PROFILE in a sequential data set that is named
    first_level_qualifier.CDEBUG.CLIST

    If your TSO profile specifies NOPREFIX, then your userid is used as the first_level_qualifier; otherwise, if a PREFIX is specified, that prefix is used as the first_level_qualifier.

    If you want to put your PROFILE in another data set, you can also use the DDname DBGPROF to specify a PROFILE. If DBGPROF is allocated to the CLIST or EXEC, the debugger uses DBGPROF to find the PROFILE.

    The PROFILE is any valid CLIST data set (as described by IBM publication OS/390 TSO/E CLISTs, SC28-1973-02). Not the following two general restrictions for a CLIST that is used in your PROFILE:

    The first line of the CLIST should be the following:

    PROC 1 pgmname

    where you subsitute the program name for pgmname. This variable is determined by the following guidelines:

The following example is a debugger PROFILE for TSO.


Debugger PROFILE CLIST (TSO)
PROC 1 PGMNAME /* Example DEBUGGER PROFILE CLIST (TSO) */ /*---------------------------------------------------------*/ CONTROL NOCAPS
[1] CONFIG FILE 'USERID.MY.CONFIGS(CONFIG1)' [2] WRITE ****** START OF DEBUGGER PROFILE ****** [3] WRITE running program &PGMNAME IF &PGMNAME NE UNKNOWN THEN DO [4] IF &PGMNAME = WRDCNT THEN DO [5] %wrdcnt END ELSE IF &PGMNAME = LINCNT THEN DO [6] %lincnt END ELSE DO [7] on main return break %gencmds END break main * ' [8] query [9] WRITE ****** &LASTCC actions active [10] END WRITE ****** END OF DEBUGGER PROFILE ******

The numbers in the previous example correspond to the following items:

  1. Uppercase is turned off.

  2. The configuration file that is named USERID.MY.CONFIG(CONFIG1) is specified.

  3. Two WRITE statements output a banner and the program name.

  4. The CLIST checks to determine whether the program name that is passed through PGMNAME is known. (If it is not, execution of the CLIST ends.)

  5. If the program name that is passed through PGMNAME is wrdcnt, the debugger executes the wrdcnt CLIST.

  6. If the program name is lincnt, the debugger executes the lincnt CLIST.

  7. Otherwise, the debugger requests a breakpoint on return from main, and executes the gencmds CLIST.

  8. A breakpoint is requested at every hook in main.

  9. The query command is issued.

  10. The number of breakpoints and actions in effect is output.


Using a PROFILE to Select Full-Screen or Line Mode

The debugger opens, by default, in full-screen mode. By specifying a window off command in the PROFILE, you can start the SAS/C Debugger in line mode. This is the only window subcommand that can be issued in the PROFILE; other window subcommands can be issued from a configuration file, as described in the next section.

Note:    You can also alternate between full-screen mode and line mode as described in Switching Between Full-Screen Mode and Line Mode.  [cautionend]


Return Codes for Invalid Commands for the PROFILE

See Setting Up a Debugger PROFILE, for a list of commands that are valid for use in a debugger PROFILE. If you pass an invalid command to the debugger when you enter the debugger, you receive a return code of -3.

Note:    Since the PROFILE is a special-purpose CLIST or EXEC, return codes for debugger commands that are valid in a PROFILE are the same as those that are discussed in Return Codes.  [cautionend]


Chapter Contents

Previous

Next

Top of Page

Copyright © 2001 by SAS Institute Inc., Cary, NC, USA. All rights reserved.