JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
Oracle Solaris 11.1 Dynamic Tracing Guide     Oracle Solaris 11.1 Information Library
search filter icon
search icon

Document Information

Preface

1.  About DTrace

2.  D Programming Language

3.  Aggregations

4.  Actions and Subroutines

5.  Buffers and Buffering

6.  Output Formatting

7.  Speculative Tracing

8.  dtrace(1M) Utility

9.  Scripting

10.  Options and Tunables

11.  Providers

12.  User Process Tracing

13.  Statically Defined Tracing for User Applications

14.  Security

15.  Anonymous Tracing

16.  Postmortem Tracing

17.  Performance Considerations

18.  Stability

19.  Translators

20.  Versioning

Versions and Releases

Versioning Options

Provider Versioning

Index

Versioning Options

By default, any D programs you compile using dtrace -s or specify using the dtrace -P, -m, -f, -n or -i command-line options are bound to the most recent D programming interface version offered by the D compiler. You can determine the current D programming interface version using the dtrace -V option:

$ dtrace -V
dtrace: Sun D 1.0
$

If you wish to establish a binding to a specific version of the D programming interface, you can set the version option to an appropriate version string. Similar to other DTrace options (see Chapter 10, Options and Tunables), you can set the version option either on the command-line using dtrace -x:

# dtrace -x version=1.0 -n 'BEGIN{trace("hello");}'

or you can use the #pragma D option syntax to set the option in your D program source file:

#pragma D option version=1.0

BEGIN
{
        trace("hello");
}

If you use the #pragma D option syntax to request a version binding, you must place this directive at the top of your D program file prior to any other declarations and probe clauses. If the version binding argument is not a valid version string or refers to a version not offered by the D compiler, an appropriate error message will be produced and compilation will fail. You can therefore also use the version binding facility to cause execution of a D script on an older version of DTrace to fail with an obvious error message.

Prior to compiling your program declarations and clauses, the D compiler loads the set of D types, functions, constants, and translators for the appropriate interface version into the compiler namespaces. Therefore, any version binding options you specify simply control the set of identifiers, types, and translators that are visible to your program in addition to the variables, types, and translators that your program defines. Version binding prevents the D compiler from loading newer interfaces that may define identifiers or translators that conflict with declarations in your program source code and would therefore cause a compilation error. See Identifier Names and Keywords for tips on how to pick identifier names that are unlikely to conflict with interfaces offered by future versions of DTrace.