Chapter Contents

Previous

Next
An Overview of the SAS/C Debugger

Quick Start to Using the Debugger

This section explains the steps necessary to compile, link, and run programs with the SAS/C Debugger under CMS and OS/390. Part 3 of this book, "Using the Debugger in Your Environment," also describes these steps, but it includes more detailed information about using compiler options, allocating data sets that are needed by the debugger, saving a debugger session, setting up a debugger profile, and so on. The quick start procedures that are contained in this section are helpful to a new SAS/C Debugger user. If you are an experienced CMS or OS/390 user, familiar with previous releases of the debugger, see Notes for Users with SAS/C Debugger Experience.


Quick Start to Using the Debugger under CMS

This CMS quick-start procedure provides the essential information that you need in order to start using the debugger under CMS. Detailed information about compiling and linking your programs is provided in the SAS/C Compiler and Library User's Guide, Third Edition. Also, once you are comfortable with running the debugger, you can find more advanced information in Running the Debugger under CMS.

CMS Quick-Start Procedure

These are the steps to using the debugger under CMS:

  1. LC370 program-name (DEBUG:

    This step compiles the source file for program-name with the compiler debug option. The name of the program is program-name C. The compiler output is placed in a file calledprogram-name TEXT. The debugger symbol table file is placed inprogram-name DB. (The compiler outputs the debugger symbol table file, which the debugger uses at run time.)

  2. COOL program-name (GENMOD program-name

    This step creates a load module of your program. The output is placed in program-name MODULE. COOL is not always required. If you do not need to use COOL, you can issue the following commands:

    LOAD program-name

    GENMOD program-name

    See the SAS/C Compiler and Library User's Guide for information about the circumstances that require the use of COOL.

  3. program-name =DEBUG

    This step runs your program. The =debug option invokes the debugger.

    Note:    Even though you compile with the debug option, you must invoke the debugger at run time also.  [cautionend]


Quick Start to Using the Debugger under TSO

If you are running under OS/390, then probably you want to use the debugger interactively under TSO. This section contains the basic information required to run the debugger under TSO.

Note:    The SAS/C Debugger can be run in a batch job under OS/390. This procedure is explained in Running the Debugger under TSO, and in Running the Debugger under OS/390 Batch.  [cautionend]

Preparing Your Source and Debugger Data Sets

Before you can compile, link, and debug a program, you must create two data sets, one to hold your source code and one to hold the debugger symbol table file that is created when you compile with the debug option. The attributes of the data set that holds your source code are not critical; however, the debugger file does require specific attributes for record format and blocksize. For the debugger symbol table file, allocate a partitioned data set (PDS) with RECFM=U and BLKSIZE=4080. For the purpose of this quick-start procedure, use the data set names userid.pdsname.C and userid.pdsname.DBGLIB, as recommended in TSO Quick-Start Procedure.

Note:    The object and load data sets, userid.pdsname.OBJ and userid.pdsname.LOAD, are automatically created when your program is compiled and are linked if they do not exist already.  [cautionend]

TSO Quick-Start Procedure

This procedure provides the essential information that you need in order to start using the debugger. Detailed information about compiling and linking your programs is provided in the SAS/C Compiler and Library User's Guide. Also, once you are accustomed to running the debugger, you can find more advanced information in Running the Debugger under TSO.

When your source and debugger data sets are ready, you can compile, link, and run under TSO by using the following steps:

  1. LC370 pdsname (program-name) DEBUG

    For example, the following command compiles a member named HELLO that is contained in the PDS userid.MYWORK.C:

    LC370 MYWORK(HELLO) DEB

    The object code output from the compiler is placed in the PDS userid.MYWORK.OBJ(HELLO). Another output (which contains special tables that are used while running the debugger) is placed in the PDS userid.MYWORK.DBGLIB. The member name is the section name (SName).(footnote 1) The debugger uses the section name in order to locate the member that contains debugging information for the compilation. For more information, see SECTION-NAME and FUNCTION-NAME Arguments.

  2. COOL pdsname (program-name)

    The following command directs the linker to use the object code in
    userid.MYWORK.OBJ in order to create a load module of your program:

    COOL MYWORK(HELLO)

    The output from the linker is placed in the partitioned data set userid. MYWORK.LOAD(HELLO). See the SAS/C Compiler and Library User's Guide for more information.

  3. ALLOC DA(pdsname.DBGLIB) F(DBGLIB) SHR

    The following ALLOCATE statement allocates userid.MYWORK.DBGLIB:

    ALLOC DA(MYWORK.DBGLIB) F(DBGLIB) SHR

  4. CALL pdsname (program-name)`=DEBUG'

    The following command runs the program in userid.MYWORK.LOAD(HELLO):

    CALL MYWORK(HELLO) '=DEBUG'

    The '=debug' option invokes the debugger. The debugger prompts you for the debugger data set name if you omit step 3.

Naming your data sets Name your partitioned data sets (PDSs) as follows:
source data set userid.pdsname.C
object data set userid.pdsname.OBJ
load data set userid.pdsname.LOAD
debugger data set userid.pdsname.DBGLIB
where userid is your TSO user prefix. pdsname can be any name, but it must be the same for all four data sets, as in the following:
userid.MYWORK.C
userid.MYWORK.OBJ
userid.MYWORK.LOAD
userid.MYWORK.DBGLIB

The LC370 and COOL CLISTs assume these naming conventions. If you follow the naming conventions, you do not have to override data set names.

If you do not format the names of the data sets as shown above, then you must fully qualify all of your data set names. For example, suppose you name a partitioned data set userid.MYWORK.SOURCE, using its members to contain your source code. Then, to compile a member that is named PROGRAM, the command is

    LC370 'userid.MYWORK.SOURCE(PROGRAM)' DEBUG
 OBJECT(‚ ‚ ‚ userid.MYWORK.OBJ (PROGRAM)''')
 DBGLIB(‚ ‚ ‚ userid.MYWORK.DBGLIB (PROGRAM)''')

As you can see, this compile step is much more complicated than the compile step (step 1) given earlier in this section.

The same thing happens with the COOL CLIST. For example, if your object module data set is userid.MYWORK.OBJECT, then the command is

    COOL 'userid.MYWORK.OBJECT(PROGRAM)'
 LOAD(‚ ‚ ‚ userid.MYWORK.LOAD (PROGRAM)''')


Notes for Users with SAS/C Debugger Experience

The full-screen windowing interface provides a useful addition to your productivity tools. These notes enable you to run the new release while using your existing knowledge of the debugger.

Invoking the Debugger

As with previous releases of the software, you invoke the SAS/C Debugger by adding the =debug option to the command that runs your program.

Switching to Line Mode

As previously mentioned, full-screen mode is usually the default method of running the debugger. After invoking the debugger, you can use the window off command to switch from full-screen mode to line mode. Issue this command from the command window, which is located at the bottom of the screen and is indicated by the Cdebug: prompt.

Once you enter line mode, you can issue all of the debugger commands that you used with previous releases of the SAS/C Debugger.

Using the Windowing Interface to Enter Line-Mode Commands

Instead of switching to line mode, you may prefer to issue your commands from the command window while in full-screen mode. This gives you the advantage of viewing your source code in the Source window and your previously entered commands in the Log window. Commands that you issue from the Cdebug: prompt in the Command window use the same syntax as line-mode commands do. Another major advantage to this approach is that you begin to familiarize yourself with the windowing interface.


FOOTNOTE 1:   During compilation, the compiler creates names for various data objects in the compilation. In general, these names are based on the section name. The section name, in turn, can be specified by the sname compiler option. If no section name is specified, the compiler assigns one as described in the chapter about compiler options in the SAS/C Compiler and Library User's Guide[arrow]


Chapter Contents

Previous

Next

Top of Page

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