Example #1
0
def generateCode(func, trace):
	compiler = application.context.CompilerContext(None)
	extractor = Extractor(compiler)
	compiler.extractor = extractor

	f = extractor.decompileFunction(func, trace)
	#f = decompile(func, trace)

	sio = StringIO()
	scg = SimpleCodeGen(sio)
	scg.process(f)
	return sio.getvalue()
Example #2
0
def generateCode(func, trace):
    compiler = application.context.CompilerContext(None)
    extractor = Extractor(compiler)
    compiler.extractor = extractor

    f = extractor.decompileFunction(func, trace)
    # f = decompile(func, trace)

    sio = StringIO()
    scg = SimpleCodeGen(sio)
    scg.process(f)
    return sio.getvalue()
Example #3
0
def evaluateCode(compiler, prgm, node, outputAnchors=None):
	assert node.isCode(), type(node)

	try:
		fold.evaluateCode(compiler, prgm, node)

		# Can't process arbitrary abstract code nodes.
		if node.isStandardCode():
			dce.evaluateCode(compiler, node, outputAnchors)

	except InternalError:
		print
		print "#######################################"
		print "Function generated an internal error..."
		print "#######################################"
		sio = StringIO()
		scg = SimpleCodeGen(sio)
		scg.process(node)
		print sio.getvalue()
		raise