DEBUG_group(5) DEBUG_group(5)
DEBUG_group - Compiler options for debugging
This man page describes the -DEBUG:... option group of the MIPSpro
compilers. The options in this group allow the user a variety of
controls over whether the compiler attempts to detect various errors (at
compile time or runtime) and over how they are reported. It is divided
into 2 sections:
-DEBUG Group Options
Runtime Error Reporting
-DEBUG Group Options
Debugging options in the MIPSpro compilers are controlled from the
command line by using the -DEBUG option group.
These options are supported by the MIPSpro 7.2 compilers for C (cc(1)),
C++ (CC(1)), Fortran/77 (f77(1)), and Fortran/90 (f90(1)), except where
otherwise indicated below. As described in those man pages, the command
line format used for group options is
-groupname:option[=value][:opt2[=val2]]...
Thus, the group name is followed by a colon-separated list of options,
each of which is an option name possibly followed by an equal sign and a
value. The option names may generally be abbreviated by truncating them
to a unique prefix (which may change when new options are added to the
group).
-DEBUG:...
This group provides control over compiler (and generated code)
detection of various errors, and over how they are reported.
The individual controls in this group for error detection are
listed below. Note that the option names ending in "_check" all
generate runtime checking code; those ending in "_warning" all
generate compile-time warnings only.
div_check[=n]
Emit code to check all integer divides for zero divisors or
overflow. For n=0, do no checks; n=1, check for divide by
zero; n=2, check for overflow (e.g. INT_MAX/-1); n=3, check
both divide by zero and overflow. Replaces -TENV:check_div.
Default n=1.
Page 1
DEBUG_group(5) DEBUG_group(5)
subscript_check[=(ON|OFF)]
Generate code to check for subscripts out of range at
runtime, producing a trap #8 for violations at runtime (C and
C++) unless -DEBUG:verbose_runtime is also specified. This
option replaces Fortran -C. Default OFF.
trap_uninitialized[=(ON|OFF)]
Force all un-initialized stack, automatic and dynamically
allocated variables to be initialized with 0xFFFA5A5A. When
this value is used as a floating point variable, it is
treated as a floating point NaN and it will cause a floating
point trap. When it is used as a pointer, an address or
segmentation violation will most likely to occur. This
option replaces -trapuv. Default OFF.
varargs_interface_check[=(ON|OFF)]
Emit subprogram interface descriptors for all extern varargs
definitions (C and C++) and calls to non-prototyped routines
with FP actual parameters, and check the calls in the linker
and rld for consistency. Default ON.
varargs_prototypes[=(ON|OFF)]
ANSI C and C++ require that varargs routines be prototyped,
and the compiler assumes this by default. Failure to provide
prototypes for calls to such routines with floating point
arguments will normally cause failures. Turning this option
OFF will eliminate these failures at some cost in program
performance. (The compiler and/or linker will normally
produce warnings for programs which might encounter this
problem to assist in fixing them.) Default ON.
verbose_runtime[=(ON|OFF)]
Modify the behavior of various runtime checks to report
source routine and line number of failures instead of just
trapping. This increases the code size impact of checking,
but provides better information. Currently works for
-DEBUG:subscript_check in C and C++; in Fortran it behaves
like this option is always ON. See the section on runtime
error reporting below. Default OFF.
The individual options in this group for message control are
listed below. They are based on an initial classification of the
messages generated by the compiler as errors, for problems which
cause the compilation to fail, as warnings, for situations which
are likely to be programmer errors, or as remarks, for situations
which might be problems. By default, the compiler prints error
and warning messages, but not remarks. Most compiler messages
Page 2
DEBUG_group(5) DEBUG_group(5)
have an identifying number, printed in parentheses after the
classification, which may be used in the controls below, where we
call it the "message ID."
Most error messages cannot be controlled -- they will be emitted,
and the compiler will reject the file being compiled -- but some
errors are considered discretionary, i.e. they may be turned off.
The discretionary errors, warnings, and remarks, can be
controlled by the following options:
error=n1[,n2,...]
Treat the problems reported by warnings or remarks with
message IDs n1, n2,... as errors.
fullwarn[=(ON|OFF)]
Emit all informational messages, including remarks.
Replaces -fullwarn. Default OFF.
remark=n1[,n2,...]
Treat the problems with message IDs n1, n2,... as
remarks, i.e. don't print them unless -DEBUG:fullwarn is
also set.
suppress=n1[,n2,...]
Suppress the messages with IDs n1, n2,... Same as
-DEBUG:woff=....
warning=n1[,n2,...]
Treat the problems with message IDs n1, n2,... as
warnings.
woff=n1[,n2,...]
Turn off the messages with IDs n1, n2,... Same as
-DEBUG:suppress=...; replaces -woff.
Runtime Error Reporting
Various options in this group support the detection of errors at runtime.
One of them today, -DEBUG:subscript_check, and more in the future, can
"report" the errors either with a simple trap which doesn't require much
code, or with a more expensive library call which identifies the
offending routine and line number. The latter choice is enabled by the
option -DEBUG:verbose_runtime.
Page 3
DEBUG_group(5) DEBUG_group(5)
The reporting routine is named __C_runtime_error. Setting a debugger
breakpoint at this routine is a good way to obtain further information
about the runtime errors it reports. However, __C_runtime_error is not
available in libc.so in versions of Irix prior to 6.5. As a result, C or
C++ programs which are compiled with
-DEBUG:subscript_check:verbose_runtime, run under pre-6.5 Irix, and
encounter a subscript range violation, will dump core with a memory
failure instead of reporting the error location. If you provide your own
dummy __C_runtime_error, you can set a debugger breakpoint at it to
locate errors. Furthermore, you can obtain a location report for this
purpose by providing a routine which looks like:
========================================================
#include <signal.h>
#include <stdio.h>
void __C_runtime_error ( int trap_code, char *name, int line_no, ... )
{
switch ( trap_code ) {
/* Subscript range violations: */
case BRK_RANGE:
fprintf ( stderr, "error: Subscript range violation", name);
break;
/* Others (unknown trap codes): */
default:
fprintf ( stderr, "error: Trap %d ", trap_code );
break;
}
fprintf ( stderr, " in '%s'", name);
if ( line_no != -1 )
fprintf ( stderr, " (line %d)", line_no );
fprintf ( stderr, "0 );
exit (99);
}
========================================================
cc(1), CC(1), f77(1), f90(1)
PPPPaaaaggggeeee 4444 [ Back ]
|