Exemplo n.º 1
0
	def __init__(self, localfiles, appname):
		self._appname = appname
		self._gdbserver_process = None
		self._tmpcommandfile = None
		self._pid = GetPID(self._appname)
		if self._pid < 0:
			raise Exception('No such process')
		self._modules = {}
		self._modcache = ModCache(localfiles)
		self._pull_modules()
		# Generate the add-symbol-file commands
		(fd, self._tmpcommandfile) = tempfile.mkstemp()
		os.close(fd)
		cmdfile = open(self._tmpcommandfile, 'w')
		for (modname, mod) in self._modules.items():
			localpath = self._modcache.get(modname)
			base = mod.get_base()
			offset = mod.textoffset
			if base is not None and offset is not None:
				print >> cmdfile, 'add-symbol-file %s 0x%x' % (localpath.replace('\\', '/'), base + offset)
		print >> cmdfile, 'target remote :9999'
		cmdfile.close()
		# Run gdbserver
		self._run_gdbserver()
		# Launch gdb, passing it the cmdfile
		args = ['cmd', '/C', 'start', '/WAIT', 'arm-linux-androideabi-gdb', '-x', self._tmpcommandfile]
		self._gdb_process = subprocess.Popen(args)
		self._gdb_process.wait()
Exemplo n.º 2
0
    def __init__(self, localfiles, profiledatafile):
        self._modcache = ModCache(localfiles)
        self._modules = {}
        self._symcache = {}
        self._linecache = {}
        self._vmacache = {}
        self._demangler = Demangler()
        self._demanglecache = {}
        self._modhitcounter = HitCounter()
        self._vmahitcounter = HitCounter()
        self._symhitcounter = HitCounter()
        self._combinedhitcounter = HitCounter()

        self._parseprofile(profiledatafile)
        self._buildhits()