All pastes #943953 Raw Edit

Untitled

public python v1 · immutable
·published 2008-03-15 18:54 UTC
rendered paste body
# Copyleft 2008 Cody Brocious -- No rights reserved.  Do with it what you want.import sysdef Main():	section = None		print 'static main(void) {'	for line in sys.stdin.readlines():		line = line.rstrip()		if not line:			continue				if line.startswith('  '):			_, addrs, name = line.split('  ')			orig, size, final = addrs.split(' ')			unk, name = name.split(' ', 1)			try:				name, object = name.split(' \t')			except:				pass						final = long('0x%s' % final, 16)			end = final + long('0x%s' % size, 16)						print '\tMakeNameEx(0x%08x, "%s", 0);' % (final, name.split('(', 1)[0])			if section == '.text':				print '\tMakeCode(0x%08x);' % final				print '\tMakeFunction(0x%08x, 0x%08x);' % (final, end)		elif line.endswith('section layout'):			section, _ = line.split(' ', 1)		else:			raise Exception('Unknown line %r', line)	print '}'if __name__=='__main__':	Main()