本文整理汇总了Python中common.Log.debug方法的典型用法代码示例。如果您正苦于以下问题:Python Log.debug方法的具体用法?Python Log.debug怎么用?Python Log.debug使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类common.Log
的用法示例。
在下文中一共展示了Log.debug方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: process
# 需要导入模块: from common import Log [as 别名]
# 或者: from common.Log import debug [as 别名]
def process(self, fileName, includeMacros = False):
"""
Process the macro declarations present in a file and return the resulting string.
@param fileName: Name of file to parse
@param includeMacros: Pass True to include the preprocessor macros in the output
"""
cmd = [self.binary]
if self.arguments:
cmd.append(self.arguments)
if includeMacros:
cmd.append("-dD")
# Don't include predefined macros
cmd.append("-undef")
for macro, value in self.config.get("macros", {}).items():
cmd.append("-D%s=%s" % (macro, value))
if self.platform.name in self.config:
plat = self.config[self.platform.name]
for lib in plat.get("includedirs", []):
cmd.append("-I")
cmd.append(lib)
for macro, value in plat.get("macros", {}).items():
cmd.append("-D%s=%s" % (macro, value))
cmd.append(fileName)
if self.options.verbose:
Log.debug("Running preprocessor: " + " ".join(cmd))
p = subprocess.Popen(cmd, stdout = subprocess.PIPE)
return p.stdout.read()
示例2: loadHooks
# 需要导入模块: from common import Log [as 别名]
# 或者: from common.Log import debug [as 别名]
def loadHooks(self):
target = self.target
config = self.target.config
lib = self.target.library
platform = self.target.project.platform
# Collect hooks in various locations
for fileName in config.get("hooks", []):
Log.notice("Parsing hooks from '%s'." % fileName)
source = self.readSource(fileName)
functions = Parser.parseSource(source).functions.values()
if not functions:
Log.warn("No hooks found.")
for f in functions:
Log.debug("%s %s(%s)" % (f.type, f.name, ", ".join(["%s %s" % (t.type, p) for p, t in f.parameters.items()])))
for function in functions:
if not function.body:
Log.warn("Hook function '%s' has no body." % function.name)
continue
if function.name.startswith("@"):
lib.hooks[function.name] = function.body
continue
else:
try:
name, hookName = function.name.split(".", 1)
if not name in lib.functions:
target.fail("Function '%s' referred by hook function '%s' does not exist." % (name, function.name))
if not hookName.startswith("@") and not hookName in lib.functions[name].parameters:
target.fail("Parameter '%s' referred by hook function '%s' does not exist." % (hookName, function.name))
lib.functions[name].hooks[hookName] = function.body
except ValueError:
target.fail("Hook function name '%s' is not valid." % function.name)
示例3: reportDebug
# 需要导入模块: from common import Log [as 别名]
# 或者: from common.Log import debug [as 别名]
def reportDebug(self, msg):
for line in str(msg).rstrip().split("\n"):
Log.debug(line)
示例4: prepare
# 需要导入模块: from common import Log [as 别名]
# 或者: from common.Log import debug [as 别名]
def prepare(self):
# Shorthand for various objects
config = self.config
lib = self.library
# Parse the sources
for fileName in config.get("apiheaders", []):
Log.notice("Parsing functions from '%s'." % fileName)
source = self.parserTool.readSource(fileName)
newLib = Parser.parseSource(source)
for f in newLib.functions.values():
f.headerName = fileName
for f in newLib.functions.values():
Log.debug("%s %s(%s)" % (f.type, f.name, ", ".join(["%s %s" % (t.type, p) for p, t in f.parameters.items()])))
if not newLib.functions:
Log.warn("No new functions found.")
else:
Log.notice("%d functions found." % len(newLib.functions))
lib.merge(newLib)
# Load the hooks
self.parserTool.loadHooks()
def parseBool(s):
return bool(int(s))
# Read the typemap
for typeDecl, mapping in self.config.types.items():
attrs = self.config.types[typeDecl].attrs
name, type = Parser.parseVariableDeclaration(typeDecl + " dummy")
assert name == "dummy"
# If this is a class mapping, create the class if it doesn't already exist
if mapping == "object":
if not mapping in self.library.classes:
cls = Library.Class(type)
if "namespace" in attrs:
cls.namespacePath = attrs["namespace"].split(".")
self.library.classes[type] = cls
# Patch the default decoration hint into all matching types
if "decorationhint" in attrs:
for function in self.library.functions.values():
for t in [p.type for p in function.parameters.values()] + [function.type]:
if t == type:
t.decorationHint = attrs["decorationhint"]
self.library.typeMap[type] = str(mapping)
# Patch in some function-specific attributes
for function in config.functions.keys():
if not function in lib.functions:
self.fail("Attributes specified for non-existent function '%s'." % function)
attrs = config.functions[function].attrs
if "terminator" in attrs:
lib.functions[function].isTerminator = parseBool(attrs["terminator"])
if "generate" in attrs:
lib.functions[function].generate = parseBool(attrs["generate"])
if "runtimestate" in attrs:
lib.functions[function].runtimeStateTracking = parseBool(attrs["runtimestate"])
if "framemarker" in attrs:
lib.functions[function].isFrameMarker = parseBool(attrs["framemarker"])
if "staticlinkage" in attrs:
lib.functions[function].staticLinkage = parseBool(attrs["staticlinkage"])
if "rendercall" in attrs:
lib.functions[function].isRenderCall = parseBool(attrs["rendercall"])
if "passthrough" in attrs:
lib.functions[function].passthrough = parseBool(attrs["passthrough"])
if not isinstance(config.functions[function], Config.Group):
self.fail("Syntax error: State map definition for function '%s' is missing braces." % function)
# Argument to state mapping
reservedNames = ["@return", "@modify", "@set", "@get", "@copy"]
funcAttrs = attrs
for arg, parameter in config.functions[function].items():
# Check that this is a valid parameter
if not arg in reservedNames and not arg in lib.functions[function].parameters:
self.fail("State mapping for nonexistent parameter '%s' of function '%s' specified." % (arg, function))
if arg in ["@copy"] and parseBool(funcAttrs.get("runtimestate", "0")):
Log.warn("Function %s state relation %s not implemented for runtime state tracking." % (function, arg))
# Read the parameter-specific attributes
attrs = config.functions[function][arg].attrs
if "decoration" in attrs:
lib.functions[function].parameters[arg].decoration = attrs["decoration"]
if "decorationhint" in attrs:
lib.functions[function].parameters[arg].decorationHint = attrs["decorationhint"]
if "out" in attrs:
lib.functions[function].parameters[arg].isOut = parseBool(attrs["out"])
if "object_class" in attrs:
# Create a function-local type so that this parameter type is an object only for this function
if arg == "@return":
type = lib.functions[function].type
else:
type = lib.functions[function].parameters[arg].type
# Override the type's name so that it will refer to the new object class
# while still using the original C type under the hood
newType = copy.deepcopy(type)
newType.isObject = True
newType.name = attrs["object_class"]
if arg == "@return":
#.........这里部分代码省略.........
示例5: loadSymbolMap
# 需要导入模块: from common import Log [as 别名]
# 或者: from common.Log import debug [as 别名]
def loadSymbolMap(self):
config = self.config
lib = self.library
demangler = Tools.SymbolDecoder(config)
# Set default library name
if "library" in config:
for function in lib.functions.values():
function.libName = config.library
# Read in the export ordinals
if "deffiles" in config:
for defFile in config.deffiles:
for function, ordinal in Parser.parseDefFile(open(config.getRelativePath(defFile)).read()):
if function in lib.functions:
lib.functions[function].exportOrdinal = ordinal
Log.debug("%s is exported at %d" % (function, ordinal))
# The function was not found in the library, so let's check whether it is a C++ symbol
elif demangler.isMangled(function):
function = demangler.decode(function)
if function in lib.functions:
# Save the ordinal and mark the function as C++
lib.functions[function].exportOrdinal = ordinal
lib.functions[function].language = "c++"
Log.debug("%s is exported at %d" % (function, ordinal))
# Read the link ordinals and DLL information
if "symbol_map" in config:
defaultLibName = None
for fileName, libName in config.symbol_map.items():
if fileName == "default":
defaultLibName = libName
continue
# Is it a .DEF file
if fileName.endswith(".def"):
for function, ordinal in Parser.parseDefFile(open(config.getRelativePath(fileName)).read()):
if function in lib.functions:
lib.functions[function].ordinal = ordinal
lib.functions[function].libName = libName
Log.debug("%s is at %s:%d" % (function, libName, ordinal))
# The function was not found in the library, so let's check whether it is a C++ symbol
elif demangler.isMangled(function):
function = demangler.decode(function)
if function in lib.functions:
# Save the ordinal and mark the function as C++
lib.functions[function].ordinal = ordinal
lib.functions[function].libName = libName
lib.functions[function].language = "c++"
Log.debug("%s is at %s:%d" % (function, libName, ordinal))
else: # it's a header file
assert fileName.endswith(".h")
for function in lib.functions.values():
if function.headerName == fileName:
function.libName = libName
# Generate passthrough functions for internal symbols
if defaultLibName:
assert self.project.platform.requireOrdinals, "Default symbol mapping can only be used in platforms that use symbol ordinals"
assert "max_internal_ordinal" in config, "max_internal_ordinal must be defined when using a default symbol mapping"
ordinals = range(1, int(config["max_internal_ordinal"]) + 1)
for function in lib.functions.values():
if function.exportOrdinal in ordinals:
ordinals.remove(function.exportOrdinal)
for ordinal in ordinals:
name = "_trInternal%d" % ordinal
f = Library.Function(name, Library.Type("void"))
f.language = "c"
f.ordinal = ordinal
f.exportOrdinal = ordinal
f.libName = defaultLibName
lib.functions[name] = f
Log.debug("%s is at %s:%d" % (name, defaultLibName, ordinal))
示例6: generate
# 需要导入模块: from common import Log [as 别名]
# 或者: from common.Log import debug [as 别名]
def generate(templatePath, outputPath):
Log.debug("Generating %s" % (outputPath[-1]))
Generator.generate(templates = [Resource.getPath(*templatePath)],
namespace = namespace,
outputFile = open(os.path.join(*outputPath), "w"))