Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » Solaris CC compiled code debug with gdb 5.3
Solaris CC compiled code debug with gdb 5.3 [message #192603] Tue, 05 June 2007 16:40 Go to next message
orientphoebus is currently offline orientphoebusFriend
Messages: 15
Registered: July 2009
Junior Member
I can trace the logic by step over etc, but I cannot see the variable's
value. Getting this error:

No symbol "a" in current context.
mi_cmd_var_create: unable to create variable object

Does this mean the CC compiled code cannot be debug by gdb?
Re: Solaris CC compiled code debug with gdb 5.3 [message #192679 is a reply to message #192603] Wed, 06 June 2007 08:00 Go to previous messageGo to next message
Jens Seidel is currently offline Jens SeidelFriend
Messages: 88
Registered: July 2009
Member
Phoebus wrote:
> I can trace the logic by step over etc, but I cannot see the variable's
> value. Getting this error:
>
> No symbol "a" in current context.
> mi_cmd_var_create: unable to create variable object

This could be related to the fact that this variable is optimised away.
Try to compile without optimisation (-O0 -g).

Jens
Re: Solaris CC compiled code debug with gdb 5.3 [message #192738 is a reply to message #192679] Wed, 06 June 2007 20:17 Go to previous messageGo to next message
orientphoebus is currently offline orientphoebusFriend
Messages: 15
Registered: July 2009
Junior Member
My CC doesn't have a -o0 option. Here is my CC's man:

User Commands CC(1)



NAME
CC - C++ compiler

SYNOPSIS
CC [-386] [-486] [-a] [-B{dynamic|static|symbolic}] [-c]
[-cg{89|92}] [-compat[={4|5}]] [+d] [-Dname[=def]]
[-d{y|n}] [-dalign] [-dryrun] [-E] [+e{0|1}] [-fast]
[-features=a[,a...]] [-filt[=filter[,filter...]]
[-flags] [-fnonstd] [-fns[={yes|no}]] [-fprecision=a]
[-fround=a] [-fsimple[=n]] [-fstore] [-ftrap=a[,a...]]
[-G] [-g] [-g0] [-H] [-h[ ]lname] [-help] [-Ipathname]
[-I-] [-i] [-inline] [-instances=i] [-keeptmp] [-KPIC]
[-Kpic] [-Lpath] [-llib] [-libmieee] [-libmil]
[-library=lib[,lib...]] [-mc] [-migration] [-misalign]
[-mr[,string]] [-mt] [-native] [-noex] [-nofstore]
[-nolib] [-nolibmil] [-noqueue] [-norunpath] [-O[n]]
[-o file] [+p] [-P] [-p] [-pentium] [-pg] [-PIC] [-pic]
[-pta] [-ptipath] [-pto] [-ptrpath] [-ptv]
[{-Qoption|-qoption} phase option[,option...]]
[{-Qproduce|-qproduce} type] [-qp] [-Rpath[:path...]]
[-readme] [-S] [-s] [-sb] [-sbfast]
[-staticlib=l[,l...]] [-temp=path]
[-template=a[,a...]] [-time] [-Uname] [-unroll=n] [-V]
[-v] [-vdelx] [-verbose=a[,a...]] [+w] [+w2] [-w]
[-xa] [-xar] [-xarch=isa] [-xbuiltin[={%all|%none}]]
[-xcache=c] [-xcg{89|92}] [-xchip=c] [-xcode=v]
[-xcrossfile[=n]] [-xF] [-xhelp={flags|readme}] [-xia]
[-xild{off|on}] [-xinline[=func_spec[,func_spec...]]
[-xipo[={1|0}] [-xlang=language[,language]] [-xlib-
mieee] [-xlibmil] [-xlibmopt] [-xlic_lib=sunperf]
[-xlicinfo] [-Xm] [-xM] [-xM1] [-xMerge] [-xnolib]
[-xnolibmil] [-xnolibmopt] [-xOn] [-xpg]
[-xprefetch[=a[,a]] [-xprofile=p] [-xregs=r[,r...]]
[-xs] [-xsafe=mem] [-xsb] [-xsbfast] [-xspace]
[-xtarget=t] [-xtime] [-xtrigraphs[={yes|no}]]
[-xunroll=n] [-xwe] [-z arg] [file] ...

Sun WorkShop(TM) Release 6 update 1
Be sure to read the C++ Readme file by using the command:

example% CC -xhelp=readme

Note - In this document the term "IA" refers to the Intel
32-bit processor architecture, which includes the Pentium,
Pentium Pro, Pentium II, Pentium II Xeon, Celeron, Pentium
III, and Pentium III Xeon processors and compatible
microprocessor chips made by AMD and Cyrix.

DESCRIPTION
CC converts C++ and assembly source files to object files,
and links object files and libraries into executable pro-
grams.



Last change: 01/05/15 Sun WorkShop 6 update 2 1






User Commands CC(1)



Programs containing C++ objects must be linked with CC.

CC takes arguments ending in .c, .C, .cc, .cxx, .c++, .cpp,
or .i to be C++ source programs. Arguments ending in .s are
presumed to be assembly source files. Arguments ending in
.o are presumed to be object files.

Files whose names do not end with the above suffixes are
treated as object programs or libraries and are handed over
to the link editor. Unless -c, -S, -E, or -P is specified,
these programs and libraries, together with the results of
any specified compilations or assemblies, are linked in the
order given to produce an output file named a.out. You can
specify a different name for the executable by using the -o
option.

If a single file is compiled and linked all at once, the
intermediate files are deleted.

The Incremental Link Editor (ild) is sometimes used in place
of linker ld for incremental linking. See -xildon and -xild-
off for more information.

Before you use the CC command, insert into your search path
the name of the directory in which you have chosen to
install the C++ compilation system. For instructions on set-
ting your search path, see the csh(1) or the sh(1) man page.



COMPILING FOR 64-BIT:
Sun WorkShop Compilers C++ 6 can produce 64-bit object
binaries on the Solaris(TM) 7 and Solaris 8 operating
environments (SPARC(TM) Platform Edition) with a 64-bit ker-
nel. The resulting executable will run only on a SPARC V9
(64-bit) processor under a Solaris 7 or Solaris 8 operating
environment with a 64-bit kernel.

To create a 64-bit application, use the -xarch=v9,
-xarch=v9a, or -xarch=v9b option. Note that one of these
options must be specified even if -xtarget or -fast is also
specified. In such a case, the -xarch=v9, -xarch=v9a, or
-xarch=v9b option must appear AFTER -xtarget or any other
option that sets -xtarget (such as -fast). For example:

-xtarget=ultra -xarch=v9

Note that -xtarget=ultra and -xtarget=ultra2 imply -xarch=v8
and do not automatically signal -xarch=v9, -xarch=v9a, or
-xarch=v9b.





Last change: 01/05/15 Sun WorkShop 6 update 2 2






User Commands CC(1)



See also the -xcode=abs32|abs44|abs64|pic13|pic32 option for
specifying code address forms.

For more details, see:

<install-directory>/SUNWspro/READMEs/64bit_Compilers

Replace <install-directory> with the path to your Sun
WorkShop installation directory. In a default installation,
<install-directory> is /opt.

For general information on 64-bit Solaris for software
developers, see the "Solaris 64-bit Developer's Guide" on
http://docs.sun.com.

OPTIONS
In general, compiler options are processed from left to
right (with the exception that the -U options are processed
after all -D options), allowing selective overriding of
macro options (options that include other options). This
rule does not apply to linker options.

For a complete description of the C++ compiler options,
including examples, see the C++ User's Guide.

CC accepts the following options.

-386 (IA platform) Use -xtarget=386.

-486 (IA platform) Use -xtarget=486.

-a Use -xa.

See also:

tcov(1) man page

-Bbinding Specifies whether a library binding for linking is
symbolic, dynamic (shared), or static (nonshared).

-Bdynamic is the default. You can use the -B
option several times on a command line.

For more information on the -Bbinding option, see
the ld(1) man page and the Solaris documentation.

-Bdynamic directs the link editor to look for
liblib.so files. Use this option if you want
shared library bindings for linking. If the
liblib.so files are not found, it looks for
liblib.a files.




Last change: 01/05/15 Sun WorkShop 6 update 2 3






User Commands CC(1)



-Bstatic directs the link editor to look only for
liblib.a files. The .a suffix indicates that the
file is static, that is, nonshared. Use this
option if you want nonshared library bindings for
linking.

For an explanation of -Bsymbolic, See the ld(1)
man page.

This option and its arguments are passed to the
linker, ld. If you compile and link in separate
steps and are using the -Bbinding option, you must
include the option in the link step.

Warning:

When building a shared library in compatiblity
mode (-compat[=4]), do not use -Bsymbolic if the
library has exceptions in it. Exceptions that
should be caught might be missed.

-c Directs the CC driver to suppress linking with ld
and, instead, produce a .o file for each source
file. If you specify only one source file on the
command line, then you can explicitly name the
object file with the -o option. For example:

o If you enter CC -c x.cc, the object file,
x.o, is generated.

o If you enter CC -c x.cc -o y.o, the object
file, y.o, is generated.

Warnings:

When the compiler produces object code for an
input file (for example, .cc, .c, or .i), the com-
piler always produces a .o file in the working
directory. If you suppress the linking step, the
.o files are not removed.

See also:

-o filename.

-cg{89|92}
Use -xcg{89|92}.

See also:

-xtarget=native




Last change: 01/05/15 Sun WorkShop 6 update 2 4






User Commands CC(1)



-compat[={4|5}]
Sets the major release compatibility mode of the
compiler. This option controls the __cplusplus
and __SUNPRO_CC_COMPAT preprocessor symbols.

The C++ compiler has two principal modes. The com-
patabiity mode accepts the Annotated C++ Reference
Manual (ARM) semantics and language defined by the
4.2 compiler (-compat[=4]). The standard mode
accepts constructs according to the ANSI/ISO stan-
dard (standard mode, -compat=5). These two modes
are incompatible with each other because the
ANSI/ISO standard forces significant, incompatible
changes in name mangling, vtable layout, and other
ABI details. These two modes are differentiated by
the -compat option as shown in the following
table.

Value Meaning

-compat[=4] (Compatiblity mode) Set language
and binary compatibility to that of
the 4.0.1, 4.1, and 4.2 compilers.
Sets the __cplusplus preprocessor
macro to 1 and the
__SUNPRO_CC_COMPAT preprocessor
macro to 4).

-compat=5 (Standard mode) Set the language
and binary compatibility to
ANSI/ISO standard mode. Sets the
__cplusplus preprocessor macro to
199711L and the __SUNPRO_CC_COMPAT
preprocessor macro to 5).

Defaults:

If the -compat option is not specified, -compat=5
is assumed. If only -compat is specified, -com-
pat=4 is assumed. Regardless of the -compat set-
ting, __SUNPRO_CC_COMPAT is set to 0x530.

Interactions:

You cannot use the standard libraries in compati-
bility mode (-compat[=4]).

Use of -compat[=4] with any of the following
options is not supported.

o -Bsymbolic when the library has exceptions
o -features=[no%]strictdestorder



Last change: 01/05/15 Sun WorkShop 6 update 2 5






User Commands CC(1)



o -features=[no%]tmplife
o -library=[no%]iostream
o -library=[no%]Cstd
o -library=[no%]Crun
o -library=[no%]rwtools7_std
o -xarch=v9
o -xarch=v9a
o -xarch=v9b

Use of -compat=5 with any of the following options
is not supported.

o +e
o -features=[no%]arraynew
o -features=[no%]explicit
o -features=[no%]namespace
o -features=[no%]rtti
o -library=[no%]complex
o -library=[no%]libC
o -vdelx

Warnings:

When building a shared library in compatibility
mode, (-compat[=4]) do not use (-Bsymbolic) if the
library has exceptions in it. Exceptions that
should be caught might be missed.

+d Prevents the compiler from expanding C++ inline
functions.

Under the C++ language rules, a C++ inline func-
tion is a function for which one of the following
statements is true.


o The function is defined using the inline key-
word.

o The function is defined (not just declared)
inside a class definition

o The function is a compiler-generated class
member function

Under the C++ language rules, the compiler can
choose whether actually to inline a call to an
inline function. The C++ compiler inlines calls to
an inline function unless:

o The function is too complex




Last change: 01/05/15 Sun WorkShop 6 update 2 6






User Commands CC(1)



o The +d option is selected

o The -g option is selected

Interactions:

This option is automatically turned on when you
specify -g, the debugging option.

The -gO degubbing option does not turn on +d.

The +d option has no effect on the automatic
inlining that is performed when you use -x04 or
-x05.

-Dname[=def]
Defines a macro symbol name to the preprocessor.
Doing so is equivalent to including a #define
directive at the beginning of the source. You can
use multiple -D options.

The following values are predefined.

SPARC and IA platforms:

__BUILTIN_VA_ARG_INCR
__cplusplus
__DATE__
__FILE__
__LINE__
__STDC__
__SVR4
__SUNPRO_CC = 0x530
__SUNPRO_CC_COMPAT = 4 or 5
__sun
sun
__TIME__
__`uname -s`_`uname -r` (replacing invalid charac-
ters with underscores, for example: -D__SunOS_5_7,
-D__SunOS_5_8)
__unix
unix
_WCHAR_T
__ARRAYNEW if the "array" forms of operators new
and delete are enabled
(see "-features=[no%]arraynew")
_BOOL if type bool is enabled
(see "-features=[no%]bool")

SPARC only:

__sparc



Last change: 01/05/15 Sun WorkShop 6 update 2 7






User Commands CC(1)



sparc (32-bit compilation modes only)

SPARC V9 only:

__sparcv9 (64-bit compilation modes only)

IA platform only:

__i386
i386

Defaults:

If you do not use [=def], name is defined as 1.

Interactions:

If +p is used, sun, unix, sparc and i386 are not
defined.

-d{y|n} Allows or disallows dynamic libraries for the
entire executable.

-dy specifies dynamic linking, which is the
default, in the link editor.

-dn specifies static linking in the link editor.

This option and its arguments are passed to ld.

Interactions:

In a 64-bit environment, many system libraries are
available only as shared dynamic libraries. These
include libm.so and libc.so. libm.a and libc.a are
not provided. As a result, -Bstatic and -dn may
cause linking errors in 64-bit Solaris environ-
ments. Applications must link with the dynamic
libraries in these cases.

-dalign (SPARC platform) Generates double-word load and
store instructions whenever possible for improved
performance. This option assumes that all
double-typed data are double-word-aligned. If you
compile one unit with -dalign, compile all units
of a program with -dalign, or you might get unex-
pected results.

-dryrun Directs the driver CC to show, but not execute,
the commands constructed by the compilation
driver.




Last change: 01/05/15 Sun WorkShop 6 update 2 8






User Commands CC(1)



-E Directs the CC driver to only preprocess the C++
source files, and to send the result to stdout
(standard output). No compilation is done; no .o
files are generated.

This option causes preprocessor-type line number
information to be included in the output.

Output from this option is not supported as input
to the C++ compiler when templates are used.

+e{0|1} Controls virtual table generation in compatibility
mode (-compat[=4]). This option is invalid and
ignored in standard mode (the default mode).

Values:

o +e0 suppresses the generation of virtual tables,
and creates external references to those that
are needed.

o +e1 creates virtual tables for all defined
classes with virtual functions.

Interactions

When you compile with this option, also use the
-features=no%except option. Otherwise the com-
piler generates virtual tables for internal
types used in exception handling.

If template classes have virtual functions,
ensuring that the compiler generates all needed
virtual tables, but does not duplicate these
tables, might not be possible.


-fast Selects a combination of compilation options for
optimum execution speed on the system upon which
the code is being compiled. This option provides
near maximum performance for most applications by
expanding the following compilation options:


-dalign (SPARC only)

-fns (SPARC only)

-fsimple=2 (SPARC only)

-ftrap=%none (SPARC, IA)




Last change: 01/05/15 Sun WorkShop 6 update 2 9






User Commands CC(1)



-xlibmil (SPARC, IA)

-nofstore (IA only)

-xO5 (SPARC, IA)

-xlibmopt (SPARC, IA)

-xtarget=native (SPARC, IA)

-xbuiltin=%all (SPARC, IA)

Interactions:

The code generation option, the optimization
level, the optimization of built-in functions, and
the use of inline template files can be overridden
by subsequent flags. For example, although the
optimization level set by -fast is -xO5, if you
specify -fast -xO3, the optimization level becomes
-xO3. The optimization level that you specify
will override a previously set optimization level.

The -fast macro expands into compilation options
that may affect other specified options. For exam-
ple, in the following command, the expansion of
the -fast macro includes -xtarget=native which
reverts -xarch to one of the 32-bit architecture
options.

Incorrect:

example% CC -xarch=v9 -fast test.cc

Correct:

example% CC -fast -xarch=v9 test.cc

See the description for each option to determine
possible interactions.

Warnings:

Code compiled with the -fast option is not port-
able. For example, compiling code using the fol-
lowing command on an UltraSPARC(TM) III system
will generate a binary that will not execute on an
UltraSPARC II system.

example% CC -fast test.cc





Last change: 01/05/15 Sun WorkShop 6 update 2 10






User Commands CC(1)



Do not use this option for programs that depend on
IEEE standard floating-point exception handling;
different numerical results, premature program
termination, or unexpected SIGFPE signals might
occur.

The -fast option includes -fns -ftrap=%none; that
is, this option turns off all trapping.

In previous SPARC releases, the -fast macro
included -fnonstd, now it does not.

In previous SPARC releases, the -fast macro
expanded to -fsimple=1. Now it expands to -fsim-
ple=2.

In previous releases, the -fast macro expanded to
-xO4. Now it expands to -xO5.

See also:

Numerical Computation Guide, ieee_sun(3m).

-features=a
Enables/disables various C++ language features.

The following flags are valid for both standard
mode (default) and compatibility mode (-
compat[=4]) unless otherwise specified.

Value Meaning

%all All the -feature options that are
valid for the specified mode (com-
patibility mode or standard mode).

%none Turn off all the features that can
be turned off for the specified
mode (compatiblity mode or standard
mode).

[no%]altspell [Do not] Recognize alternative
token spellings (for example, and
for &&). The default is
no%altspell in compatibility mode
and altspell in standard mode.

[no%]anachronisms
[Do not] Allow anachronistic con-
structs. When disabled (that is
-feature=no%anachronisms), no
anachronistic constructs are



Last change: 01/05/15 Sun WorkShop 6 update 2 11






User Commands CC(1)



allowed. The default is anachron-
isms.

[no%]arraynew (Compatibility mode only) [Do not]
Recognize array forms of operator
new and operator delete (for exam-
ple, operator new[] (void*) ). When
enabled, the macro __ARRAYNEW = 1.
When not enabled, the macro is not
defined. The default is
no%arraynew. For details on the use
of this flag, see the C++ Migration
Guide.

[no%]bool [Do not] Allow the bool type and
literals. When enabled, the macro
_BOOL = 1. When disabled, the macro
is not defined. The default is
no%bool in compatibility mode and
bool in standard mode.

[no%]conststrings
[Do not] Put literal strings in
read-only memory. The default is
no%conststrings in compatibility
mode and conststrings in standard
mode.

[no%]except [Do not] Allow C++ exceptions. When
C++ exceptions are disabled (that
is, -features=no%except), a throw-
specification on a function is
accepted but ignored; the compiler
does not generate exception code.
Note that the keywords try, throw,
and catch are always reserved. The
default is except.

[no%]explicit (Compatibility mode only) [Do not]
Recognize the keyword explicit.
The default is no%explicit.

[no%]export [Do not] Recognize the keyword
export. The default is no%export
in compatibility mode and export in
standard mode.

[no%]extensions
[Do not] Allow non-standard code
that is commonly accepted by other
C++ compilers. See chapter 4 of the
C++ User's Guide for an explanation



Last change: 01/05/15 Sun WorkShop 6 update 2 12






User Commands CC(1)



of the invalid code that is
accepted by the compiler when you
use the -features=extensions
option. The default is
-features=no%extenstions.

[no%]iddollar [Do not] Allow $ as a non-initial
identifier character. The default
is no%iddollar.

[no%]localfor [Do not] Use new local-scope rules
for the for statement. The default
is no%localfor in compatibility
mode and localfor in standard mode.

[no%]mutable [Do not] Recognize the keyword mut-
able. The default is no%mutable in
compatibility mode and mutable in
standard mode.

[no%]namespace (Compatibility mode only) [Do not]
Recognize keywords namespace and
using. The default is
no%namespace.

[no%]rtti (Compatibility mode only) [Do not]
Allow runtime type identification
(RTTI). RTTI must be enabled to
use the dynamic_cast<> and typeid
operators. The default is no%rtti.

[no%]split_init
[Do not] Put initializers for non-
local static objects into indivi-
dual functions. When you use
-features=no%split_init, the com-
piler puts all the initializers in
one function. Using
-features=no%split_init minimizes
code size at the possible expense
of compile time. The default is
split_init.

[no%]strictdestrorder
(Standard mode only) [Do not] Fol-
low the requirements specified by
the C++ standard regarding the
order of the destruction of objects
with static storage duration. The
default is strictdestrorder.

[no%]tmplife (Standard mode only) [Do not] Clean



Last change: 01/05/15 Sun WorkShop 6 update 2 13






User Commands CC(1)



up the temporary objects that are
created by an expression at the end
of the full expression, as defined
in the ANSI/ISO C++ Standard.
(When -features=no%tmplife is in
effect, most temporary objects are
cleaned up at the end of their
block.) The default is tmplife.

[no%]transitions
[Do not] allow ARM language
contsructs that are problematic in
standard C++ and that may cuase the
program to behave differently than
expected or that may be rejected by
future compilers. When you use
-features=no%transitions, the com-
piler issues warnings about these
constructs instead of error mes-
sages. When you use
-features=transitions in compati-
bility mode (-compate[=4]), the
compiler displays the warnings
about these constructs only if +w
or -w2 is specified. The following
constructs are considered to be
transition errors: redefining a
template after it was used, omit-
ting the typename directive when it
is needed in a template definition,
and implicitly declaring type int.
The set of transition errors may
change in a future release. The
default is transitions.

Defaults:

If -features is not specified, the following is
assumed for compatibility mode (-compat[=4]):

-features=%none,anachronisms,except,split_init,transitions

If -features is not specified, the following is
assumed for standard mode (the default mode):

-features=%all,no%iddollar,no%extensions

Interactions:

This option accumulates instead of overrides.





Last change: 01/05/15 Sun WorkShop 6 update 2 14






User Commands CC(1)



Use of the following in standard mode (the
default) is not compatible with the standard
libraries and headers:

o no%bool
o no%except
o no%mutable
o no%explicit

Warnings:

The behavior of a program might change when you
use -features=tmplife. Testing whether the pro-
gram works both with and without the
-features=tmplife option is one way to test the
program's portability.

-filt[=filter[,filter...]]
Suppress the filtering that CC normally applies to
linker error messages.

filter must be one of the following values

[no%]names [Do not] Demangle the C++ mangled
linker names.

[no%]returns [Do not] Demangle the return types
of functions. Suppression of this
demangling helps you to identify
function names more quickly, but
note that in the case of co-variant
returns, some functions differ only
in the return type.

[no%]errors [Do not] Show the C++ explanations
of the linker error messages. The
suppression of the explanations is
useful when the linker diagnostics
are provided directly to another
tool.

%all Equivalent to
-filt=errors,names,returns. This
is the default behavior.

%none Equivalent to
-filt=no%errors,no%names,no%returns.

Defaults:

If you do not specify the -filt option, or if you
specify -filt without any values, then the



Last change: 01/05/15 Sun WorkShop 6 update 2 15






User Commands CC(1)



compiler assumes -filt=errors,names,returns.

Interactions:

[no%]returns has no effect when used with
no%names. That is, the following options are
equivalent:

-filt=no%names
-filt=no%names,no%returns
-filt=no%names,returns

-flags Same as -xhelp=flags.

-fnonstd
This option causes hardware traps to be enabled
for floating-point overflow, division by zero, and
invalid operations exceptions.

These results are converted into SIGFPE signals.
If the program has no SIGFPE handler, it ter-
minates with a memory dump (unless you limit the
core dump size to 0).

SPARC: In addition, -fnonstd selects SPARC non-
strandard floating point.

Defaults:

If -fnonstd is not specified, IEEE 754 floating-
point arithmetic exceptions do not abort the pro-
gram, and underflows are gradual.

Expansions:

IA: -fnonstd expands to -ftrap=common.

SPARC: -fnonstd expands to -fns -ftrap=common.

See the Numerical Computation Guide for more
information.

-fns[={no|yes}]

SPARC: Selects SPARC nonstandard floating-point
mode.

This flag causes the nonstandard floating-point
mode to be enabled when a program begins execu-
tion.

On some SPARC platforms, the nonstandard



Last change: 01/05/15 Sun WorkShop 6 update 2 16






User Commands CC(1)



floating-point mode disables "gradual underflow,"
causing tiny results to be flushed to zero rather
than to produce subnormal numbers. It also causes
subnormal operands to be silently replaced by
zero.

On those SPARC platforms that do not support gra-
dual underflow and subnormal numbers in hardware,
use of this option can significantly improve the
performance of some programs.

Optional use of =yes or =no provides a way of tog-
gling the -fns flag following some other macro
flag that includes -fns, such as -fast.

-fns is the same as -fns=yes.
-fns=yes selects non-standard floating point.
-fns=no selects standard floating point.

Defaults:

If -fns is not specified, the nonstandard
floating-point mode is not enabled automatically.
Standard IEEE 754 floating-point computation takes
place, that is, underflows are gradual.

If only -fns is specified -fns=yes is assumed.

Warnings:

When nonstandard mode is enabled, floating-point
arithmetic may produce results that do not conform
to the requirements of the IEEE 754 standard.

This option is effective only on SPARC platforms
and only if used when compiling the main program.
On IA platforms, the option is ignored.

If you compile one routine with -fns, then compile
all routines of the program with the -fns option;
otherwise you can get unexpected results.

-fprecision=a
(IA platform) Sets floating-point rounding preci-
sion mode. a must be one of: single, double,
extended.

The -fprecision flag sets the rounding precision
mode bits in the Floating Point Control Word.
These bits control the precision to which the
results of basic arithmetic operations (add, sub-
tract, multiply, divide, and square root) are



Last change: 01/05/15 Sun WorkShop 6 update 2 17






User Commands CC(1)



rounded.

The following table shows the meanings of the
values of a.

Value Meaning

single Rounds to an IEEE single-precision value

double Rounds to an IEEE double-precision value

extended Rounds to the maximum precision avail-
able

When a is single or double, this flag causes the
rounding precision mode to be set to single or
double precision, respectively, when a program
begins execution. When p is extended or the -fpre-
cision flag is not used, the rounding precision
mode remains as the extended precision.

The single precision rounding mode causes results
to be rounded to 24 significant bits, and double
precision rounding mode causes results to be
rounded to 53 significant bits. In the default
extended precision mode, results are rounded to 64
significant bits. This mode controls only the pre-
cision to which results in registers are rounded,
and it does not affect the range. All results in
register are rounded using the full range of the
extended double format. Results that are stored in
memory are rounded to both the range and precision
of the destination format.

The nominal precision of the float type is single.
The nominal precision of the long double type is
extended.

Defaults:

When the -fprecision flag is not specified, the
rounding precision mode defaults to extended.

Warnings:

This option is effective only on IA devices and
only if used when compiling the main program. On
SPARC devices, this option is ignored.

-fround=a Sets the IEEE rounding mode in effect at startup.

a must be one of: nearest, tozero, negative,



Last change: 01/05/15 Sun WorkShop 6 update 2 18






User Commands CC(1)



positive.

Value Meaning

nearest Rounds towards the nearest number and
breaking ties to even numbers.

tozero Round-to-zero.

negative Round-to-negative-infinity.

positive Round-to-positive-infinity.

This option sets the IEEE 754 rounding mode that:

o Can be used by the compiler in evaluating con-
stant expressions.

o Is established at runtime during the program
initialization.

The meanings are the same as those for the
ieee_flags function, which may be used to change
the mode at runtime.

Defaults:

When the -fround option is not specified, the
rounding mode defaults to -fround=nearest.

Warnings:

If you compile one routine with -fround=a, compile
all routines of the program with the same
-fround=a option; otherwise, you can get unex-
pected results. This option is effective only if
used when compiling the main program.

-fsimple[=n]
Selects floating-point optimization preferences.

If n is present, it must be 0, 1 or 2.

The following table shows the -fsimple values.

Value Meaning

0 Permits no simplifying assumptions.
Preserves strict IEEE 754 conformance.

1 Allows conservative simplification. The
resulting code does not strictly conform



Last change: 01/05/15 Sun WorkShop 6 update 2 19






User Commands CC(1)



to IEEE 754, but numeric results of most
programs are unchanged.

With -fsimple=1, the optimizer is not
allowed to optimize completely without
regard to roundoff or exceptions. In
particular, a floating point computation
cannot be replaced by one that produces
different results with rounding modes
held constant at runtime.

With -fsimple=1, the optimizer can
assume the following:

o IEEE 754 default rounding/trapping
modes do not change after process ini-
tialization.

o Computation producing no visible
result other than potential floating
point exceptions might be deleted.

o Computation with infinities or NaNs as
operands needs to propagate NaNs to
their results; e.g., x*0 might be
replaced by 0.

o Computations do not depend on sign of
zero.

2 Permits aggressive floating point optim-
ization that may cause many programs to
produce different numeric results due to
changes in rounding. For example, per-
mits the optimizer to replace all compu-
tations of x/y in a given loop with x*z,
where x/y is guaranteed to be evaluated
at least once in the loop, z=1/y , and
the values of y and z are known to have
constant values during execution of the
loop.

Defaults:

If -fsimple is not designated, the compiler uses
-fsimple=0.

If -fsimple is designated but no value is given
for n, the compiler uses -fsimple=1.

Interactions:




Last change: 01/05/15 Sun WorkShop 6 update 2 20






User Commands CC(1)



-fast implies -fsimple=2.

Warnings:

This option can break IEEE 754 conformance.

-fstore (IA platform) Forces precision of floating-point
expressions.

This option causes the compiler to convert the
value of a floating-point expression or function
to the type on the left side of an assignment -
when that expression or function is assigned to a
variable, or when that expression is cast to a
shorter floating-point type rather than leaving
the value in a register.

To turn off this option, use the -nofstore option.

Warnings:

Due to roundoffs and truncation, the results may
be different from those that are generated from
the register values.

-ftrap=a[,a...]
Sets the IEEE trapping mode in effect at startup.

This option sets the IEEE 754 trapping modes that
are established at program initialization, but
does not install a SIGFPE handler. You can use
ieee_handler to simultaneously enable traps and
install a SIGFPE handler. When more than one value
is used, the list is processed sequentially from
left to right.

a must be one of the following values.

Value Meaning

[no%]division [Do not] Trap on division by zero.

[no%]inexact [Do not] Trap on inexact result.

[no%]invalid [Do not] Trap on invalid operation.

[no%]overflow [Do not] Trap on overflow.

[no%]underflow [Do not] Trap on underflow.

%all Trap on all the above.




Last change: 01/05/15 Sun WorkShop 6 update 2 21






User Commands CC(1)



%none Trap on none of the above.

common Trap on invalid, division by zero,
and overflow.

Note that the [no%] form of the option is used
only to modify the meanings of the %all or common
value and and must be used with one of these
values, as shown in the example. The [no%] form of
the option by itself does not explicitly cause a
particular trap to be disabled.

If you wish to enable the IEEE traps,
-ftrap=common is the recommended setting.

Defaults:

If -ftrap is not specified, the -ftrap=%none value
is assumed. (Traps will not be enabled automati-
cally.)

Examples:

When one or more terms are given, the list is pro-
cessed sequentially from left to right, thus
-ftrap=%all,no%inexact means to set all traps
except inexact.

Interactions:

The mode may be changed at runtime with
ieee_handler(3M).

Warnings:

If you compile one routine with -ftrap, compile
all routines of the program with the same -ftrap
option; otherwise, you can get unexpected results.

Use the -ftrap=inexact trap with caution, as it
will result in the trap being issued whenever a
floating-point value cannot be represented
exactly. For example, the following statement may
generate this condition:

x = 1.0 / 3.0;

This option is effective only if used when compil-
ing the main program.

-G Instructs the linker to build a dynamic shared
library instead of an executable file; see the



Last change: 01/05/15 Sun WorkShop 6 update 2 22






User Commands CC(1)



ld(1) man page and the C++ User's Guide. All
source files specified in the command line are
compiled with -Kpic by default.

When building a shared library that uses tem-
plates, it is necessary in most cases to include
in the shared library those template functions
that are instantiated in the template database.
Using this option automatically adds those tem-
plates to the shared library as needed.

The following options are passed to ld if -c is
not specified:

o -dy

o -G

o -R

Do not use ld -G to build shared libraries; use CC
-G. The CC driver automatically passes several
options to ld that are needed for C++.

When you use the -G option, the compiler does not
pass any default -l options to ld. If you want the
shared library to have a dependency on another
shared library, you must pass the necessary -l
option on the command line. For example, if you
want the shared library to be dependent upon lib-
Crun, you must pass -lCrun on the command line.

-g Instructs both the compiler and the linker to
prepare the file or program for debugging. The
tasks include:


o Producing more detailed information, known as
stabs, in the symbol table of the object files
and the executable

o Producing some "helper functions," which the
Debugger can call to implement some of its
features

o Disabling the inline generation of functions;
that is, using this option implies the +d option

o Disabling certain levels of optimization

Interactions:




Last change: 01/05/15 Sun WorkShop 6 update 2 23






User Commands CC(1)



If you use this option with -xO[level] (or its
equivalent options, such as -O), you will get lim-
ited debugging information. For more information,
see the entry for -xO.

If you use this option and the optimization level
is -xO3 or lower, the compiler provides best-
effort symbolic information with almost full
optimization. Tail call optimizatio and back-end
inlining are disabled.

If you use this option and the optimization level
is -xO4 or higher, the compiler provides best
effort symbolic information with full optimiza-
tion.

When you specify this option, the +d option is
specified automatically.

This option makes -xildon the default incremental
linker option in order to speed up the compile-
edit-debug cycle. See the description for -xildon
and -xildoff. This option invokes ild in place of
ld unless any of the following are true:

o The -G option is present

o The -xildoff option is present

o Any source files are named on the command line.

To use the full capabilities of the Sun WorkShop 6
Performance Analyzer, compile with the -g option.
While some performance analysis features do not
require -g, you must compile with -g to view anno-
tated source, some function level information, and
compiler commentary messages. See the analyzer(1)
man page and "Compiling Your Program for Data Col-
lection and Analysis" in Analyzing Program Perfor-
mance with Sun WorkShop for more information.

The commentary messages that are generated with -g
describe the optimizations and transformations
that the compiler made while compiling your pro-
gram. Use the er_src(1) command to display the
messages which are interleaved with the source
code.

See also:

For more information, see the explanations for -g0
and +d, as well as the ld(1) man page. The



Last change: 01/05/15 Sun WorkShop 6 update 2 24






User Commands CC(1)



Debugging a Program with dbx guide provides
details about dbx stabs and "lazy stabs."

-g0 Instructs the compiler to prepare the file or pro-
gram for debugging, but not to disable inlining.
This option is the same as -g, except that +d is
disabled.

See also:

+d

-H On the standard error output (stderr), prints,
Re: Solaris CC compiled code debug with gdb 5.3 [message #192818 is a reply to message #192738] Thu, 07 June 2007 07:59 Go to previous messageGo to next message
Jens Seidel is currently offline Jens SeidelFriend
Messages: 88
Registered: July 2009
Member
Phoebus wrote:

> My CC doesn't have a -o0 option. Here is my CC's man:

I wrote -O0 (capital letter Oh followed by zero). But you are probably
right:

Quoting your man page (which is btw to large to post it and you can
read it as well, right?):

> If you use this option with -xO[level] (or its
> equivalent options, such as -O), you will get lim-
> ited debugging information. For more information,
> see the entry for -xO.

> Debugging with -g does not suppress -xOn, but -xOn
> limits -g in certain ways. For example, the optim-
> ization options reduce the utility of debugging so
> that you cannot display variables from dbx, but
> you can still use the dbx where command to get a
> symbolic traceback. For more information, see
> Debugging a Program With dbx.

So again, I suggest to disable optimisation by omitting
options such as -xO2, -xO3, ... and add option -g.

I don't know whether this solves your problem but reducing
optimisation is always the first step if you want to debug.

Jens
Not working. What CC version r u using? [message #192838 is a reply to message #192818] Thu, 07 June 2007 17:19 Go to previous messageGo to next message
orientphoebus is currently offline orientphoebusFriend
Messages: 15
Registered: July 2009
Junior Member
I am using CC: Sun WorkShop 6 update 2 C++ 5.3 Patch 111685-16 2003/07/05

I tried -xo0/1/2/3, nothing works.
Full Error message [message #192846 is a reply to message #192818] Thu, 07 June 2007 17:26 Go to previous messageGo to next message
orientphoebus is currently offline orientphoebusFriend
Messages: 15
Registered: July 2009
Junior Member
Let me give the full error message I am getting from gdb:

Stopped due to shared library event
Error while mapping shared library sections:
"/usr/lib/libCrun.so.1": not in executable format: File format not
recognized.
Error while reading shared library symbols:
"/usr/lib/libCrun.so.1": can't read symbols: File format not recognized.
warning: Lowest section in /usr/lib/libw.so.1 is .hash at 00000074
Stopped due to shared library event
[New LWP 1]
[New LWP 2]
[New LWP 3]
mi_cmd_var_create: unable to create variable object

Does the LibCrun.so error affect?
Re: Full Error message [message #192872 is a reply to message #192846] Fri, 08 June 2007 08:11 Go to previous messageGo to next message
Jens Seidel is currently offline Jens SeidelFriend
Messages: 88
Registered: July 2009
Member
Phoebus wrote:

> Let me give the full error message I am getting from gdb:
>
> Error while mapping shared library sections:
> "/usr/lib/libCrun.so.1": not in executable format: File format not
> recognized.
> mi_cmd_var_create: unable to create variable object
>
> Does the LibCrun.so error affect?

Probably. Sorry, I cannot help you.

I suggest you forget using eclipse and try the debugger from the command
line first. Try:

$ gdb yourApplication
(gdb) b main
(gdb) run

This way you add a breakpoint in main and start the application. It should
stop in main. If this does not work you have a problem with your debugger.

Stupid question: is gdb compatible with Solaris' CC?
I suggest you determine the file type of LibCrun.so ("file" command)
and google for this format and gdb ...

PS: You know that you can install also the GNU toolchain (compiler,
debugger) in Solaris?

Jens
Re: Solaris CC compiled code debug with gdb 5.3 [message #192925 is a reply to message #192603] Fri, 08 June 2007 14:19 Go to previous message
Chris Recoskie is currently offline Chris RecoskieFriend
Messages: 163
Registered: July 2009
Senior Member
Phoebus wrote:
> I can trace the logic by step over etc, but I cannot see the variable's
> value. Getting this error:
>
> No symbol "a" in current context.
> mi_cmd_var_create: unable to create variable object
>
> Does this mean the CC compiled code cannot be debug by gdb?
>

It has been a while since I used Sun Workshop, but at the time that I
did (circa late 2001/early 2002), the binaries it created were not ABI
compatible with GCC. They had to be debugged with the DBX debugger that
came with Sun Workshop.

===========================

Chris Recoskie
Team Lead, IBM CDT Team
IBM Toronto
http://www.eclipse.org/cdt
Previous Topic:how to build a project when Makefile is in subdirectory?
Next Topic:static library build problem
Goto Forum:
  


Current Time: Thu Nov 07 13:13:56 GMT 2024

Powered by FUDForum. Page generated in 0.02858 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top