Scl func
Jump to navigation
Jump to search
The scl_func pragma
The scl_func pragma allows the user to capture a function and explictly assign its SUID. All interfaces that STRIDE works with must be captured, explicit SUID assignment is optional. Normally interface SUIDs are automatically assigned by STRIDE. The pragma scl_function is used to capture functions that do not require explicit SUID assignment.
When captured for the purpose of interception (in which case the term intercept-able is used throught the documentation) optional arguments allow specification of how would it be done. The Instrument Build Tool will use those options to generate appropriate function interception code.
Syntax
#pragma scl_func(SUID, function-name [,context, name-mangling, group-id])
Parameters | Type | Description |
SUID | Integer | Lower order, 24-bit value found in a SMID |
function-name | Identifier | Name of the function to capture (no quotes) |
context | String | Optional. Context in which the function is going to be intercepted. Possible values are "REFERENCE" - intercept at the function call or "DEFINITION" - intercept at the function definition. |
name-mangling | String | Optional. Type of name mangling to be used when intercepted. Possible values are "EXPLICIT" or "IMPLICIT". |
group-id | String | Optional. User defined identifier representing the group to which this function belongs when solving name mangling conflicts. |
Notes
- The function must be declared as a designator with external linkage.
- A compilation error is reported if an attempt is made to capture a function more than once (with either scl_func or scl_function).
- Integer constant expression must evaluate to a number between 1 and 224.
- The integer constant that the SUID resolves to must be unique among both functions and messages, or an error is recognized.
Example
This example uses the scl_func pragma to assign STRIDE Unique Identifiers to two function prototypes.
#define SUID_BASE 100
void foo(int x);
int boo(void);
#pragma scl_func( SUID_BASE, foo )
#pragma scl_func( SUID_BASE+1, boo, "DEFINITION", "IMPLICIT", "TEST_GROUP" )