This section provides specific information to help you debug AMODE
64 applications that contain one or more
C/C++ routines. It includes the following topics:
- Debugging C/C++ I/O
routines
- Using XL C/C++ compiler
listings
- Generating a Language Environment dump
of a C/C++ routine
- Finding C/C++ information
in a Language Environment dump
- Debugging example of C/C++ routines
There are several debugging features that are unique to
C/C++ routines.
Before examining the
C/C++ techniques
to find errors, you might want to consider the following areas of
potential problems:
- To prevent errors that may result from differences in LP64 default
argument types, you should include function prototypes for all C/C++ function
calls. For C/C++ runtime
library functions, see z/OS XL C/C++ Runtime Library Reference.
Note: malloc() is
an example of a RTL function which needs this prototype to work correctly
in LP64 applications.
- If you are using the fetch() function, see z/OS XL C/C++ Programming Guide to
ensure that you are creating the fetchable module correctly.
- If you are using DLLs, see z/OS XL C/C++ Programming Guide to
ensure that you are using the DLL correctly.
- Ensure that the entry point of the load module is CELQSTRT.
- If you suspect that you are using uninitialized storage, you may
want to use the STORAGE runtime option.
- You should avoid:
- Incorrect casting
- Referencing an array element with a subscript outside the declared
bounds
- Copying a string to a target with a shorter length than the source
string
- Declaring but not initializing a pointer variable, or using a
pointer to allocated storage that has already been freed
If a routine exception occurred and you need more information
than the condition handler provided, run your routine with the following
runtime options, TRAP(ON, NOSPIE) and TERMTHDACT(UAIMM). Setting these
runtime options generates a system dump of the user address space
of the original abend or program interrupt prior to the Language Environment condition
manager processing the condition. After the system dump is taken by
the operating system the Language Environment condition
manager continues processing.