Introduction to the z/OS debugger

To use dbx, the z/OS® source level UNIX debugger, you need to create an XL C/C++ application program that will both compile and link-edit. After your program has been developed, you can use dbx to debug it from within the shell environment of a z/OS system.

Using dbx, you can debug your program at both the source and machine levels. Source-level debugging allows you to:
  • Set breakpoints at selected statements with conditions for activation.
  • Hold and release thread execution.
  • Step through a program one line or instruction at a time.
  • Access variables symbolically and display them in the correct format.
  • Examine the application source code using simple search functions or a text editor.
  • Debug processes that contain fork() and exec() functions.
  • Interrupt and examine a program that is already in progress.
  • Trace execution of a program by line, routine, or variable.
  • Display expressions using a wide range of operators.
  • Print a list of the active routines and their parameters (stack traceback).
  • Print declarations of variables, along with their fully qualified names.
  • Modify the directory list from which to search for source files.
  • Determine the application programs loaded into a process.
  • Debug applications involving threads.
  • Display information about threads, condition variables, and mutex objects.
  • Debug applications involving DLLs.
  • View z/OS dumps of XL C/C++ programs for postmortem analysis.
Machine-level debugging allows you to:
  • Set breakpoints at selected machine instructions with conditions for activation.
  • Hold and release thread execution.
  • Run a program one instruction at a time.
  • Display or modify the contents of machine registers and memory.
  • Debug processes that contain fork() and exec() functions.
  • Interrupt and examine a program that is already in progress.
  • Trace execution of a program by instruction.
  • Display expressions using a wide range of operators.
  • Determine the application programs loaded into a process.
  • Debug applications involving threads.
  • Display information about thread, condition variable, and mutex objects.
  • View MVS™ dumps.
You can tailor the dbx utility to:
  • Customize your interface to the dbx utility with command aliases.
  • Customize your debugging environment with an initialization file.
  • Invoke your choice of an editor (the default editor is ed) and use shell commands during the debugging session.
  • Enter commands from either standard input or a named file.
  • Reroute standard output and standard error to z/OS UNIX files.
  • Set or change predefined variables.
  • Change the command prompt.
so that dbx fits your work preferences.
Your application program may or may not strictly conform to the z/OS UNIX-supported POSIX standards. You can debug POSIX-conforming XL C/C++ applications in three environments available to most z/OS UNIX application programmers:
  • A POSIX-conforming workstation environment.
  • A shell environment.
  • A shell environment started through MVS batch. From an MVS batch environment, use the BPXBATCH program to enter the dbx command, passing to it the appropriate subcommands in a command file. dbx is run from the shell through MVS batch, and subcommands are entered from a command file to do the appropriate debugging. You need to specify the value of the process ID (PID) for the running application with the dbx -a option. The results of the debugging session can be directed to an z/OS UNIX file. See Running the dbx utility for more information on use of the -a option. For more information about using the BPXBATCH program to run applications from the shell through MVS batch, see The BPXBATCH utility in z/OS XL C/C++ User's Guide.

If an XL C/C++ application program being developed is POSIX-conforming, it can be compiled and link-edited at a workstation that conforms to the same POSIX standards supported by the system where it will eventually run. A UNIX-related source-level debugging facility can then be used at the workstation to do some debugging of the application.

Prepare your XL C/C++ application program source for debugging using the z/OS UNIX c89 utility. For a discussion of how to set the necessary compiler and linkage editor options for debugging, see Preparing your routine for debugging in z/OS Language Environment Debugging Guide.

A z/OS UNIX POSIX-conforming C application can be debugged to some extent at a POSIX-conforming workstation. However, final debugging and verification of the application's correctness should be performed from the MVS system. The z/OS UNIX dbx utility is the XL C/C++ source-level debugging solution supported by z/OS UNIX for application programs.

The application source most likely will be created and coded on one or more workstations connected to an MVS system. Assuming that the application is POSIX-conforming and the workstations used to develop it run POSIX-conforming operating systems, you can do more than just edit your application source at a workstation.

From a workstation operating system that conforms to z/OS UNIX-supported standards, you can:
  • Create and code application source files.
  • Create and store the correct POSIX and user-defined include file libraries.
  • Store user or application data.
    Note: To create and test a XL C/C++ application program on such a workstation using user or application data, you must first understand all the ASCII-EBCDIC data conversion considerations and plan for them.
  • Use a compiler.
  • Test the application modules.
  • Use a UNIX-style source-level debugger (for example, the dbx debugger).

You can then move the application source to an MVS system to be compiled, link-edited, and tested before putting it into a production environment.