@@ -0,0 +1,2555 @@
+#!/usr/bin/env python%0A# vim: set sw=2 ts=2 softtabstop=2 expandtab:%0A%22%22%22%0AThis script is designed to patch old symbooglix%0Aresults where hitting speculative paths was incorrect%0Atreated as BOUND_HIT%0A%22%22%22%0Aimport argparse%0Aimport os%0Aimport logging%0Aimport sys%0Aimport yaml%0Afrom br_util import FinalResultType, classifyResult%0A%0Atry:%0A  # Try to use libyaml which is faster%0A  from yaml import CLoader as Loader, CDumper as Dumper%0Aexcept ImportError:%0A  # fall back on python implementation%0A  from yaml import Loader, Dumper%0A%0Adef main(args):%0A  parser = argparse.ArgumentParser()%0A  parser.add_argument(%22-l%22,%22--log-level%22,type=str, default=%22info%22, dest=%22log_level%22, choices=%5B'debug','info','warning','error'%5D)%0A  parser.add_argument('input_yml', type=argparse.FileType('r'))%0A  parser.add_argument('output_yml', type=str)%0A  pargs = parser.parse_args(args)%0A%0A  logLevel = getattr(logging, pargs.log_level.upper(),None)%0A  logging.basicConfig(level=logLevel)%0A%0A  if os.path.exists(pargs.output_yml):%0A    logging.error('Refusing to overwrite %22%7B%7D%22'.format(pargs.output_yml))%0A    return 1%0A%0A  results = yaml.load(pargs.input_yml, Loader=Loader)%0A%0A  assert isinstance(results, list)%0A%0A  if len(results) == 0:%0A    logging.error('Result list is empty')%0A    return 1%0A%0A  # Count%0A  rewriteCount = 0%0A  rTypeToResultMap = %7B%7D%0A  for rType in FinalResultType:%0A    rTypeToResultMap%5BrType%5D = %5B%5D%0A%0A  for r in results:%0A    rType = classifyResult(r)%0A    logging.debug('Classified %7B%7D as %7B%7D'.format(r%5B'program'%5D, rType))%0A%0A    if rType == FinalResultType.BOUND_HIT:%0A      logging.info('Classified %7B%7D as %7B%7D'.format(r%5B'program'%5D, rType))%0A      logging.info('Doing rewrite')%0A      rewriteCount += 1%0A%0A      # Sanity checks%0A      assert r%5B'failed'%5D == False%0A      assert r%5B'bound_hit'%5D == True%0A      assert r%5B'speculative_paths_nb'%5D == True%0A%0A      # Set new values%0A      r%5B'failed'%5D = True%0A      r%5B'bound_hit'%5D = False%0A%0A      assert classifyResult(r) == FinalResultType.UNKNOWN%0A%0A    rTypeToResultMap%5BclassifyResult(r)%5D.append(r)%0A%0A  print(%22Rewrite count: %7B%7D%22.format(rewriteCount))%0A%0A  print(%22Total: %7B%7D%22.format(len(results)))%0A  for rType in FinalResultType:%0A    name = rType.name%0A    resultList = rTypeToResultMap%5BrType%5D%0A    print(%22# of %7B%7D: %7B%7D (%7B:.2f%7D%25)%22.format(name, len(resultList),%0A      100*float(len(resultList))/len(results)))%0A%0A  # Write result out%0A  with open(pargs.output_yml, 'w') as f:%0A    yamlText = yaml.dump(results,%0A                         default_flow_style=False,%0A                         Dumper=Dumper)%0A    f.write(yamlText)%0A%0A  return 0%0A%0Aif __name__ == '__main__':%0A  sys.exit(main(sys.argv%5B1:%5D))%0A

Add script to patch old symbooglix results when boogie-runner classified hitting speculative paths as BOUND_HIT. This was a bad idea so this script changes those results to UNKNOWN but note we have the ``speculative_paths_nb`` attribute so that can be used to find the results where symbooglix hit speculative paths.