Source code for mcgdb.toolbox.target.access.local

import gdb
import os
import subprocess 

[docs]def init(my_gdb_pkg): pass
[docs]def access(path, mode): return os.access(path, mode)
[docs]def exists(path): return os.exists(path)
[docs]def listdir(path): return os.listdir(path)
[docs]class path: def __init__(self): pass @staticmethod
[docs] def exists(path): return os.path.exists(path)
F_OK = os.F_OK
[docs]class Popen(): def __init__(self, args): self.proc = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
[docs] def communicate(self): return self.proc.communicate()
def __getattr__(self, name): if name in ["returncode", "pid"]: return getattr(self.proc, name) else: raise AttributeError("Can't access attribute '%s' of subprocess" % name)
[docs]class Fopen: def __init__(self, path, mode): self.file = open(path, mode)
[docs] def readlines(self): return self.file.readlines()
[docs]def do_attach(pid): gdb.execute ("attach %s" % pid, to_string=True)