Instrumentation pragmas

The Runtime Tracing feature allows the user to add special directives to the source code under test, known as instrumentation pragma directives. When the source code is instrumented, the Instrumentor replaces instrumentation pragma directives with dedicated code.

Usage

#pragma attol <pragma name> <directive>

Example

int f ( int a )

{

#pragma attol att_insert  if ( a == 0 ) _ATT_DUMP_STACK

  return a;

}

 

This code will be replaced, after instrumentation, with the following line:

/*#pragma attol att_insert*/  if ( a == 0 ) _ATT_DUMP_STACK

 

Note Pragma directives are implemented only if the routine in which it is used is instrumented.

Instrumentation Pragma Names

#pragma attol insert <directive>

replaced by the instrumentation to be:

/*#pragma attol insert*/ <directive>

 

if any of Code Coverage, Runtime Tracing, Memory Profiling or Performance Profiling is/are selected.

 

#pragma attol atc_insert <directive>

replaced by the instrumentation to be:

/*#pragma attol atc_insert*/ <directive>

 

if Code Coverage is selected.

 

#pragma attol att_insert <directive>

replaced by the instrumentation to be:

/*#pragma attol att_insert*/ <directive>

 

if Runtime Tracing is selected.

 

#pragma attol atp_insert <directive>

replaced by the instrumentation to be:

/*#pragma attol atp_insert*/ <directive>

 

if Memory Profiling is selected.

 

#pragma attol atq_insert <directive>

replaced by the instrumentation to be:

/*#pragma attol atq_insert*/ <directive>

 

if Performance Profiling is selected.

#pragma attol type_boolean=<myType>

For Code Coverage this declares the variable type <myType> as a Boolean for MC/DC coverage of bit-wise operations.

 

#pragma attol type_modifier=<keyword

This pragma indicates a specific type modifier to the parser. For example:

#pragma attol type_modifier = __far

#pragma attol type_modifier = __pascal

will analyze silently :

int __pascal func ( int ) { /* ... */ }

char __far *pointer;

 

#pragma attol stop_analyze
#pragma attol start_analyze

#pragma attol stop_instr
#pragma attol start_instr

These pragmas can be used to start and stop analysis or instrumentation.
Stopping analysis also stops instrumentation.
Starting instrumentation also starts analysis.

 

#pragma attol rename_local_var =<FuncName>:<localVarName>

This pragma allows the user to change the declaration name of the local variable named <localVarName> into the method <FuncName> in the source code. This instrumentation pragma directive can be used in a test to get access to the <localVarName> variable.

In the following example, the prama is used to change the name of the local declaration var tata into the translate method. The following code that uses this variable will search for an external variable method instead of the local one.

#pragma attol rename_local_var = translate:tata

int Point::translate(void)

{

static int tata=4;

return tata++; //

tata is a local variable that cannot be modified or read outside the method

becomes

int Point::translate(void)

{

static int _atu_stub_tata=4;

return tata++; //

This tata is now a global variable that can be created from the test driver script

This functionality is available only if using attolcc4 in 8.0.1 release

Code Review Directives

In some cases, it can be useful to temporarily ignore a rule non-conformance on a short portion of source code, while providing a justification of why you are allowing the non-conformance.

#pragma attol crc_justify (<rule>[,<lines>],"<text>")

This macro justifies a deviation on the first non-conformance of a rule following the pragma, where:

<rule> is the name of the code review rule (for example: "Rule M8.5").

<lines> is the optional number of lines (including blank lines), after the current pragma line, that are covered by the deviation. The default value is 1 meaning that the deviation only applies to the next line. Specify all to apply the deviation to all lines until the end of the file.

<text> is the justification of why the deviation applies here.

#pragma attol crc_justify_all (<rule>,<lines>,"<text>")

This macro justifies all non-conformances of a rule following the pragma, where:

<rule> is the name of the code review rule (for example: "Rule M8.5").

<lines> is the number of lines (mandatory)

<text> is the justification of why the rule is ignored here.

#pragma attol crc_justify_everywhere (<rule>[,<lines>],"<text>")

This macro justifies all non-conformances of a rule in all source files in the current project, including traps located before the pragma statement, where:

<rule> is the name of the code review rule (for example: "Rule M8.5").

<lines> is an ignored parameter.

<text> is the justification of why the rule is ignored here.

The recommended usage for crc_justify_everywhere is to create a specific source file containing only the list of pragmas and to add this file to the project.

Code Coverage, Memory Profiling and Performance Profiling Directives

The following macros are for use only with Memory Profiling and Performance Profiling.

_ATCPQ_DUMP(<reset>)

where <reset> can be one or more of the following values:

By default, _ATCPG_RESET is set to _ATCPQ_ALL but can be redefined with a compilation command. Values of 0 or 1 are equivalent to _ATCPQ_ALL.

_ATCPQ_CLOSE closes the result file at the end of the requested dump so an open action will be done on the next result dump using the runtime priv_open method.

_ATCPQ_DUMP can be automatically inserted by clicking the Insert Dump button in the Text Editor toolbar.

_ATP_CHECK(@REFLINE)

This macro indicates a manual dump point in the source code for checking for ADWL or FMWL errors when using Memory Profiling. The corresponding setting must be selected

The @REFLINE parameter is mandatory.

_ATP_TRACK(<pointer>)

This macro adds <pointer> to a list of selected memory blocks to check for ABWL or FMWL errors. a manual dump point in the source code for checking for ADWL or FMWL errors when using Memory Profiling.

Runtime Tracing Directives

When using this mode, the Target Deployment Package only sends messages related to instance creation and destruction, or user notes. All other events are ignored. See Partial message dump for more information about this feature.

_ATT_START_DUMP

_ATT_STOP_DUMP

These directives activate and deactivate the partial message dump mode.

 

_ATT_TOGGLE_DUMP

This directive toggles the dump mode on and off. _ATT_TOGGLE_DUMP can be used instead of _ATT_START_DUMP and _ATT_STOP_DUMP.

 

_ATT_DUMP_STACK

When invoked, this directive dumps the contents of the call stack at that moment.

 

_ATT_FLUSH_ITEMS

When in Target Deployment Package buffer mode, this directive flushes the buffer. All buffered trace information is dumped. Flushing the buffer be useful before entering a time-critical phase of the trace.

 

_ATT_USER_NOTE(<text>)

This directive associates a text note to the function or method instance. <text> is a user-specified alphanumeric string containing the note text of type char*. The length of <text> must be within the maximum note length specified in the Runtime Tracing Settings dialog box. This pragma can be automatically inserted by clicking the Add Note button in the Text Editor toolbar.