spliced.predict.smeagle package

Submodules

spliced.predict.smeagle.asp module

class spliced.predict.smeagle.asp.AspFunction(name, args=None)[source]

Bases: object

An asp function

symbol(positive=True)[source]
class spliced.predict.smeagle.asp.AspFunctionBuilder[source]

Bases: object

class spliced.predict.smeagle.asp.PyclingoDriver(cores=True, out=None)[source]

Bases: object

devnull()[source]
fact(head)[source]

ASP fact (a rule without a body).

h1(name)[source]
h2(name)[source]
newline()[source]
solve(setup, nmodels=0, stats=False, logic_programs=None, facts_only=False)[source]

Run the solver for a model and some number of logic programs

title(name, char)[source]
class spliced.predict.smeagle.asp.Result(asp=None)[source]

Bases: object

Result of an ASP solve.

spliced.predict.smeagle.smeagle module

class spliced.predict.smeagle.smeagle.SmeagleRunner[source]

Bases: object

compatible_test(lib, lib_set, lookup, detail=False, out=None)[source]

A set test scopes a library A (lib) to be compared against its space of dependencies (lib_set). To properly scope the output list of facts, we take a lookup that has key (the library facts json to load) and value as the set of symbols to include in the model

generate_facts(lib=None, data=None, out=None, lib_basename=False, namespace=None)[source]

Generate facts for one entry.

get_smeagle_data(lib=None, data=None)[source]

Get smeagle data

load_data(lib=None, data=None)[source]

Common function to derive json data and a library. Each is optional to be provided, and we are flexible to accept either.

stability_test(lib1, lib2, data1=None, data2=None, out=None)[source]

Run the stability test for two entries.

spliced.predict.smeagle.solver module

class spliced.predict.smeagle.solver.FactGenerator(lib, out=None, lib_basename=False, namespace=None)[source]

Bases: SolverBase

Class to orchestrate fact generation (uses FactGeneratorSetup)

solve()[source]

Generate facts

class spliced.predict.smeagle.solver.FactGeneratorSetup(lib, lib_basename=False, namespace=None)[source]

Bases: GeneratorBase

Class to accept one library and generate facts.

setup(driver)[source]

Setup to prepare for the solve. This base function provides fact generation for one library.

class spliced.predict.smeagle.solver.GeneratorBase[source]

Bases: object

The GeneratorBase is the base for any kind of Setup (fact generator or solve) Base functions to set up an ABI Stability and Compatability Solver.

add_library(lib, identifier=None, symbols=None)[source]

Given a loaded Smeagle Model, generate facts for it.

If an identifier is given we are doing a comparison / diff between two libraries, and this is akin to a namespace, usually A and B. Otherwise we just output facts without one.

add_location(libname, func, direction, param_type, location)[source]

Convenience function to print a location, ensuring to add identifier if defined

generate_function(lib, func, identifier=None, callsite=False, symbols=None)[source]

Generate facts for a function

generate_variable(lib, var, identifier=None, symbols=None)[source]

Generate facts for a variable

lib_basename = False
parse_aggregate(param, param_type, original, libname, top_name, variable=False, direction=None)[source]

Parse a struct or a class (and maybe union)

parse_aggregate_by_value(param, libname, top_name, direction)[source]

Parse an aggregate by value.

When it’s by value the parser cle has already provided registers and we don’t need to worry about offsets

parse_array(param, param_type, libname, top_name, variable=False, direction=None)[source]

Parse a struct or a class (and maybe union)

abi_typelocation(“example”,”_Z3fooiPP7Structy”,”Import”,”Array[5]”,”((%rsi))”).

parse_empty_struct(libname, top_name, param, variable=False)[source]

Make up a fact for an empty struct

parse_opaque(param, libname, top_name, direction)[source]

Parse an opaque (recursive) type

parse_type(param, libname, top_name, variable=False, offset_added=False, direction=None)[source]

Top level function to parse an underlying type fact.

unwrap_immediate_type(func)[source]

Unwrap the type just one level

unwrap_location(param)[source]

Unwrap the type

unwrap_type(func)[source]

Unwrap the type

class spliced.predict.smeagle.solver.SolverBase[source]

Bases: object

Common base functions for some kind of solver. For stability, compatibility, or just fact generation.

print(data, title)[source]

Print a result to the terminal

setup(driver)[source]

Setup to prepare for the solve.

class spliced.predict.smeagle.solver.StabilitySetSolver(libA, libsB, lookup, out=None)[source]

Bases: StabilitySolver

Class to orchestrate a Stability Set Solver.

class spliced.predict.smeagle.solver.StabilitySetSolverSetup(libA, libsB, symbols)[source]

Bases: GeneratorBase

Class to set up and run an ABI Stability and Compatability Solver using one library A, a set of symbols for it, and a set of dependency libraries B, under namespace B, also each with symbols.

setup(driver)[source]

Setup to prepare for the solve. This function overrides the base setup, which will generate facts only for one function.

class spliced.predict.smeagle.solver.StabilitySolver(lib1, lib2, out=None)[source]

Bases: SolverBase

Class to orchestrate a Stability Solver.

solve(logic_programs, detail=True)[source]

Run the solve

class spliced.predict.smeagle.solver.StabilitySolverSetup(lib1, lib2)[source]

Bases: GeneratorBase

Class to set up and run an ABI Stability and Compatability Solver.

setup(driver)[source]

Setup to prepare for the solve. This function overrides the base setup, which will generate facts only for one function.

Module contents

class spliced.predict.smeagle.SmeaglePrediction[source]

Bases: Prediction

check_missing_symbols(splice, lib)[source]

Ensure no missing symbols as determined by elfcall off the bat.

compatibility_test_lib(splice, lib, facts_path)[source]

Given an initial library (lib) that we have facts (facts_path) for, use the splice lookup to derive the exact dependency libraries (and set of symbols) that are needed. IF a dependency library fails to generate facts, we simply don’t include its symbols. We do this so we can still make a prediction on imperfect information.

generate_smeagle_data(lib, prefix='smeagle')[source]

Given a library, run smeagle to generate facts and save to cache. Return key.

predict(splice, predict_type=None)[source]

Run smeagle to add to the predictions # Testing command: # spliced splice –package swig@3.0.8 –splice pcre –runner spack –replace pcre –experiment experiment

  1. splice is going to have libraries found and symbols and imported missing

  2. If any imported missing, record splice fail (we need all the symbols)

  3. Get list of associated paths from elfcall, generate facts for each

  • try to mamke cache based on the library fullpath

  1. After facts are generated, spliced->smeagle runner should:

  • generate asp facts for main lib/binary for all symbols in the union set across dependencies

  • for each dependency, only genderate asp facts for the symbols that come from it

  1. An entirely new ASP model that compares A (the single binary/lib) to B (symbols across deps) If no splice libs OR no tools, cut out early

run_compatibility_tests(splice)[source]

Run the original full compatibility tests.

run_stability_tests(splice)[source]
stability_test_lib(splice, libA, libB)[source]

A stability test can only look at the subset of symbols.