Other Parts Discussed in Thread: TEST
Tool/software: TI C/C++ Compiler
We use the ARM compiler: TI ARM C/C++ Compiler v16.9.4.LTS
While using gdb to debug we discovered two issues:
1. DEFINE symbols are not added to the debug information. Thus it is not possible in GDB to refer to defined constants.
2. When calling functions from GDB which have float parameters these float parameters are corrupted.
In GDB you need to use "set coerce-float-to-double 0".
Probably the arm compiler incorrectly indicates that the function is "unprototyped". See the GDB source code comments below:
/* How you should pass arguments to a function depends on whether it
was defined in K&R style or prototype style. If you define a
function using the K&R syntax that takes a `float' argument, then
callers must pass that argument as a `double'. If you define the
function using the prototype syntax, then you must pass the
argument as a `float', with no promotion.
Unfortunately, on certain older platforms, the debug info doesn't
indicate reliably how each function was defined. A function type's
TYPE_PROTOTYPED flag may be clear, even if the function was defined
in prototype style. When calling a function whose TYPE_PROTOTYPED
flag is clear, GDB consults this flag to decide what to do.
For modern targets, it is proper to assume that, if the prototype
flag is clear, that can be trusted: `float' arguments should be
promoted to `double'. For some older targets, if the prototype
flag is clear, that doesn't tell us anything. The default is to
trust the debug information; the user can override this behavior
with "set coerce-float-to-double 0". */"
Generally, the way that an argument of type
float is passed to a function depends on whether the function is prototyped. For a prototyped (i.e. ANSI/ISO style) function,
float arguments are passed unchanged, according to the architecture's convention for
float. For unprototyped (i.e. K&R style) functions,
float arguments are first promoted to type
double and then passed.
Unfortunately, some forms of debug information do not reliably indicate whether a function is prototyped. If gdb calls a function that is not marked as prototyped, it consults set coerce-float-to-double.
set coerce-float-to-double on
- Arguments of type
floatwill be promoted to
doublewhen passed to an unprototyped function. This is the default setting.
set coerce-float-to-double off
- Arguments of type
floatwill be passed directly to unprototyped functions.