#------------------------------------------------------------------------------------------------------- # Copyright (C) Microsoft. All rights reserved. # Licensed under the MIT license. See LICENSE.txt file in the project root for full license information. #------------------------------------------------------------------------------------------------------- import xml.dom.minidom as DOM lttngDataTypeMapping = { "win:null" :" ", "win:Int64" :"const __int64", "win:ULong" :"const unsigned long", "win:count" :"*", "win:Struct" :"const char *", "win:GUID" :"const int", "win:AnsiString" :"const char*", "win:UnicodeString" :"const char*", "win:Double" :"const double", "win:Int32" :"const signed int", "win:HexInt32" :"const signed int", "win:Boolean" :"const bool", "win:UInt64" :"const unsigned __int64", "win:UInt32" :"const unsigned int", "win:UInt16" :"const unsigned short", "win:UInt8" :"const unsigned char", "win:Int8" :"const char", "win:Pointer" :"const uintptr_t", "win:Binary" :"const char" } ctfDataTypeMapping = { "win:Int64" :"ctf_integer", "win:HexInt64" :"ctf_integer_hex", "win:ULong" :"ctf_integer", "win:count" :"ctf_sequence", "win:Struct" :"ctf_sequence", "win:GUID" :"ctf_sequence", "win:AnsiString" :"ctf_string", "win:UnicodeString" :"ctf_string", "win:Double" :"ctf_float", "win:Int32" :"ctf_integer", "win:HexInt32" :"ctf_integer_hex", "win:Boolean" :"ctf_integer", "win:UInt64" :"ctf_integer", "win:UInt32" :"ctf_integer", "win:UInt16" :"ctf_integer", "win:HexInt16" :"ctf_integer_hex", "win:UInt8" :"ctf_integer", #actually a character "win:Int8" :"ctf_integer", #actually a character "win:Pointer" :"ctf_integer", "win:Binary" :"ctf_sequence", "xs:string" :"ctf_string", "xs:unsignedLong" :"ctf_integer", "xs:unsignedInt" :"ctf_integer" } palDataTypeMapping ={ "win:null" :" ", "win:Int64" :"const __int64", "win:ULong" :"const unsigned long", "win:count" :"*", "win:Struct" :"const void", "win:GUID" :"const GUID", "win:AnsiString" :"LPCSTR", "win:UnicodeString" :"PCWSTR", "win:Double" :"const double", "win:Int32" :"const signed int", "win:HexInt32" :"const signed int", "win:Boolean" :"const bool", "win:UInt64" :"const unsigned __int64", "win:UInt32" :"const unsigned int", "win:UInt16" :"const unsigned short", "win:UInt8" :"const unsigned char", "win:Int8" :"const char", "win:Pointer" :"const void*", "win:Binary" :"const char" } MAX_LTTNG_ARGS = 10 def getParamSequenceSize(paramSequence, estimate): total = 0 pointers =0 for param in paramSequence: if param in ["win:Int64", "win:UInt64", "win:Double"]: total += 8 elif param in ["win:ULong", "win:Int32", "win:Boolean",]: total += 4 elif param == "GUID": total += 16 elif param in ["win:UInt16"]: total += 2 elif param in ["win:Uint8", "win:Binary"]: total += 1 elif param == "win:Pointer": if estimate: total += 8 else: pointers += 1 elif estimate: if param in ["win:AnsiString", "win:Struct"]: total += 32 elif param in ["win:UnicodeString"]: total += 64 else: raise Exception ("Don't know size of " + param) if estimate: return total return total, pointers class Template: def __repr__(self): return "