Problem with variable inspection and variadic functions?
I am using Crossworks for ARM v2.0.5.
I have observed that the inspection of variables seems to not work correctly inside variadic functions - at least sometimes; maybe always.
This is in debug mode, with no optimisations turned on. Hovering over a variable, the watch window, and locating a variable in memory all seem to point to the wrong place (but the code functions as expected, it's a debugger problem).
We can get around the problem by putting functionality which we wish to debug inside a sub-function, which the variadic function calls.
Below is a test function I have adapted from a similar one which we actually use. When stepping through this code, the variable "index" does not change (hover, watch-window, or memory window); it is reported as 0x0800f378. Its address, as reported by the memory window, is 0x200027f8. Observing nearby memory reveals that "index" appears to actually reside at address 0x200027ec, in this example.
Am I doing something wrong? Or have I found a bug?
static void testing_printf( bool console_operation, const char *fmt_string, ... )
{
va_list args;
uint32_t index;
if ( !console_operation )
{
debug_putchar( '#' );
}
va_start( args, fmt_string ); // Finds beginning of variadic arguments (after fmt_string).
// Special version that takes va_list type (instead of an explicit list of args).
for ( index = 0; index < 5; index++ )
{
debug_vprintf( fmt_string, args );
}
va_end( args );
if ( !console_operation )
{
debug_putchar( '$' );
}
}
Please sign in to leave a comment.
Comments
3 comments