mate.build.tob_chess_utils.tools.quotidian module¶
- class mate.build.tob_chess_utils.tools.quotidian.QuotidianContext(options: mate.build.tob_chess_utils.tools.quotidian.QuotidianOptions, new_artifacts: List[mate_query.db.Artifact] = <factory>)¶
Bases:
object
- Parameters
options (mate.build.tob_chess_utils.tools.quotidian.QuotidianOptions) –
new_artifacts (List[mate_query.db.Artifact]) –
- Return type
None
- new_artifacts: List[mate_query.db.Artifact]¶
A list of new artifacts created through Quotidian’s internal steps.
- options: mate.build.tob_chess_utils.tools.quotidian.QuotidianOptions¶
The options that this run of Quotidian was started with.
- exception mate.build.tob_chess_utils.tools.quotidian.QuotidianError¶
Bases:
mate_common.error.MateError
A generic error, internal to
quotidian
.
- class mate.build.tob_chess_utils.tools.quotidian.QuotidianOptions(build: mate_query.db.Build, image: Optional[str] = None, line_program: bool = False, extra_linker_flags: List[str] = <factory>)¶
Bases:
object
A collection of behavioral settings and metadata for
quotidian.quotidian
.- Parameters
build (mate_query.db.Build) –
image (Optional[str]) –
line_program (bool) –
extra_linker_flags (List[str]) –
- Return type
None
- build: mate_query.db.Build¶
The
mate.db.Build
associated with the Quotidian run.
- extra_linker_flags: List[str]¶
Any additional flags to pass to the linker during recompilation.
- image: Optional[str] = None¶
The Docker image to use for containerized recompilation, if any.
- line_program: bool = False¶
Whether to emit line program information.
- mate.build.tob_chess_utils.tools.quotidian.build_common_compiler_flags(all_cu_flags: Set[str], target_triple: str) Tuple[List[str], Set[str], List[str]] ¶
Given a set containing all unique compiler flags used by all compilation units in the input, attempts to construct a (minimal) list of flags for recompilation and relinking.
- Parameters
all_cu_flags (Set[str]) –
target_triple (str) –
- Return type
Tuple[List[str], Set[str], List[str]]
- mate.build.tob_chess_utils.tools.quotidian.container_run(client: docker.client.DockerClient, image: docker.models.images.Image, *, command: List[str]) None ¶
Run the given command in a container created from the given image, using the supplied Docker client.
- Parameters
client (docker.client.DockerClient) –
image (docker.models.images.Image) –
command (List[str]) –
- Return type
None
- mate.build.tob_chess_utils.tools.quotidian.extract_compiler_and_flags(cu_dict: Dict[str, Any]) Tuple[pathlib.Path, List[str], List[str], List[str]] ¶
Given a Headache-extracted compilation unit information file, returns a tuple of (compiler, compiler_flags, linker_flags, target_flags) suitable for recompiling the bitcode.
Note: The results of this function are later augmented by
infer_linker_flags_from_externals
andlinker_flags_from_build_record
.- Parameters
cu_dict (Dict[str, Any]) –
- Return type
Tuple[pathlib.Path, List[str], List[str], List[str]]
- mate.build.tob_chess_utils.tools.quotidian.infer_compiler(source_ids: Set[int]) pathlib.Path ¶
Given a set of DWARF language IDs, infer an appropriate compiler frontend (i.e.,
clang
orclang++
) to invoke for recompilation.- Parameters
source_ids (Set[int]) –
- Return type
pathlib.Path
- mate.build.tob_chess_utils.tools.quotidian.infer_linker_flags_from_externals(externals: Set[str]) Set[str] ¶
Given a set of all external symbols that appear in all compilation units of the program, attempts to infer linker flags that would be implicit during the normal compilation pipeline.
- Parameters
externals (Set[str]) –
- Return type
Set[str]
- mate.build.tob_chess_utils.tools.quotidian.linker_flags_from_build_record(build_record: List[Dict[str, Any]]) List[str] ¶
Given a “build record” (i.e., a list of individual compile tool invocations), attempt to suss out additional flags that look like they belong to the linker.
- Parameters
build_record (List[Dict[str, Any]]) –
- Return type
List[str]
- mate.build.tob_chess_utils.tools.quotidian.quotidian(bitcode_file: pathlib.Path, *, bdist_root: pathlib.Path, options: mate.build.tob_chess_utils.tools.quotidian.QuotidianOptions, margin_options: Dict[str, Any] = {}) Tuple[Iterator[Dict[str, Any]], List[mate_query.db.Artifact]] ¶
- Parameters
bitcode_file (pathlib.Path) –
bdist_root (pathlib.Path) –
options (mate.build.tob_chess_utils.tools.quotidian.QuotidianOptions) –
margin_options (Dict[str, Any]) –
- Return type
Tuple[Iterator[Dict[str, Any]], List[mate_query.db.Artifact]]
- mate.build.tob_chess_utils.tools.quotidian.run(*argv, env: Optional[Dict[str, str]] = None, **kwargs: Any) subprocess.CompletedProcess ¶
Run the given command, updating the environment with a mapping supplied by
env
, if any.- Parameters
env (Optional[Dict[str, str]]) –
kwargs (Any) –
- Return type
subprocess.CompletedProcess