import sys
import os


class DisassProgramHEADERS:
	header = []
	table = []
	parent = None
	
	def __init__(self,filename,parent):
		self.parent = parent
		self.init(os.popen('objdump -p %s'%(filename)).readlines())
	
	def __str__(self):
		string = ""
		for i in self.table:
			string += "%s"%(i.strip())
			if (i.find(" off   ")>=0):
				string += "\t"
			else:
				string += "\n"
		return string
		
	def init(self,lines):
		self.header = lines[0:4]
		self.table = lines[4:]
		
	def printTXT(self,outfile=sys.stdout):
		print >>outfile,("\n\nPROGRAM HEADERS:")
		print >>outfile,(self)
