Insure++ Reference - RETURN_FAILURE
A particularly difficult problem to track with conventional methods
is that of incorrect return code from system functions. Insure++
is equipped with interface definitions for system libraries that enable
it to check for errors when functions are called. Normally, these
messages are suppressed, since applications often include their own
handling for system calls that return errors. In some cases, however,
it may be useful to enable these messages to track down totally
unexpected behavior.
A particularly common problem occurs when applications run out of
memory as in the following code.
1: /*
2: * File: retfail.c
3: */
4: #include <stdlib.h>
5:
6: main()
7: {
8: char *p;
9:
10: p = malloc(1024*1024*1024);
11: return (0);
12: }
Normally, this code will run without displaying any messages. If
RETURN_FAILURE messages are enabled, however, the
following display will result.
[retfail.c:10] **RETURN_FAILURE**
1. >> p = malloc(1024*1024*1024);
Function returned an error:
2. malloc(1073741824) failed: no more memory
Stack trace where the error occurred:
3. malloc() (interface)
main() retfail.c, 4
- Source line at which the problem was detected.
- Description of the error and the parameters used.
- Stack trace showing the function call sequence leading to
the error.
These messages are normally suppressed, but can be enabled by adding
the option
insure++.unsuppress RETURN_FAILURE
to the .psrc file.
RETURN_DANGLING
RETURN_INCONSISTENT
|