Scl function: Difference between revisions

From STRIDE Wiki
Jump to navigation Jump to search
m (moved Studio:Scl function to Scl function over redirect)
No edit summary
Line 1: Line 1:
= The scl_function pragma =
= The scl_function pragma =


The scl_function pragma allows the user to capture a function. All interfaces that STRIDE works with must be captured.  
The ''scl_function'' pragma allows the user to capture a function. All interfaces that STRIDE works with must be captured.  


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 [[s2sinstrument|Instrument Build Tool]] will use those options to generate appropriate function interception code.
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 [[s2sinstrument|Instrument Build Tool]] will use those options to generate appropriate function interception code.
Line 16: Line 16:
|-
|-
| ''function-name''
| ''function-name''
| String
| Identifier
| Name of the function to capture (no quotes)
| Name of the function to capture.
|-
|-
| ''context''
| ''context''
Line 38: Line 38:
== Example ==
== Example ==
<source lang=c>
<source lang=c>
int f(int x);  
int foo(int x);  


void g(void);
void boo(void);


#pragma scl_function(f)
#pragma scl_function(foo)
#pragma scl_function(g, "DEFINITION", "IMPLICIT", "TEST_GROUP")
#pragma scl_function(boo, "DEFINITION", "IMPLICIT", "TEST_GROUP")
</source>
</source>


[[Category:SCL]]
[[Category:SCL]]

Revision as of 16:38, 14 June 2011

The scl_function pragma

The scl_function pragma allows the user to capture a function. All interfaces that STRIDE works with must be captured.

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_function(function-name [,context, name-mangling, group-id])


Parameters Type Description
function-name Identifier Name of the function to capture.
context String Optional. Context in which the function is going to be intercepted. Possible values are "REFERENCE" - intercept at the function call (aka user) or "DEFINITION" - intercept at the function definition (aka owner).
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).

Example

int foo(int x); 

void boo(void);

#pragma scl_function(foo)
#pragma scl_function(boo, "DEFINITION", "IMPLICIT", "TEST_GROUP")