mate_common.models.builds module

class mate_common.models.builds.BuildInformation(*, build_id: str, compilation: mate_common.models.compilations.CompilationInformation, state: mate_common.models.builds.BuildState, bitcode_artifact: mate_common.models.artifacts.ArtifactInformation, artifact_ids: List[str] = [], artifacts: List[mate_common.models.artifacts.ArtifactInformation], analysis_task_ids: List[str], mantiserve_task_ids: List[str], options: mate_common.models.builds.BuildOptions, attributes: Dict[str, Any])

Bases: pydantic.main.BaseModel

Metadata about a build.

Return type


analysis_task_ids: List[str]

The IDs of any analysis tasks currently associated with the build.

artifact_ids: List[str]

The IDs of any artifacts currently associated with the build.

artifacts: List[mate_common.models.artifacts.ArtifactInformation]

Artifact detail for any artifacts currently associated with the build, if this BuildInformation was populated with artifact detail.

attributes: Dict[str, Any]

Free-form information attached to this build.

bitcode_artifact: mate_common.models.artifacts.ArtifactInformation

Artifact detail for the bitcode artifact that this build was created from.

This artifact is present both here and in the artifacts list, if the latter is populated.

build_id: str

The ID of the build.

compilation: mate_common.models.compilations.CompilationInformation

Compilation detail for the compilation task that this build was created from.

mantiserve_task_ids: List[str]

The IDs of any mantiserve tasks currently associated with the build.

options: mate_common.models.builds.BuildOptions

The BuildOptions used to configure this build.

state: mate_common.models.builds.BuildState

The build’s current state.

class mate_common.models.builds.BuildOptions(*, do_pointer_analysis: bool = True, machine_code_mapping: bool = True, control_dependence: bool = True, llvm_memory_dependence: bool = False, llvm_pretty_strings: bool = True, translation_unit_nodes: bool = True, argument_edges: bool = False, line_program_source_info: bool = False, pointer_analysis: mate_common.models.builds.PointerAnalysis = PointerAnalysis.SUBSET, context_sensitivity: mate_common.models.builds.ContextSensitivity = ContextSensitivity.CALLSITE2, memory_limit_mb: Mebibytes = 32768, signatures: List[dict] = None, extra_linker_flags: List[str] = [], time_llvm_passes: bool = False, schema_validation: bool = False, merge_library_bitcode: bool = True, merge_bitcode_only_needed: bool = False, merge_bitcode_internalize: bool = False, debug_pointer_analysis: bool = False, debug_mate_jsonl: bool = False, debug_quotidian_jsonl: bool = False, debug_cpg_jsonl: bool = False)

Bases: pydantic.main.BaseModel

Options that control the behavior of a CPG build.

  • do_pointer_analysis (bool) –

  • machine_code_mapping (bool) –

  • control_dependence (bool) –

  • llvm_memory_dependence (bool) –

  • llvm_pretty_strings (bool) –

  • translation_unit_nodes (bool) –

  • argument_edges (bool) –

  • line_program_source_info (bool) –

  • pointer_analysis (mate_common.models.builds.PointerAnalysis) –

  • context_sensitivity (mate_common.models.builds.ContextSensitivity) –

  • memory_limit_mb (Mebibytes) –

  • signatures (Optional[List[dict]]) –

  • extra_linker_flags (List[str]) –

  • time_llvm_passes (bool) –

  • schema_validation (bool) –

  • merge_library_bitcode (bool) –

  • merge_bitcode_only_needed (bool) –

  • merge_bitcode_internalize (bool) –

  • debug_pointer_analysis (bool) –

  • debug_mate_jsonl (bool) –

  • debug_quotidian_jsonl (bool) –

  • debug_cpg_jsonl (bool) –

Return type


argument_edges: bool

Whether to include edges between Arguments and DWARFArguments in the CPG.

context_sensitivity: mate_common.models.builds.ContextSensitivity

The context sensitivity level.

control_dependence: bool

Whether to include control dependence analysis results in the CPG.

debug_cpg_jsonl: bool

Save the intermediate CPG JSONL file for debugging.

debug_mate_jsonl: bool

Save the intermediate MATE JSONL file for debugging.

debug_pointer_analysis: bool

Save intermediate pointer analysis results for debugging.

debug_quotidian_jsonl: bool

Save the intermediate Quotidian JSONL file for debugging.

do_pointer_analysis: bool

Whether to include pointer analysis results in the CPG.

extra_linker_flags: List[str]

Additional linker flags to introduce when recompiling.

line_program_source_info: bool

Whether to include DWARF line program entry information in the CPG.

llvm_memory_dependence: bool

Whether to include LLVM memory dependence analysis results in the CPG.

llvm_pretty_strings: bool

Whether to include pretty-printed LLVM strings in the CPG.

machine_code_mapping: bool

Whether to include machine code mapping results in the CPG.

memory_limit_mb: Mebibytes

Memory limit for CPG generation, in MB

merge_bitcode_internalize: bool

With merge_library_bitcode: tell llvm-link to attempt to internalize any public symbols that aren’t explicitly referenced by another other modules. This can help avoid unintentional symbol clashes, at the risk of deviating significantly from the system linker’s normal behavior.

merge_bitcode_only_needed: bool

With merge_library_bitcode: tell llvm-link to only include referenced symbols when merging bitcode modules. This can help reduce bitcode size (and subsequently analysis time).

merge_library_bitcode: bool

For compilations that produce libraries and then link to them: attempt to statically merge library bitcode into the “canonical” bitcode instead of linking at the binary level.

pointer_analysis: mate_common.models.builds.PointerAnalysis

Which pointer analysis variant to run.

schema_validation: bool

Validate each node and edge against the JSON schema before insertion.

signatures: Optional[List[dict]]

Optional additional points-to and dataflow signatures.

time_llvm_passes: bool

Emit timing information for each LLVM pass.

translation_unit_nodes: bool

Whether to include translation unit information in the CPG.

class mate_common.models.builds.BuildState(value)

Bases: mate_common.state_machine.StateMachineMixin, str, enum.Enum

An enumeration of the different states that a build can be in.

Building = 'building'
Built = 'built'
Created = 'created'
Failed = 'failed'
Inserting = 'inserting'
class mate_common.models.builds.ContextSensitivity(value)

Bases: str, enum.Enum

Valid context sensitivity settings for the pointer analysis.

This should be kept in sync with: - llvm/PointerAnalysis/PointerAnalysis.cpp - llvm/PointerAnalysis/test/ - llvm/PointerAnalysis/FactGenerator/include/ContextSensitivity.hpp - llvm/PointerAnalysis/datalog/options/user-options.dl - llvm/PointerAnalysis/datalog/context/interface.dl

CALLER1 = '1-caller'
CALLER2 = '2-caller'
CALLER3 = '3-caller'
CALLER4 = '4-caller'
CALLER5 = '5-caller'
CALLER6 = '6-caller'
CALLER7 = '7-caller'
CALLER8 = '8-caller'
CALLER9 = '9-caller'
CALLSITE1 = '1-callsite'
CALLSITE2 = '2-callsite'
CALLSITE3 = '3-callsite'
CALLSITE4 = '4-callsite'
CALLSITE5 = '5-callsite'
CALLSITE6 = '6-callsite'
CALLSITE7 = '7-callsite'
CALLSITE8 = '8-callsite'
CALLSITE9 = '9-callsite'
FILE1 = '1-file'
FILE2 = '2-file'
FILE3 = '3-file'
FILE4 = '4-file'
FILE5 = '5-file'
FILE6 = '6-file'
FILE7 = '7-file'
FILE8 = '8-file'
FILE9 = '9-file'
INSENSITIVE = 'insensitive'
class mate_common.models.builds.PointerAnalysis(value)

Bases: str, enum.Enum

Valid variants of the pointer analysis.

This should be kept in sync with: - llvm/PointerAnalysis/PointerAnalysis.cpp - llvm/PointerAnalysis/test/

DEBUG = 'debug'
SUBSET = 'subset'
UNIFICATION = 'unification'
mate_common.models.builds.get_default_memory_limit_gb() Gibibytes
Return type