Esempio n. 1
0
def verify(analyzer, project, trace):
  # Can't do much without API metadata
  if not "code" in project.targets:
    return

  library     = project.targets["code"].library
  task        = Task.startTask("verify", "Verifying trace", len(trace.events))
  result      = True
  paramMap    = {}
  
  for event in trace.events:
    if not event.name in library.functions:
      analyzer.reportWarning("Function '%s' not found in library." % event.name)
      result = False
      continue
    func = library.functions[event.name]

    for name in event.values:
      if name is None:
        continue
      if not name in func.parameters:
        analyzer.reportWarning("Function '%s' parameter '%s' not found in library." % (event.name, name))
        result = False
        tag = "%s.%s" % (event.name, name)
        if not tag in paramMap:
          paramMap[tag] = Console.choose("Please choose the correct parameter", func.parameters.keys())
        if paramMap[tag]:
          newName = paramMap[tag]
          event.values[newName] = event.values[name]
          del event.values[name]

  return result
Esempio n. 2
0
def main(args):
  # Parse the command line options
  options, args = Options.parseCommandLine(args)
  
  if options.verbose:
    Log.quiet = False

  if options.quiet:
    Log.quiet = True
    
  # If a project file was not given, present the possibilities
  if not options.project:
    projectFiles = getAvailableProjectFiles()
    try:
      projectFile = projectFiles[Console.chooseIndex("Choose a project file", [f[1] for f in projectFiles])][0]
    except TypeError:
      return
  else:
    projectFile = options.project

  # Read the project file
  project = Project.Project(options = options, fileName = projectFile)

  # Create the interactive analyzer  
  analyzer = Analyzer.InteractiveAnalyzer(project, options)
  
  if options.execute:
    for command in options.execute:
      try:
        analyzer.execute(command)
      except Analyzer.ExecutionError:
        return 1

  analyzer.run()
  return 0
Esempio n. 3
0
def main(args):
    # Parse the command line options
    options, args = Options.parseCommandLine(args)

    if options.verbose:
        Log.quiet = False

    if options.quiet:
        Log.quiet = True

    # If a project file was not given, present the possibilities
    if not options.project:
        projectFiles = getAvailableProjectFiles()
        try:
            projectFile = projectFiles[Console.chooseIndex(
                "Choose a project file", [f[1] for f in projectFiles])][0]
        except TypeError:
            return
    else:
        projectFile = options.project

    # Read the project file
    project = Project.Project(options=options, fileName=projectFile)

    # Create the interactive analyzer
    analyzer = Analyzer.InteractiveAnalyzer(project, options)

    if options.execute:
        for command in options.execute:
            try:
                analyzer.execute(command)
            except Analyzer.ExecutionError:
                return 1

    analyzer.run()
    return 0
Esempio n. 4
0
 def taskFinished(self, task):
   Console.eraseProgressBar()
Esempio n. 5
0
 def taskProgress(self, task):
   Console.printProgressBar(task, self.colorizer)
Esempio n. 6
0
 def taskFinished(self, task):
     Console.eraseProgressBar()
Esempio n. 7
0
 def taskProgress(self, task):
     Console.printProgressBar(task, Console.colorizer)