Debugging Options
3-29
!PROLOGUE
and
!EPILOGUE
markers will be copied without
modification.
3.11 Debugging Options
You can debug code compiled using the GCC-supplied
-g
option, which
generates debugging information. You can attempt debugging with
optimization turned on, though optimization makes debugging difficult.
When debugging optimized code, use the
-mno_sdopt
option, because
sdopt
,
zdxopt
and
zdopt
do not preserve the location of debugging
information.
Using the
-g
option with optimization modifies the code generated in two
ways. First, the debugging version of the C library is linked, rather than
the optimized version. Second, leaf functions save and restore %rpc
(
w
ithout the
-g
option, this save and restore is removed by optimization).
The
-g
option saves and restores this register, because the debugger
requires it to examine the call stack.
3.12 Code Statistics
CC creates four labels and symbols that are useful in analyzing the code
generated by the compiler.
Every function will have a label placed on its first instruction and after its
last instruction with the following formats:
__FUNC_START_<
function name
>
__FUNC_END_<
function name
>
The difference of these two labels will give the code size of a function.
A function will also have a label placed on its return instruction:
__FUNC_EXIT_<
function name
>
This label is used for function profiling. Every function will also have an
absolute symbol that shows the number of words of stack space used
per invocation of the function.
__FUNC_FRAME_SIZE_<
function name
>