Example #1
0
def analyze(libname):
    bkg_libs = loaded_libs()
    #print "::: bkg_libs:",map(os.path.basename, bkg_libs)
    vmem0, vmem1, libs = load_lib(libname)
    dVmemOffset = vmem1 - vmem0
    #print "vmem0=%s vmem1=%s libs=%s" % (vmem0, vmem1, len(libs))
    linked_libs = [
        os.path.basename(lib) for lib in libs
        if (not (lib in bkg_libs) and os.path.basename(lib) !=
            os.path.basename(libname) and os.access(lib, os.R_OK))
    ]

    #print "::: linked_libs:",linked_libs

    # load all linked-in libs
    def load_linked_in_libs(linked_libs):
        all_good = True
        for l in linked_libs:
            try:
                #print " - loading [%s]..." % l
                lib_loader(l)
            except Exception, err:
                print "** problem loading [%s]\n%s" % (l, err)
                all_good = False
                pass
        return all_good
Example #2
0
def analyze (libname):
    bkg_libs = loaded_libs()
    #print "::: bkg_libs:",map(os.path.basename, bkg_libs)
    vmem0,vmem1,libs = load_lib (libname)
    dVmemOffset = vmem1-vmem0
    #print "vmem0=%s vmem1=%s libs=%s" % (vmem0, vmem1, len(libs))
    linked_libs = [os.path.basename(lib)
                   for lib in libs
                   if (not (lib in bkg_libs) and
                       os.path.basename(lib) != os.path.basename(libname)
                       and os.access(lib, os.R_OK))]
    #print "::: linked_libs:",linked_libs

    # load all linked-in libs
    def load_linked_in_libs(linked_libs):
        all_good = True
        for l in linked_libs:
            try:
                #print " - loading [%s]..." % l
                lib_loader (l)
            except Exception, err:
                print "** problem loading [%s]\n%s" % (l,err)
                all_good = False
                pass
        return all_good
Example #3
0
def load_lib (libname):
    _,vmem0,_ = pymon()
    lib = lib_loader (libname)
    _,vmem1,_  = pymon()
    libs = [l for l in loaded_libs()
            if not os.path.basename(l) in _veto_libs and
            os.access(l, os.R_OK)]
    return (vmem0, vmem1, libs)
Example #4
0
def load_lib(libname):
    _, vmem0, _ = pymon()
    lib_loader(libname)
    _, vmem1, _ = pymon()
    libs = [
        l for l in loaded_libs()
        if not os.path.basename(l) in _veto_libs and os.access(l, os.R_OK)
    ]
    return (vmem0, vmem1, libs)
Example #5
0
def dep_libs(libname):
    """retrieve the list of dependencies of a given library
    both direct and indirect dependencies
    """
    bkg_libs = [os.path.basename(l) for l in loaded_libs()]
    bkg_libs = [l for l in bkg_libs if l not in _veto_libs]

    _, _, libs = load_lib(libname)
    libs = [os.path.basename(l) for l in libs]
    return [l for l in libs if l not in bkg_libs and l != libname]
Example #6
0
def dep_libs(libname):
    """retrieve the list of dependencies of a given library
    both direct and indirect dependencies
    """
    bkg_libs = [os.path.basename(l) for l in loaded_libs()]
    bkg_libs = [l for l in bkg_libs if l not in _veto_libs]

    _,_,libs = load_lib(libname)
    libs = [os.path.basename(l) for l in libs]
    return [l for l in libs if l not in bkg_libs and l!=libname]
Example #7
0
def analyze(libname):
    bkg_libs = loaded_libs()
    #print ("::: bkg_libs:",map(os.path.basename, bkg_libs))
    vmem0, vmem1, libs = load_lib(libname)
    dVmemOffset = vmem1 - vmem0
    #print ("vmem0=%s vmem1=%s libs=%s" % (vmem0, vmem1, len(libs)))
    linked_libs = [
        os.path.basename(lib) for lib in libs
        if (not (lib in bkg_libs) and os.path.basename(lib) !=
            os.path.basename(libname) and os.access(lib, os.R_OK))
    ]

    #print ("::: linked_libs:",linked_libs)

    # load all linked-in libs
    def load_linked_in_libs(linked_libs):
        all_good = True
        for l in linked_libs:
            try:
                #print (" - loading [%s]..." % l)
                lib_loader(l)
            except Exception as err:
                print("** problem loading [%s]\n%s" % (l, err))
                all_good = False
                pass
        return all_good

    #print ("--> loading all linked-in libs...")
    NRETRY = 10
    for _ in range(NRETRY):
        ok = load_linked_in_libs(linked_libs)
        if ok:
            break
    else:
        print("** err: could not reliably load all libs (after %s retries)" %
              NRETRY)

    #print ("--> loading all linked-in libs... [done]")

    vmem0, vmem1, libs = load_lib(libname)
    #print ("vmem0=%s vmem1=%s libs=%s" % (vmem0, vmem1, len(libs)))
    dVmemLib = vmem1 - vmem0
    return (dVmemLib, dVmemOffset, len(linked_libs), len(bkg_libs))