diff options
author | DDCloud <ramarag@microsoft.com> | 2016-01-20 18:46:37 -0800 |
---|---|---|
committer | Rama Krishnan Raghupathy <ramarag@microsoft.com> | 2016-01-21 14:45:26 -0800 |
commit | 956245eb5d4681bcc0182844abb74fdf3d372518 (patch) | |
tree | 38fb8408f8050d405d2f48614e19b6b19b95b462 | |
parent | 2c25d6ca44e3129ace57f6383260a42023a6d646 (diff) | |
download | coreclr-956245eb5d4681bcc0182844abb74fdf3d372518.tar.gz coreclr-956245eb5d4681bcc0182844abb74fdf3d372518.tar.bz2 coreclr-956245eb5d4681bcc0182844abb74fdf3d372518.zip |
Generating Event Logging Headers From CMake for Linux
Conflicts:
build.sh
-rw-r--r-- | CMakeLists.txt | 27 | ||||
-rwxr-xr-x | build.sh | 33 | ||||
-rw-r--r-- | src/CMakeLists.txt | 66 | ||||
-rw-r--r-- | src/dlls/clretwrc/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/pal/src/CMakeLists.txt | 4 | ||||
-rw-r--r-- | src/pal/tests/palsuite/CMakeLists.txt | 3 | ||||
-rw-r--r-- | src/scripts/Utilities.py | 1 | ||||
-rw-r--r-- | src/scripts/genXplatEventing.py | 133 | ||||
-rw-r--r-- | src/scripts/genXplatLttng.py | 138 |
9 files changed, 221 insertions, 186 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 18208770c3..f89d3ff7a8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,8 +7,6 @@ project(CoreCLR) # Enable @rpath support for shared libraries. set(MACOSX_RPATH ON) -#SET_PROPERTY(GLOBAL PROPERTY GLOBAL_DEPENDS_DEBUG_MODE 1) - if(CMAKE_VERSION VERSION_EQUAL 3.0 OR CMAKE_VERSION VERSION_GREATER 3.0) cmake_policy(SET CMP0042 NEW) endif() @@ -126,7 +124,7 @@ if(CLR_CMAKE_PLATFORM_UNIX) # Linux and Darwin identify it as "x86_64" while FreeBSD uses the # "amd64" string. Accept either of the two here. if(CMAKE_SYSTEM_PROCESSOR STREQUAL x86_64 OR CMAKE_SYSTEM_PROCESSOR STREQUAL amd64 OR CMAKE_SYSTEM_PROCESSOR STREQUAL aarch64) - set(IS_64BIT_BUILD 1) + set(IS_64BIT_BUILD 1) endif (CMAKE_SYSTEM_PROCESSOR STREQUAL x86_64 OR CMAKE_SYSTEM_PROCESSOR STREQUAL amd64 OR CMAKE_SYSTEM_PROCESSOR STREQUAL aarch64) endif(CLR_CMAKE_PLATFORM_UNIX) @@ -161,7 +159,7 @@ function(get_compile_definitions DefinitionName) foreach(DEFINITION IN LISTS COMPILE_DEFINITIONS_LIST) if (${DEFINITION} MATCHES "^\\$<\\$<CONFIG:([^>]+)>:([^>]+)>$") - # The entries that contain generator expressions must have the -D inside of the + # The entries that contain generator expressions must have the -D inside of the # expression. So we transform e.g. $<$<CONFIG:Debug>:_DEBUG> to $<$<CONFIG:Debug>:-D_DEBUG> set(DEFINITION "$<$<CONFIG:${CMAKE_MATCH_1}>:-D${CMAKE_MATCH_2}>") else() @@ -182,13 +180,13 @@ function(get_include_directories IncludeDirectories) endfunction(get_include_directories) # Set the passed in RetSources variable to the list of sources with added current source directory -# to form absolute paths. -# The parameters after the RetSources are the input files. +# to form absolute paths. +# The parameters after the RetSources are the input files. function(convert_to_absolute_path RetSources) set(Sources ${ARGN}) foreach(Source IN LISTS Sources) list(APPEND AbsolutePathSources ${CMAKE_CURRENT_SOURCE_DIR}/${Source}) - endforeach() + endforeach() set(${RetSources} ${AbsolutePathSources} PARENT_SCOPE) endfunction(convert_to_absolute_path) @@ -234,10 +232,10 @@ function(add_precompiled_header header cppFile targetSources) OBJECT_OUTPUTS "${precompiledBinary}") set_source_files_properties(${${targetSources}} PROPERTIES COMPILE_FLAGS "/Yu\"${header}\" /Fp\"${precompiledBinary}\"" - OBJECT_DEPENDS "${precompiledBinary}") + OBJECT_DEPENDS "${precompiledBinary}") # Add cppFile to SourcesVar set(${targetSources} ${${targetSources}} ${cppFile} PARENT_SCOPE) - endif(MSVC) + endif(MSVC) endfunction() # Includes @@ -286,10 +284,9 @@ elseif (CLR_CMAKE_PLATFORM_UNIX) endif(WIN32) - if (CLR_CMAKE_PLATFORM_UNIX) add_definitions(-DPLATFORM_UNIX=1) - + if(CLR_CMAKE_PLATFORM_LINUX) add_definitions(-D__LINUX__=1) if(CLR_CMAKE_PLATFORM_UNIX_TARGET_AMD64) @@ -337,7 +334,7 @@ if (CLR_CMAKE_PLATFORM_UNIX) if ((${__ASAN_POS} GREATER -1) OR (${__UBSAN_POS} GREATER -1)) set(CLR_SANITIZE_CXX_FLAGS "${CLR_SANITIZE_CXX_FLAGS} -fsanitize=") set(CLR_SANITIZE_LINK_FLAGS "${CLR_SANITIZE_LINK_FLAGS} -fsanitize=") - if (${__ASAN_POS} GREATER -1) + if (${__ASAN_POS} GREATER -1) set(CLR_SANITIZE_CXX_FLAGS "${CLR_SANITIZE_CXX_FLAGS}address,") set(CLR_SANITIZE_LINK_FLAGS "${CLR_SANITIZE_LINK_FLAGS}address,") message("Address Sanitizer (asan) enabled") @@ -386,7 +383,7 @@ if (CLR_CMAKE_PLATFORM_UNIX) #These seem to indicate real issues add_compile_options(-Wno-invalid-offsetof) - # The following warning indicates that an attribute __attribute__((__ms_struct__)) was applied + # The following warning indicates that an attribute __attribute__((__ms_struct__)) was applied # to a struct or a class that has virtual members or a base class. In that case, clang # may not generate the same object layout as MSVC. add_compile_options(-Wno-incompatible-ms-struct) @@ -448,7 +445,7 @@ if (WIN32) set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /IGNORE:4197,4013,4254,4070,4221") set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /INCREMENTAL:NO") - set(CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS} /IGNORE:4221") + set(CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS} /IGNORE:4221") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /DEBUG /PDBCOMPRESS") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /STACK:1572864") @@ -670,7 +667,7 @@ endif(WIN32) add_definitions(-DFEATURE_CORECLR) if (CLR_CMAKE_PLATFORM_UNIX) add_definitions(-DFEATURE_COREFX_GLOBALIZATION) -endif(CLR_CMAKE_PLATFORM_UNIX) +endif(CLR_CMAKE_PLATFORM_UNIX) add_definitions(-DFEATURE_CORESYSTEM) add_definitions(-DFEATURE_CORRUPTING_EXCEPTIONS) if(WIN32) @@ -31,8 +31,6 @@ setup_dirs() mkdir -p "$__BinDir" mkdir -p "$__LogsDir" mkdir -p "$__IntermediatesDir" - # Ensure there are no stale generated files - rm -rf "$__GeneratedIntermediatesDir" } # Performs "clean build" type actions (deleting and remaking directories) @@ -65,9 +63,24 @@ check_prereqs() build_coreclr() { + +# Event Logging Infrastructure + __GeneratedIntermediate="$__IntermediatesDir/Generated" + __GeneratedIntermediateEventProvider="$__GeneratedIntermediate/eventprovider_new" + if [[ -d "$__GeneratedIntermediateEventProvider" ]]; then + rm -rf "$__GeneratedIntermediateEventProvider" + fi + + if [[ ! -d "$__GeneratedIntermediate/eventprovider" ]]; then + mkdir -p "$__GeneratedIntermediate/eventprovider" + fi + + mkdir -p "$__GeneratedIntermediateEventProvider" if [[ $__SkipCoreCLR == 0 || $__ConfigureOnly == 1 ]]; then echo "Laying out dynamically generated files consumed by the build system " - $PYTHON "$__ProjectRoot/src/scripts/genXplatEventing.py" --man "$__ProjectRoot/src/vm/ClrEtwAll.man" --exc "$__ProjectRoot/src/vm/ClrEtwAllMeta.lst" --inc "$__GeneratedIntermediatesDir/inc" --dummy "$__GeneratedIntermediatesDir/inc/etmdummy.h" --testdir "$__GeneratedIntermediatesDir/eventprovider_tests" + echo "Laying out dynamically generated Event Logging Test files" + $PYTHON -B -Wall -Werror "$__ProjectRoot/src/scripts/genXplatEventing.py" --man "$__ProjectRoot/src/vm/ClrEtwAll.man" --exc "$__ProjectRoot/src/vm/ClrEtwAllMeta.lst" --testdir "$__GeneratedIntermediateEventProvider/tests" + if [[ $? != 0 ]]; then exit fi @@ -75,7 +88,8 @@ build_coreclr() #determine the logging system case $__BuildOS in Linux) - $PYTHON "$__ProjectRoot/src/scripts/genXplatLttng.py" --man "$__ProjectRoot/src/vm/ClrEtwAll.man" --intermediate "$__GeneratedIntermediatesDir/" + echo "Laying out dynamically generated Event Logging Implementation of Lttng" + $PYTHON -B -Wall -Werror "$__ProjectRoot/src/scripts/genXplatLttng.py" --man "$__ProjectRoot/src/vm/ClrEtwAll.man" --intermediate "$__GeneratedIntermediateEventProvider" if [[ $? != 0 ]]; then exit fi @@ -85,18 +99,18 @@ build_coreclr() esac fi - export __GeneratedIntermediatesDirPresent="$__IntermediatesDir/Generated" #do not use this variable, it is used below to support incremental build - $PYTHON -c "import sys;sys.path.insert(0,\"$__ProjectRoot/src/scripts\"); from Utilities import *;UpdateDirectory(\"$__GeneratedIntermediatesDirPresent\",\"$__GeneratedIntermediatesDir\")" + echo "Cleaning the temp folder of dynamically generated Event Logging files" + $PYTHON -B -Wall -Werror -c "import sys;sys.path.insert(0,\"$__ProjectRoot/src/scripts\"); from Utilities import *;UpdateDirectory(\"$__GeneratedIntermediate/eventprovider\",\"$__GeneratedIntermediateEventProvider\")" if [[ $? != 0 ]]; then exit fi - # Do not do any more processing from now on: + rm -rf "$__GeneratedIntermediateEventProvider" + # All set to commence the build echo "Commencing build of native components for $__BuildOS.$__BuildArch.$__BuildType in $__IntermediatesDir" - export __GeneratedIntermediatesDir="$__GeneratedIntermediatesDirPresent" cd "$__IntermediatesDir" generator="" @@ -433,9 +447,8 @@ __BinDir="$__RootBinDir/Product/$__BuildOS.$__BuildArch.$__BuildType" __PackagesBinDir="$__BinDir/.nuget" __ToolsDir="$__RootBinDir/tools" __TestWorkingDir="$__RootBinDir/tests/$__BuildOS.$__BuildArch.$__BuildType" -__IntermediatesDir="$__RootBinDir/obj/$__BuildOS.$__BuildArch.$__BuildType" +export __IntermediatesDir="$__RootBinDir/obj/$__BuildOS.$__BuildArch.$__BuildType" __TestIntermediatesDir="$__RootBinDir/tests/obj/$__BuildOS.$__BuildArch.$__BuildType" -export __GeneratedIntermediatesDir="$__IntermediatesDir/Generated_latest" # use this variable to locate dynamically generated files, the actual location though will be different # Specify path to be set for CMAKE_INSTALL_PREFIX. # This is where all built CoreClr libraries will copied to. diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 9231dc9a79..243c7d34fa 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -10,30 +10,64 @@ include_directories("classlibnative/cryptography") include_directories("classlibnative/inc") include_directories("${GENERATED_INCLUDE_DIR}") +# The Following Logic is used to wire up Build dependencies for Generated files in Event Logging +# ClrEtwAll.man - Event Schema +# ClrEtwAllMeta.lst - MetaData list [provided to ensure Windows Desktop is not broken] +# genXplatEventing.py - has the core logic for parsing Event Schema +# genWinEtw.py - Uses genXplatEventing to generate Windows Specific ETW Files +# clretwallmain.h and etmdummy.h - Provides the Event Logging Functionality to the VM +# clrxplatevents.h - Used by clretwallmain.h on Non Windows platform +# ClrEtwAll.h - Used by clretwallmain.h on Windows +# ClrEtwAll.rc - Used by src/dlls/clretwrc/clretrw.rc on Windows + +set (ScriptGeneratedEventFiles + ${GENERATED_INCLUDE_DIR}/clretwallmain.h + ${GENERATED_INCLUDE_DIR}/etmdummy.h +) +set (GeneratedEventFiles) + if(WIN32) - add_custom_command( - COMMENT "Generating Eventing Files" - OUTPUT ${GENERATED_INCLUDE_DIR}/ClrEtwAll.h - OUTPUT ${GENERATED_INCLUDE_DIR}/clretwallmain.h - OUTPUT ${GENERATED_INCLUDE_DIR}/etmdummy.h - COMMAND ${MC} -h ${GENERATED_INCLUDE_DIR} -r ${GENERATED_INCLUDE_DIR} -b -co -um -p FireEtw "${VM_DIR}/ClrEtwAll.man" - COMMAND ${PYTHON} -B -Wall -Werror "${CLR_DIR}/src/scripts/genWinEtw.py" --man "${VM_DIR}/ClrEtwAll.man" --exc "${VM_DIR}/ClrEtwAllMeta.lst" --eventheader "${GENERATED_INCLUDE_DIR}/ClrEtwAll.h" --macroheader "${GENERATED_INCLUDE_DIR}/clretwallmain.h" --dummy "${GENERATED_INCLUDE_DIR}/etmdummy.h" - DEPENDS "${CLR_DIR}/src/scripts/genWinEtw.py" "${VM_DIR}/ClrEtwAll.man" "${VM_DIR}/ClrEtwAllMeta.lst" + set (GenEventFilesScript "${CLR_DIR}/src/scripts/genWinEtw.py") + set (GenEventArgs --eventheader "${GENERATED_INCLUDE_DIR}/ClrEtwAll.h" --macroheader "${GENERATED_INCLUDE_DIR}/clretwallmain.h") + + list (APPEND ScriptGeneratedEventFiles + ${GENERATED_INCLUDE_DIR}/ClrEtwAll.h + ) + + list (APPEND GeneratedEventFiles + ${GENERATED_INCLUDE_DIR}/ClrEtwAll.rc ) -elseif(CLR_CMAKE_PLATFORM_LINUX) + add_custom_command( - COMMENT "Generating Eventing Files" + COMMENT "Generating ETW resource Files" + COMMAND ${MC} -h ${GENERATED_INCLUDE_DIR} -r ${GENERATED_INCLUDE_DIR} -b -co -um -p FireEtw "${VM_DIR}/ClrEtwAll.man" OUTPUT ${GENERATED_INCLUDE_DIR}/ClrEtwAll.h - OUTPUT ${GENERATED_INCLUDE_DIR}/clretwallmain.h - OUTPUT ${GENERATED_INCLUDE_DIR}/etmdummy.h - COMMAND ${PYTHON} -B -Wall -Werror "${CLR_DIR}/src/scripts/genXplatEventing.py" --man "${VM_DIR}/ClrEtwAll.man" --exc "${VM_DIR}/ClrEtwAllMeta.lst" --eventheader "${GENERATED_INCLUDE_DIR}/ClrEtwAll.h" --macroheader "${GENERATED_INCLUDE_DIR}/clretwallmain.h" --dummy "${GENERATED_INCLUDE_DIR}/etmdummy.h" - DEPENDS "${CLR_DIR}/src/scripts/genWinEtw.py" "${VM_DIR}/ClrEtwAll.man" "${VM_DIR}/ClrEtwAllMeta.lst" + DEPENDS "${VM_DIR}/ClrEtwAll.man" + ) +else() + set (GenEventFilesScript "${CLR_DIR}/src/scripts/genXplatEventing.py") + set (GenEventArgs --inc "${GENERATED_INCLUDE_DIR}") + + list (APPEND ScriptGeneratedEventFiles + ${GENERATED_INCLUDE_DIR}/clrxplatevents.h ) -endif() +endif(WIN32) + +add_custom_command( + COMMENT "Generating Eventing Files" + COMMAND ${PYTHON} -B -Wall -Werror ${GenEventFilesScript} ${GenEventArgs} --man "${VM_DIR}/ClrEtwAll.man" --exc "${VM_DIR}/ClrEtwAllMeta.lst" --dummy "${GENERATED_INCLUDE_DIR}/etmdummy.h" + OUTPUT ${ScriptGeneratedEventFiles} + DEPENDS ${GenEventFilesScript} "${VM_DIR}/ClrEtwAll.man" "${VM_DIR}/ClrEtwAllMeta.lst" "${CLR_DIR}/src/scripts/genXplatEventing.py" +) + +list (APPEND GeneratedEventFiles + ${ScriptGeneratedEventFiles} +) add_custom_target( GeneratedEventingFiles - DEPENDS ${GENERATED_INCLUDE_DIR}/clretwallmain.h ${GENERATED_INCLUDE_DIR}/etmdummy.h ${GENERATED_INCLUDE_DIR}/ClrEtwAll.h) + DEPENDS ${GeneratedEventFiles} +) function(add_library_clr) add_library(${ARGV}) diff --git a/src/dlls/clretwrc/CMakeLists.txt b/src/dlls/clretwrc/CMakeLists.txt index 284b43715b..61fbfb85b7 100644 --- a/src/dlls/clretwrc/CMakeLists.txt +++ b/src/dlls/clretwrc/CMakeLists.txt @@ -1,5 +1,4 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR}) -include_directories($ENV{__GeneratedIntermediatesDir}) if(WIN32) # remove /ltcg from resource-only libraries @@ -13,6 +12,7 @@ endif(WIN32) add_definitions(-DFX_VER_INTERNALNAME_STR=clretwrc.dll) add_library_clr(clretwrc SHARED + clretwrc.rc ) # add the install targets diff --git a/src/pal/src/CMakeLists.txt b/src/pal/src/CMakeLists.txt index 6034c9da4a..5fa87cc14d 100644 --- a/src/pal/src/CMakeLists.txt +++ b/src/pal/src/CMakeLists.txt @@ -214,7 +214,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL Linux) unwind-x86_64 ) endif() - + target_link_libraries(coreclrpal gcc_s pthread @@ -253,7 +253,7 @@ endif(CMAKE_SYSTEM_NAME STREQUAL Darwin) add_subdirectory(examples) if(CMAKE_SYSTEM_NAME STREQUAL Linux) - add_subdirectory($ENV{__GeneratedIntermediatesDir}/eventprovider ${CMAKE_CURRENT_BINARY_DIR}/eventprovider) + add_subdirectory($ENV{__IntermediatesDir}/Generated/eventprovider ${CMAKE_CURRENT_BINARY_DIR}/eventprovider) endif(CMAKE_SYSTEM_NAME STREQUAL Linux) # Install the static PAL library for VS diff --git a/src/pal/tests/palsuite/CMakeLists.txt b/src/pal/tests/palsuite/CMakeLists.txt index b2b162985f..235b695961 100644 --- a/src/pal/tests/palsuite/CMakeLists.txt +++ b/src/pal/tests/palsuite/CMakeLists.txt @@ -21,5 +21,4 @@ add_subdirectory(miscellaneous) add_subdirectory(pal_specific) add_subdirectory(samples) add_subdirectory(threading) -add_subdirectory($ENV{__GeneratedIntermediatesDir}/eventprovider_tests ${CMAKE_CURRENT_BINARY_DIR}/eventprovider ) - +add_subdirectory($ENV{__IntermediatesDir}/Generated/eventprovider/tests ${CMAKE_CURRENT_BINARY_DIR}/eventprovider ) diff --git a/src/scripts/Utilities.py b/src/scripts/Utilities.py index 9dfefb7329..7fd9bc7d74 100644 --- a/src/scripts/Utilities.py +++ b/src/scripts/Utilities.py @@ -42,6 +42,7 @@ def walk_recursively_and_update(dcmp): def UpdateDirectory(destpath,srcpath): + print("Updating %s with %s" % (destpath,srcpath)) if not os.path.exists(destpath): os.makedirs(destpath) dcmp = dircmp(destpath,srcpath) diff --git a/src/scripts/genXplatEventing.py b/src/scripts/genXplatEventing.py index 1d01b60a6c..2d44904693 100644 --- a/src/scripts/genXplatEventing.py +++ b/src/scripts/genXplatEventing.py @@ -1,4 +1,4 @@ -## +# ## Copyright (c) Microsoft. All rights reserved. ## Licensed under the MIT license. See LICENSE file in the project root for full license information. ## @@ -8,7 +8,7 @@ #Look at the Code in <root>/src/inc/genXplatLttng.py for using subroutines in this file # -import os +import os import xml.dom.minidom as DOM stdprolog=""" @@ -59,22 +59,21 @@ palDataTypeMapping ={ "win:Binary" :"const BYTE" } # A Template represents an ETW template can contain 1 or more AbstractTemplates -# The AbstractTemplate contains FunctionSignature +# The AbstractTemplate contains FunctionSignature # FunctionSignature consist of FunctionParameter representing each parameter in it's signature class AbstractTemplate: def __init__(self,abstractTemplateName,abstractFnFrame): self.abstractTemplateName = abstractTemplateName self.AbstractFnFrame = abstractFnFrame - class Template: def __init__(self,templateName): self.template = templateName - self.allAbstractTemplateTypes = [] # list of AbstractTemplateNames - self.allAbstractTemplateLUT = {} #dictionary of AbstractTemplate - + self.allAbstractTemplateTypes = [] # list of AbstractTemplateNames + self.allAbstractTemplateLUT = {} #dictionary of AbstractTemplate + def append(self,abstractTemplateName,abstractFnFrame): self.allAbstractTemplateTypes.append(abstractTemplateName) self.allAbstractTemplateLUT[abstractTemplateName] = AbstractTemplate(abstractTemplateName,abstractFnFrame) @@ -90,12 +89,12 @@ class Template: frame = self.getFnFrame(subtemplate) if frame.getParam(name): return frame.getParam(name) - return None + return None class FunctionSignature: def __init__(self): - self.LUT = {} # dictionary of FunctionParameter + self.LUT = {} # dictionary of FunctionParameter self.paramlist = [] # list of parameters to maintain their order in signature def append(self,variable,fnparam): @@ -114,7 +113,7 @@ class FunctionParameter: self.winType = winType #ETW type as given in the manifest self.name = name #parameter name as given in the manifest self.prop = prop #any special property as determined by the manifest and developer - #self.count #indicates if the parameter is a pointer + #self.count #indicates if the parameter is a pointer if count == "win:null": self.count = "win:null" elif count or winType == "win:GUID" or count == "win:count": @@ -123,7 +122,6 @@ class FunctionParameter: else: self.count = "win:null" - def getTopLevelElementsByTagName(Node,tag): dataNodes = [] @@ -134,7 +132,7 @@ def getTopLevelElementsByTagName(Node,tag): return dataNodes def bucketizeAbstractTemplates(template,fnPrototypes,var_Dependecies): - # At this point we have the complete argument list, now break them into chunks of 10 + # At this point we have the complete argument list, now break them into chunks of 10 # As Abstract Template supports a maximum of 10 arguments abstractTemplateName = template; subevent_cnt = 1; @@ -147,7 +145,7 @@ def bucketizeAbstractTemplates(template,fnPrototypes,var_Dependecies): abstractFnFrame.append(dependency,fnPrototypes.getParam(dependency)) frameCount = abstractFnFrame.getLength() - if frameCount == 10: + if frameCount == 10: templateProp.append(abstractTemplateName,abstractFnFrame) abstractTemplateName = template + "_" + str(subevent_cnt) @@ -167,10 +165,9 @@ def bucketizeAbstractTemplates(template,fnPrototypes,var_Dependecies): # 2. Check if the frame has enough space, if there is continue adding missing dependencies # 3. Else Save the current Frame and start a new frame and follow step 1 and 2 # 4. Add the current parameter and proceed - - #create a new fn frame - abstractFnFrame = FunctionSignature() + #create a new fn frame + abstractFnFrame = FunctionSignature() #subevent_cnt == 1 represents argumentless templates if abstractFnFrame.getLength() > 0 or subevent_cnt == 1: @@ -200,11 +197,11 @@ def parseTemplateNodes(templateNodes): attrib_name = attrib.name if attrib_name not in ignoredXmlTemplateAttribes and attrib_name not in usedXmlTemplateAttribes: raise ValueError('unknown attribute: '+ attrib_name + ' in template:'+ template) - + for dataNode in dataNodes: variable = dataNode.getAttribute('name') wintype = dataNode.getAttribute('inType') - + #count and length are the same wincount = dataNode.getAttribute('count') winlength = dataNode.getAttribute('length'); @@ -213,36 +210,35 @@ def parseTemplateNodes(templateNodes): var_dependency = [variable] if winlength: if wincount: - raise Exception("both count and length property found on: " + variable + "in template: " + template) + raise Exception("both count and length property found on: " + variable + "in template: " + template) wincount = winlength if (wincount.isdigit() and int(wincount) ==1): wincount = '' - + if wincount: if (wincount.isdigit()): var_Props = wincount - elif fnPrototypes.getParam(wincount): + elif fnPrototypes.getParam(wincount): var_Props = wincount var_dependency.insert(0,wincount) - + #construct the function signature - if wintype == "win:GUID": var_Props = "sizeof(GUID)/sizeof(int)" - + var_Dependecies[variable] = var_dependency fnparam = FunctionParameter(wintype,variable,wincount,var_Props) fnPrototypes.append(variable,fnparam) structNodes = getTopLevelElementsByTagName(templateNode,'struct') - + count = 0; for structToBeMarshalled in structNodes: struct_len = "Arg"+ str(count) + "_Struct_Len_" struct_pointer = "Arg"+ str(count) + "_Struct_Pointer_" - count += 1 + count += 1 #populate the Property- used in codegen structname = structToBeMarshalled.getAttribute('name') @@ -250,19 +246,19 @@ def parseTemplateNodes(templateNodes): if not countVarName: raise ValueError('Struct '+ structname+ ' in template:'+ template + 'does not have an attribute count') - + var_Props = countVarName + "*" + struct_len + "/sizeof(int)" var_Dependecies[struct_len] = [struct_len] var_Dependecies[struct_pointer] = [countVarName,struct_len,struct_pointer] - + fnparam_len = FunctionParameter("win:ULong",struct_len,"win:null",None) fnparam_pointer = FunctionParameter("win:Struct",struct_pointer,"win:count",var_Props) - + fnPrototypes.append(struct_len,fnparam_len) fnPrototypes.append(struct_pointer,fnparam_pointer) allTemplates[template] = bucketizeAbstractTemplates(template,fnPrototypes,var_Dependecies) - + return allTemplates def generateClrallEvents(eventNodes,allTemplates): @@ -317,7 +313,7 @@ def generateClrallEvents(eventNodes,allTemplates): del line[-1] if len(fnptypeline) > 0: del fnptypeline[-1] - + fnptype.extend(fnptypeline) fnptype.append("\n)\n{\n") fnbody.append(lindent) @@ -327,10 +323,10 @@ def generateClrallEvents(eventNodes,allTemplates): fnbody.extend(line) fnbody.append(");\n") fnbody.append("}\n\n") - + clrallEvents.extend(fnptype) clrallEvents.extend(fnbody) - + return ''.join(clrallEvents) def generateClrXplatEvents(eventNodes, allTemplates): @@ -370,11 +366,11 @@ def generateClrXplatEvents(eventNodes, allTemplates): #remove trailing commas if len(fnptypeline) > 0: del fnptypeline[-1] - + fnptype.extend(fnptypeline) fnptype.append("\n);\n") clrallEvents.extend(fnptype) - + return ''.join(clrallEvents) #generates the dummy header file which is used by the VM as entry point to the logging Functions @@ -385,7 +381,7 @@ def generateclrEtwDummy(eventNodes,allTemplates): templateName = eventNode.getAttribute('template') fnptype = [] - #generate FireEtw functions + #generate FireEtw functions fnptype.append("#define FireEtw") fnptype.append(eventName) fnptype.append("("); @@ -398,11 +394,11 @@ def generateclrEtwDummy(eventNodes,allTemplates): fnparam = fnSig.getParam(params) line.append(fnparam.name) line.append(", ") - + #remove trailing commas if len(line) > 0: del line[-1] - + fnptype.extend(line) fnptype.append(") 0\n") clretmEvents.extend(fnptype) @@ -423,7 +419,6 @@ def generateClralltestEvents(sClrEtwAllMan): clrtestEvents.append(" EventXplatEnabled" + eventName + "();\n") clrtestEvents.append("Error |= FireEtXplat" + eventName + "(\n") - line =[] if templateName : for subTemplate in allTemplates[templateName].allAbstractTemplateTypes: @@ -453,7 +448,7 @@ def generateClralltestEvents(sClrEtwAllMan): line.append(argline) line.append(",\n") - + #remove trailing commas if len(line) > 0: del line[-1] @@ -463,20 +458,22 @@ def generateClralltestEvents(sClrEtwAllMan): return ''.join(clrtestEvents) +def generateSanityTest(sClrEtwAllMan,testDir): + if not testDir: + return + print('Generting Event Logging Tests') - -def generateSanityTest(sClrEtwAllMan,testDir): if not os.path.exists(testDir): os.makedirs(testDir) cmake_file = testDir + "/CMakeLists.txt" - test_cpp = testDir + "/clralltestevents.cpp" + test_cpp = "clralltestevents.cpp" testinfo = testDir + "/testinfo.dat" Cmake_file = open(cmake_file,'w') - Test_cpp = open(test_cpp,'w') + Test_cpp = open(testDir + "/" + test_cpp,'w') Testinfo = open(testinfo,'w') - + #CMake File: print >>Cmake_file, stdprolog_cmake print >>Cmake_file, """ @@ -487,7 +484,7 @@ def generateSanityTest(sClrEtwAllMan,testDir): print >>Cmake_file, test_cpp print >>Cmake_file, """ ) - include_directories($ENV{__GeneratedIntermediatesDir}/inc) + include_directories(${GENERATED_INCLUDE_DIR}) include_directories(${COREPAL_SOURCE_DIR}/inc/rt) add_executable(eventprovidertest @@ -562,7 +559,7 @@ unsigned int win_UInt32 = 4; unsigned short win_UInt16 = 12; unsigned char win_UInt8 = 9; int win_Int32 = 12; -BYTE* win_Binary =(BYTE*)var21 ; +BYTE* win_Binary =(BYTE*)var21 ; int __cdecl main(int argc, char **argv) { @@ -601,11 +598,17 @@ int __cdecl main(int argc, char **argv) Testinfo.close() def generateEtmDummyHeader(sClrEtwAllMan,clretwdummy): + + if not clretwdummy: + return + + print(' Generting Dummy Event Headers') tree = DOM.parse(sClrEtwAllMan) incDir = os.path.dirname(os.path.realpath(clretwdummy)) if not os.path.exists(incDir): os.makedirs(incDir) + Clretwdummy = open(clretwdummy,'w') Clretwdummy.write(stdprolog + "\n") @@ -615,16 +618,21 @@ def generateEtmDummyHeader(sClrEtwAllMan,clretwdummy): eventNodes = providerNode.getElementsByTagName('event') #pal: create etmdummy.h Clretwdummy.write(generateclrEtwDummy(eventNodes, allTemplates) + "\n") - + Clretwdummy.close() -def generatePlformIndependentFiles(sClrEtwAllMan,incDir,etmDummyFile, testDir): +def generatePlformIndependentFiles(sClrEtwAllMan,incDir,etmDummyFile): + + generateEtmDummyHeader(sClrEtwAllMan,etmDummyFile) tree = DOM.parse(sClrEtwAllMan) + + if not incDir: + return + + print(' Generting Event Headers') if not os.path.exists(incDir): os.makedirs(incDir) - generateSanityTest(sClrEtwAllMan,testDir) - generateEtmDummyHeader(sClrEtwAllMan,etmDummyFile) clrallevents = incDir + "/clretwallmain.h" clrxplatevents = incDir + "/clrxplatevents.h" @@ -640,13 +648,12 @@ def generatePlformIndependentFiles(sClrEtwAllMan,incDir,etmDummyFile, testDir): templateNodes = providerNode.getElementsByTagName('template') allTemplates = parseTemplateNodes(templateNodes) eventNodes = providerNode.getElementsByTagName('event') - #vm header: + #vm header: Clrallevents.write(generateClrallEvents(eventNodes, allTemplates) + "\n") #pal: create clrallevents.h Clrxplatevents.write(generateClrXplatEvents(eventNodes, allTemplates) + "\n") - Clrxplatevents.close() Clrallevents.close() @@ -662,7 +669,7 @@ def parseExclusionList(exclusionListFile): for line in ExclusionFile: line = line.strip() - + #remove comments if not line or line.startswith('#'): continue @@ -703,7 +710,7 @@ def getStackWalkBit(eventProvider, taskName, eventSymbol, stackSet): if len(tokens) != 3: raise Exception("Error, possible error in the script which introduced the enrty "+ entry) - + eventCond = tokens[0] == eventProvider or tokens[0] == "*" taskCond = tokens[1] == taskName or tokens[1] == "*" symbolCond = tokens[2] == eventSymbol or tokens[2] == "*" @@ -740,7 +747,6 @@ def checkConsistency(sClrEtwAllMan,exclusionListFile): if not(fnParam and fnParam.winType == sLookupFieldType): raise Exception(exclusionListFile + ":No " + sLookupFieldName + " field of type " + sLookupFieldType + " for event symbol " + eventSymbol) - # If some versions of an event are on the nostack/stack lists, # and some versions are not on either the nostack or stack list, # then developer likely forgot to specify one of the versions @@ -754,7 +760,7 @@ def checkConsistency(sClrEtwAllMan,exclusionListFile): if ( not eventStackBitFromNoStackList) or ( not eventStackBitFromExplicitStackList): stackSupportSpecified[eventValue] = True else: - stackSupportSpecified[eventValue] = False + stackSupportSpecified[eventValue] = False else: # We've checked this event before. if stackSupportSpecified[eventValue]: @@ -778,11 +784,11 @@ def main(argv): help='full path to manifest containig the description of events') required.add_argument('--exc', type=str, required=True, help='full path to exclusion list') - required.add_argument('--inc', type=str, required=True, + required.add_argument('--inc', type=str, default=None, help='full path to directory where the header files will be generated') - required.add_argument('--dummy', type=str, required=True, + required.add_argument('--dummy', type=str,default=None, help='full path to file that will have dummy definitions of FireEtw functions') - required.add_argument('--testdir', type=str, required=True, + required.add_argument('--testdir', type=str, default=None, help='full path to directory where the test assets will be deployed' ) args, unknown = parser.parse_known_args(argv) if unknown: @@ -796,11 +802,8 @@ def main(argv): testDir = args.testdir checkConsistency(sClrEtwAllMan, exclusionListFile) - generatePlformIndependentFiles(sClrEtwAllMan,incdir,etmDummyFile,testDir) - + generatePlformIndependentFiles(sClrEtwAllMan,incdir,etmDummyFile) + generateSanityTest(sClrEtwAllMan,testDir) if __name__ == '__main__': return_code = main(sys.argv[1:]) sys.exit(return_code) - - - diff --git a/src/scripts/genXplatLttng.py b/src/scripts/genXplatLttng.py index fbabfb85ae..e1828ac8cb 100644 --- a/src/scripts/genXplatLttng.py +++ b/src/scripts/genXplatLttng.py @@ -48,8 +48,8 @@ ##) # -import os -from genXplatEventing import * +import os +from genXplatEventing import * stdprolog=""" // @@ -119,11 +119,11 @@ ctfDataTypeMapping ={ } def generateLttngHeader(providerName,allTemplates,eventNodes): - lTTngHdr = [] + lTTngHdr = [] for templateName in allTemplates.keys(): for subTemplate in allTemplates[templateName].allAbstractTemplateTypes: fnSig = allTemplates[templateName].getFnFrame(subTemplate) -#TP_ARGS +#TP_ARGS tp_args = [] tp_args_param = [] tp_args.append("\n#define ") @@ -131,23 +131,22 @@ def generateLttngHeader(providerName,allTemplates,eventNodes): tp_args.append('_TRACEPOINT_ARGS \\\n') tp_args.append('TP_ARGS(\\\n') - for params in fnSig.paramlist: fnparam = fnSig.getParam(params) wintypeName = fnparam.winType typewName = lttngDataTypeMapping[wintypeName] winCount = fnparam.count countw = lttngDataTypeMapping[winCount] - + tp_args_param.append(" ") tp_args_param.append(typewName) if countw != " ": tp_args_param.append(countw) - + tp_args_param.append(" ,") tp_args_param.append(fnparam.name) tp_args_param.append(",\\\n") - + if len(tp_args_param) > 0: del tp_args_param[-1] tp_args.extend(tp_args_param) @@ -161,7 +160,7 @@ def generateLttngHeader(providerName,allTemplates,eventNodes): tp_fields.append(" " + subTemplate + "_TRACEPOINT_ARGS,\n") tp_fields.append(" " + " TP_FIELDS(\n") #TP_FIELDS - + for params in fnSig.paramlist: fnparam = fnSig.getParam(params) wintypeName = fnparam.winType @@ -192,12 +191,11 @@ def generateLttngHeader(providerName,allTemplates,eventNodes): else: raise Exception("no such ctf intrinsic called: " + ctf_type) - tp_fields.append(" ") tp_fields.append(ctf_type + "(") tp_fields.extend(tp_fields_body) tp_fields.append(")\n") - + tp_fields.append(" )\n)\n") lTTngHdr.extend(tp_fields) @@ -240,7 +238,7 @@ TRACEPOINT_EVENT_INSTANCE(\\ lTTngHdr.append("T_TRACEPOINT_INSTANCE(") lTTngHdr.append(eventName +")\n") continue - + for subtemplate in allTemplates[templateName].allAbstractTemplateTypes: subevent = subtemplate; subevent = subevent.replace(templateName,'') @@ -253,7 +251,7 @@ TRACEPOINT_EVENT_INSTANCE(\\ lTTngHdr.append("#include <lttng/tracepoint-event.h>") return ''.join(lTTngHdr) - + def generateLttngTpProvider(providerName,eventNodes,allTemplates): lTTngImpl = [] for eventNode in eventNodes: @@ -270,7 +268,6 @@ def generateLttngTpProvider(providerName,eventNodes,allTemplates): fnptype.append("extern \"C\" ULONG FireEtXplat") fnptype.append(eventName) fnptype.append("(\n") - if templateName: for subtemplate in allTemplates[templateName].allAbstractTemplateTypes: @@ -281,12 +278,12 @@ def generateLttngTpProvider(providerName,eventNodes,allTemplates): typewName = palDataTypeMapping[wintypeName] winCount = fnparam.count countw = palDataTypeMapping[winCount] - + linefnptype.append(lindent) linefnptype.append(typewName) if countw != " ": linefnptype.append(countw) - + linefnptype.append(" ") linefnptype.append(fnparam.name) linefnptype.append(",\n") @@ -306,7 +303,7 @@ def generateLttngTpProvider(providerName,eventNodes,allTemplates): linefnbody = [] if templateName: - #emit code to init variables convert unicode to ansi string + #emit code to init variables convert unicode to ansi string for subtemplate in allTemplates[templateName].allAbstractTemplateTypes: fnSig = allTemplates[templateName].getFnFrame(subtemplate) for params in fnSig.paramlist: @@ -319,7 +316,7 @@ def generateLttngTpProvider(providerName,eventNodes,allTemplates): lTTngImpl.append(" INT " + paramname + "_full_name_path_size") lTTngImpl.append(" = WideCharToMultiByte( CP_ACP, 0, " + paramname + ", -1, NULL, 0, NULL, NULL );\n") lTTngImpl.append(" CHAR* " + paramname + "_full_name = NULL;\n") - + lTTngImpl.append("\n") #emit tracepoints @@ -348,7 +345,7 @@ def generateLttngTpProvider(providerName,eventNodes,allTemplates): #emit code to convert unicode to ansi string lTTngImpl.append(" "+ paramname + "_full_name = (CHAR*)malloc(") lTTngImpl.append(paramname + "_full_name_path_size*sizeof(CHAR));\n") - + lTTngImpl.append(" _ASSERTE("+paramname+ "_full_name != NULL);\n") lTTngImpl.append(" if(" + paramname + "_full_name == NULL){goto LExit;}\n\n") @@ -356,38 +353,38 @@ def generateLttngTpProvider(providerName,eventNodes,allTemplates): lTTngImpl.append(paramname + ", -1, ") lTTngImpl.append(paramname + "_full_name, ") lTTngImpl.append(paramname + "_full_name_path_size, NULL, NULL );\n") - + lTTngImpl.append(" _ASSERTE(" +paramname+ "_path_size == " ) lTTngImpl.append(paramname + "_full_name_path_size );\n") - + lTTngImpl.append(" if( " + paramname + "_path_size == 0 ){ Error = ERROR_INVALID_PARAMETER; goto LExit;}\n") - + vars_to_be_freed.append(paramname + "_full_name") - + linefnbody.append(paramname + "_full_name") linefnbody.append(",\n") continue - + elif ctf_type == "ctf_sequence" or wintypeName == "win:Pointer": linefnbody.append("(" + lttngDataTypeMapping[wintypeName]) if not lttngDataTypeMapping[winCount] == " ": linefnbody.append( lttngDataTypeMapping[winCount]) - + linefnbody.append(") ") - + linefnbody.append(paramname) linefnbody.append(",\n") - + if len(linefnbody) > 0 : del linefnbody[-1] linefnbody.append("\n );\n") - + else: linefnbody.append("\n tracepoint(\n") linefnbody.append(" "+providerName + ",\n") linefnbody.append(" "+eventName) linefnbody.append("\n );\n") - + lTTngImpl.extend(linefnbody) lTTngImpl.append(" Error = ERROR_SUCCESS;\n") @@ -398,36 +395,34 @@ def generateLttngTpProvider(providerName,eventNodes,allTemplates): lTTngImpl.append(" if ("+ var + " != NULL) {free(" ) lTTngImpl.append(var) lTTngImpl.append(");}\n") - + lTTngImpl.append("\nreturn Error;\n}\n") return ''.join(lTTngImpl) -def generateLttngFiles(etwmanifest,intermediate): +def generateLttngFiles(etwmanifest,eventprovider_directory): - tree = DOM.parse(etwmanifest) + eventprovider_directory = eventprovider_directory + "/" + tree = DOM.parse(etwmanifest) + + #keep these relative + tracepointprovider_directory = "tracepointprovider" + lttng_directory = "lttng" - if not os.path.exists(intermediate): - os.makedirs(intermediate) - - eventprovider_directory = intermediate + "/eventprovider/" - tracepointprovider_directory = eventprovider_directory + "/tracepointprovider" - lttng_directory = eventprovider_directory + "/lttng/" lttngevntprovPre = lttng_directory + "/eventprov" lttngevntprovTpPre = lttng_directory + "/traceptprov" if not os.path.exists(eventprovider_directory): os.makedirs(eventprovider_directory) - - if not os.path.exists(lttng_directory): - os.makedirs(lttng_directory) - - if not os.path.exists(tracepointprovider_directory): - os.makedirs(tracepointprovider_directory) + if not os.path.exists(eventprovider_directory + lttng_directory): + os.makedirs(eventprovider_directory + lttng_directory) + + if not os.path.exists(eventprovider_directory + tracepointprovider_directory): + os.makedirs(eventprovider_directory + tracepointprovider_directory) #Top level Cmake - topCmake = open(eventprovider_directory + "/CMakeLists.txt", 'w') + topCmake = open(eventprovider_directory + "CMakeLists.txt", 'w') topCmake.write(stdprolog_cmake + "\n") topCmake.write("""cmake_minimum_required(VERSION 2.8.12.2) @@ -450,37 +445,37 @@ def generateLttngFiles(etwmanifest,intermediate): providerName_File = providerName.replace('-','') providerName_File = providerName_File.lower() - + topCmake.write(' "'+ lttngevntprovPre + providerName_File + ".cpp" + '"\n') topCmake.write(""") add_subdirectory(tracepointprovider) - - # Install the static eventprovider library + + # Install the static eventprovider library install (TARGETS eventprovider DESTINATION lib) """) topCmake.close() #TracepointProvider Cmake - - tracepointprovider_Cmake = open(tracepointprovider_directory + "/CMakeLists.txt", 'w') - + + tracepointprovider_Cmake = open(eventprovider_directory + tracepointprovider_directory + "/CMakeLists.txt", 'w') + tracepointprovider_Cmake.write(stdprolog_cmake + "\n") tracepointprovider_Cmake.write("""cmake_minimum_required(VERSION 2.8.12.2) - + project(coreclrtraceptprovider) - + set(CMAKE_INCLUDE_CURRENT_DIR ON) - + add_definitions(-DPAL_STDCPP_COMPAT=1) include_directories(${COREPAL_SOURCE_DIR}/inc/rt) include_directories(../lttng/) add_compile_options(-fPIC) - + add_library(coreclrtraceptprovider SHARED """) - + for providerNode in tree.getElementsByTagName('provider'): providerName = providerNode.getAttribute('name') providerName = providerName.replace("Windows-",'') @@ -488,15 +483,15 @@ def generateLttngFiles(etwmanifest,intermediate): providerName_File = providerName.replace('-','') providerName_File = providerName_File.lower() - - tracepointprovider_Cmake.write(' "'+ lttngevntprovTpPre + providerName_File +".cpp" + '"\n') + + tracepointprovider_Cmake.write(' "../'+ lttngevntprovTpPre + providerName_File +".cpp" + '"\n') tracepointprovider_Cmake.write(""" ) - + target_link_libraries(coreclrtraceptprovider -llttng-ust ) - + #Install the static coreclrtraceptprovider library install (TARGETS coreclrtraceptprovider DESTINATION .) """) @@ -504,7 +499,7 @@ def generateLttngFiles(etwmanifest,intermediate): # Generate Lttng specific instrumentation for providerNode in tree.getElementsByTagName('provider'): - + providerName = providerNode.getAttribute('name') providerName = providerName.replace("Windows-",'') providerName = providerName.replace("Microsoft-",'') @@ -514,10 +509,9 @@ def generateLttngFiles(etwmanifest,intermediate): providerName = providerName.replace('-','_') lttngevntheadershortname = "tp" + providerName_File +".h"; - lttngevntheader = eventprovider_directory +"lttng/"+ lttngevntheadershortname - lttngevntprov = lttngevntprovPre + providerName_File + ".cpp" - lttngevntprovTp = lttngevntprovTpPre + providerName_File +".cpp" - + lttngevntheader = eventprovider_directory + "lttng/" + lttngevntheadershortname + lttngevntprov = eventprovider_directory + lttngevntprovPre + providerName_File + ".cpp" + lttngevntprovTp = eventprovider_directory + lttngevntprovTpPre + providerName_File +".cpp" lTTngHdr = open(lttngevntheader, 'w') lTTngImpl = open(lttngevntprov, 'w') @@ -528,10 +522,9 @@ def generateLttngFiles(etwmanifest,intermediate): lTTngTpImpl.write(stdprolog + "\n") lTTngTpImpl.write("\n#define TRACEPOINT_CREATE_PROBES\n") - - + lTTngTpImpl.write("#include \"./"+lttngevntheadershortname + "\"\n") - + lTTngHdr.write(""" #include "palrt.h" #include "pal.h" @@ -540,7 +533,6 @@ def generateLttngFiles(etwmanifest,intermediate): """) - lTTngHdr.write("#define TRACEPOINT_PROVIDER " + providerName + "\n") lTTngHdr.write(""" @@ -549,7 +541,6 @@ def generateLttngFiles(etwmanifest,intermediate): lTTngHdr.write("#define TRACEPOINT_INCLUDE \"./" + lttngevntheadershortname + "\"\n\n") - lTTngHdr.write("#if !defined(LTTNG_CORECLR_H" + providerName + ") || defined(TRACEPOINT_HEADER_MULTI_READ)\n\n") lTTngHdr.write("#define LTTNG_CORECLR_H" + providerName + "\n") @@ -560,8 +551,6 @@ def generateLttngFiles(etwmanifest,intermediate): #define TRACEPOINT_PROBE_DYNAMIC_LINKAGE """) lTTngImpl.write("#include \"" + lttngevntheadershortname + "\"\n\n") - - templateNodes = providerNode.getElementsByTagName('template') eventNodes = providerNode.getElementsByTagName('event') @@ -572,7 +561,7 @@ def generateLttngFiles(etwmanifest,intermediate): #create the implementation of eventing functions : lttngeventprov*.cp lTTngImpl.write(generateLttngTpProvider(providerName,eventNodes,allTemplates) + "\n") - + lTTngHdr.close() lTTngImpl.close() lTTngTpImpl.close() @@ -589,7 +578,7 @@ def main(argv): required.add_argument('--man', type=str, required=True, help='full path to manifest containig the description of events') required.add_argument('--intermediate', type=str, required=True, - help='full path to intermediate directory') + help='full path to eventprovider intermediate directory') args, unknown = parser.parse_known_args(argv) if unknown: print('Unknown argument(s): ', ', '.join(unknown)) @@ -603,4 +592,3 @@ def main(argv): if __name__ == '__main__': return_code = main(sys.argv[1:]) sys.exit(return_code) - |