TraceWPP task

Windows 驱动程序工具包(WDK)提供 TraceWPP 任务,以便在使用 MSBuild 生成驱动程序时运行 tracewpp.exe 工具。 tracewpp.exe 工具用于实现 WPP 软件跟踪

WppEnabled 是 ClCompile 项的新元数据,可用于跟踪源文件。 The Wpp task runs through the entire ClCompile Item Collections and invokes tracewpp.exe for each Item for which the WppEnabled metadata is set to TRUE.

WppEnabled 元数据已添加到 ClCompile 项,因为 WPP 任务在与 CL 任务相同的输入文件类型上运行,在本例中为 .c、.cpp 和 .h 文件。

Note You access the Item metadata for tracewpp by using the ClCompile item in project files. MSBuild 在目标内部使用 TraceWpp 项将其传递给任务。

以下示例演示如何编辑.vcxproj文件中的元数据。

<ItemGroup>
    <ClCompile Include="a.c" />
      <WppEnabled>false</WppEnabled>
    <ClCompile Include="b.c">
        <WppEnabled>true</WppEnabled>
        <WppKernelMode>true</WppKernelMode>
        <WppAdditionalIncludeDirectories>c:\test\</WppAdditionalIncludeDirectories>
    </ClCompile>
    <ClCompile Include="test1.c" />
    <ClCompile Include="test2.c">
        <WppEnabled>true</WppEnabled>
        <WppDllMacro>true</WppDllMacro>
    </ClCompile>
</ItemGroup>

命令行调用将为:

tracewpp.exe  km /Ic:\test\b.c
tracewpp.exe  dll test2.c

The example above shows that MSBuild invokes tracewpp.exe only on b.c and test2.c because the WppEnabled metadata is set to TRUE for these inputs. 另请注意,这两个输入的元数据不同。 因此,这些输入的开关也将有所不同。 换句话说,可以使用自己的元数据集调用每个输入。

WPP 任务参数 Item Metadata Tool Switch
Sources

必需的 ITaskItem[] 参数。 指定源文件的列表。

@(TraceWpp)
AddAlternateNameToMessageGUID

可选字符串参数。 为来自此跟踪提供程序的消息指定消息 GUID 的备用友好名称。

%(TraceWpp.WppAddAlternateNameToMessageGUID) -o:String
AdditionalConfigurationFile

可选字符串参数。 指定其他配置文件。 WPP 除了默认文件 defaultwpp.ini之外,还使用指定的文件。

%(TraceWpp.WppAdditionalConfigurationFile) -ini:Path
AdditionalIncludeDirectories

可选 string[] 参数。 将目录添加到 WPP 搜索包含文件的目录列表中。

%(TraceWpp.WppAdditionalIncludeDirectories) -I
AlternateConfigurationFile

可选字符串参数。 指定备用配置文件。 WPP 使用此文件而不是 defaultwpp.ini 文件。

%(TraceWpp.WppAlternateConfigurationFile) -defwpp:Path
GenerateUsingTemplateFile

可选字符串参数。 对于 WPP 处理的每个源文件,其名称在大括号 {}之间指定,WPP 将创建具有指定文件扩展名的另一个文件。

%(TraceWpp.WppGenerateUsingTemplateFile) -gen{File.tpl}*.ext
MinimalRebuildFromTracking

可选的布尔参数。 If the value is TRUE, WPP performs a tracked incremental build. 否则,WPP 将执行重新生成。

%(TraceWpp.WppMinimalRebuildFromTracking)
NumericBaseForFormatStrings

可选 int 参数。 为格式字符串的编号建立数字基数。

%(TraceWpp.WppNumericBaseForFormatStrings) -argbase:Number
AddControlGUID

可选字符串参数。 使用指定的控件 GUID 和名为“Error”、“异常”和“Noise”的条目定义 WPP_DEFINE_BIT WPP_CONTROL_GUIDS宏。

%(TraceWpp.WppAddControlGUID) -ctl:GUID
AdditionalOptions

可选字符串参数。 命令行选项的列表。

%(TraceWpp.WppAdditionalOptions)
ConfigurationDirectories

可选 string[] 参数。 指定配置和模板文件的位置。

%(TraceWpp.WppConfigurationDirectories) -cfgdir:[Path]
DllMacro

可选的布尔参数。 定义WPP_DLL宏。

%(TraceWpp.WppDllMacro) -dll
FileExtensions

可选 string[] 参数。 指定 WPP 识别为源文件的文件类型。 WPP 忽略文件扩展名不同的文件。

%(TraceWpp.WppFileExtensions) -ext:.ext1 [.ext2]
IgnoreExclamationmarks

可选的布尔参数。 指示 WPP 忽略感叹号,也称为“shriek”,用于复杂格式,如 %!timestamp!%。

%(TraceWpp.WppIgnoreExclamationmarks) -noshrieks
KernelMode

可选的布尔参数。 定义跟踪内核模式组件的WPP_KERNEL_MODE宏。 默认情况下,仅跟踪用户模式组件。

%(TraceWpp.WppKernelMode) -km
OutputDirectory

可选字符串参数。 指定 WPP 创建的输出文件的目录。

%(TraceWpp.WppOutputDirectory) -odir:Path
PreprocessorDefinitions

可选 string[] 参数。 定义源文件的预处理符号。

%(TraceWpp.WppPreprocessorDefinitions) /D
PreserveExtensions

可选 string[] 参数。 创建 TMH 文件时保留指定的文件扩展名。

%(TraceWpp.WppPreserveExtensions) -preserveext:ext1[,ext2]
ScanConfigurationData

可选字符串参数。 在不是配置文件的文件中以及 defaultwpp.ini中搜索配置数据,例如自定义数据类型。

%(TraceWpp.WppScanConfigurationData) -scan:File
SearchString

可选字符串参数。 指示 WPP 在源文件中搜索指定字符串以启动跟踪。

%(TraceWpp.WppSearchString) -lookfor:String
ToolPath

可选字符串参数。 允许指定工具所在的文件夹的完整路径。

$(WPPToolPath)
TraceFunction

可选 string[] 参数。 指定可用于生成跟踪消息的函数。

%(TraceWpp.WppTraceFunction) -func:FunctionDescription
TrackerLogDirectory

可选字符串参数。 跟踪器写入 tlog 的日志目录。

%(TraceWpp.WppTrackerLogDirectory)
TrackFileAccess

可选的布尔参数。 如果为 true,则跟踪此任务的文件访问模式。

$(TrackFileAccess)

WPP Preprocessor

WPP 软件跟踪