Debugging C/C++ routines
This topic provides specific information to help you debug applications that
contain one or more C/C++ routines. It also
provides information about debugging C/C++
applications compiled with XPLINK. It includes the following subtopics:
- Debugging C/C++ I/O routines
- Using C/C++ compiler listings
- Generating a Language Environment® dump of a C/C++ routine
- Generating a Language Environment dump of a C/C++ routine with XPLINK
- Finding C/C++ information in a Language Environment dump
- Debugging example of C/C++ routines
- Debugging example of C/C++ routines with XPLINK
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:
- If you suspect that you are using uninitialized storage, you may want to use the
STORAGEruntime option. - If you are using the
fetch()function, see fetch() - Get a load module in z/OS XL C/C++ Runtime Library Reference to ensure that you are creating the fetchable module correctly. - If you are using DLLs, see Building and using Dynamic Link Libraries (DLLs) in z/OS XL C/C++ Programming Guide.
- For non-System Programming C routines, ensure that the entry point of the load module is CEESTART.
- 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.