Commit Graph

525 Commits

Author SHA1 Message Date
Giacomo Vercesi bc765c1104 LocalStorageProvider: prune on startup
Add two situations where the cache is pruned on startup, removing all
the cached objects from storage:
1. the version field does not match the current one
2. the model has been changed out of band

The second one is very important as it allows to use the revng2 CLI
while editing the model manually on disk.
2026-04-09 17:07:45 +02:00
Giacomo Vercesi 76f9ed73bd pypeline-storage: drop revng_ prefix
Drop the `revng_` prefix for the version field.
2026-04-09 17:07:45 +02:00
Giacomo Vercesi 132d891e7c Cleanup revng.support.artifacts
Remove a few `Artifact` classes from `revng.support.artifact`. These
were needed to handle the idiosyncrasies of the legacy pipeline. Some of
the logic has been reworked into the ptml code.
2026-04-09 17:07:45 +02:00
Giacomo Vercesi 8ad19f2f3d revng.project: port to pypeline
Convert `revng.project` to use the `revng2` command-line and the `revng
project daemon` server instead of the legacy ones.
2026-04-09 17:07:45 +02:00
Giacomo Vercesi b229fcc469 model: rework python mixin infrastructure
Rework the python mixin infrastructure for the model. Mixins are now
specified explicitly instead of using the `ast` module. The mixins are
loaded relative to the generated python file, this allows to have two
models: `revng.model` and `revng.project.model`. The latter is augmented
via mixins to have project-specific facilities such as `get_artifact`
and artifact accessors.
2026-04-09 17:07:44 +02:00
Giacomo Vercesi 2430132da3 pypeline daemon: add /status endpoint
Add a `/status` endpoint to the daemon that allows verifying that the
daemon is up.
2026-04-09 17:07:44 +02:00
Giacomo Vercesi 3d96cd3b85 Add revng2 project dump-pipeline
Add the `revng2 project dump-pipeline` command which allows emitting the
pipeline description from the command-line.
2026-04-09 17:07:44 +02:00
Giacomo Vercesi 2911fb3e2a pypeline: implement proper config parsing
Overhaul the pipeline configuration logic by collapsing all dynamic
configuration options, both for analyses and pipes into a single
dictionary. Change all the interfaces so that there is no longer
distinction between the configuration of an analysis and of pipes.
Expose these options to the command line via `--{name}-configuration`
options for each pipe/analysis that is applicable to the command-line
invocation.
2026-04-09 17:07:44 +02:00
Giacomo Vercesi 4515a6215d revng2 quick artifact: use subcommands
Make each artifact a subcommand of `revng2 quick artifact` so that it
behaves the same way as `revng2 project artifact`.
2026-04-09 17:07:44 +02:00
Giacomo Vercesi d49d25b184 pype: adopt option group for wrappers
Group all the wrapper options (`--lldb`, `--gdb`, etc.) in an option
group, so that they are rendered in an indented section.
2026-04-09 17:07:44 +02:00
Giacomo Vercesi aaa85d3f25 LocalStorageProvider: handle OSErrors
Ignore `OSError`s in `LocalStorageProvider` when rebuilding the list of
files for a given hash, since those paths might have become inaccessible
in the meantime.
2026-04-09 17:07:44 +02:00
Giacomo Vercesi b67ce433cd pype: improve output on wider terminals
Click clamps the output of its help to 80 columns, this makes reading
the help on wider terminals quite annoying. Change the formatter class
used to allow better help output on wider terminals.
2026-04-09 17:07:44 +02:00
Giacomo Vercesi 242fd0baa9 revng.support.to_bytes: handle empty files
`mmap` throws an error when opening empty files, add code to check this
situation and return a zero-length byte string.
2026-04-09 17:07:44 +02:00
Giacomo Vercesi b2293fec30 pypeline: fix Pipeline.run_analysis_list
Fix the `run_analysis_list` method as it had an incorrect way of
computing the overall list of invalidated artifacts.
2026-03-31 17:00:49 +02:00
Giacomo Vercesi a904f356a4 pypeline-daemon: clean up websocket code
Clean up the code related to the handling of websockets and allow the
daemon to be terminated gracefully without any error messages.
2026-03-31 17:00:49 +02:00
Giacomo Vercesi a886c0509f pypeline: fix savepoint_id_to_artifact 2026-03-31 17:00:49 +02:00
Giacomo Vercesi fd95c7704e pypeline: expose artifact's pipe dependencies
Add an additional piece of metadata that states which pipes are used to
compute a specific artifact. This can be used to derive which
configuration options influence the creation of an artifact.
2026-03-31 17:00:49 +02:00
Giacomo Vercesi 9b68cf4a39 pypeline-daemon: rework /artifact endpoint
Rework the artifact endpoint, making it similar to the CLI invocation.
It now works on a single artifact and can be made to return both `json`
and `tar` as formats.
2026-03-31 17:00:49 +02:00
Giacomo Vercesi 20059b5f3a pypeline: make Container.serialize selective
Change the `Container.serialize` interface so that it is possible to
supply a list of objects that will be serialized instead of all the ones
in the container.
2026-03-31 17:00:48 +02:00
Giacomo Vercesi 644b71b319 pypeline: add additional artifact PTML metadata
Add two additional fields to `Artifact`: `defined_locations` and
`preferred_artifacts`. These are pieces of metadata that allow
navigation between multiple PTML-enabled documents.
2026-03-31 17:00:48 +02:00
Giacomo Vercesi b9051e494b pipeline: add missing cross-relations artifact 2026-03-31 17:00:48 +02:00
Giacomo Vercesi b40fec2270 Add LLMRename analysis to pypeline 2026-03-31 17:00:48 +02:00
Giacomo Vercesi 63a11d0c63 pypeline: add Analysis.is_available
Add a method to the `Analysis` interface which allows an analysis to
report if it is available for execution.
2026-03-31 17:00:48 +02:00
Giacomo Vercesi 7a152425ca pypeline: add filename to artifact
Add a meta-information field to the artifact that adds an hint of what
filename a single object of an artifact should be represented in a
filesystem.
2026-03-31 17:00:48 +02:00
Giacomo Vercesi 4c6436f7b2 pypeline: introduce artifact category
Add categories in the pipeline, allow an artifact to have a category
specified which allows it to be shown or hidden by default. Adapt the
CLI tools to hide artifacts of the category that don't
`show_by_default=True`.
2026-03-31 17:00:48 +02:00
Giacomo Vercesi 39f1a9c3a9 pypeline: drop underscores from pipeline yaml
Remove the only instance of underscores in the pipeline yaml from the
use of `analysis_lists`. Substitute it with `analysis-list`.
2026-03-31 17:00:48 +02:00
Giacomo Vercesi fc9193a0a8 pypeline: convert pipeline parser to class
Since most functions in `pipeline_parser.py` had a lot of redundancy in
the parameters passed, convert all of them to be part of a
`PipelineParser` class which stores all the variables.
2026-03-31 17:00:48 +02:00
Giacomo Vercesi 550ac7b700 pypeline-daemon: add put-file endpoint
Add an endpoint to the daemon that allows adding a file to the file
storage.
2026-03-31 17:00:48 +02:00
Giacomo Vercesi 6dc053e55c pypeline-daemon: rework error propagation
Rework how errors are propagated from the daemon code to the HTTP
client, creating an exception hierarchy to handle the most common
cases.
2026-03-31 17:00:48 +02:00
Giacomo Vercesi 14d95a924d pypeline: rework fields in pipeline metadata
Rework which information is transmitted in the pipeline metadata,
avoiding redundancy and moving some information there instead of
returning it every time a request is made.
2026-03-31 17:00:48 +02:00
Giacomo Vercesi a13cffab19 pypeline: rename pipeline metadata schema file
Rename the schema that describes the metadata of the pipeline from
`web_schema.yml` to `pipeline-description-schema.yml`.
2026-03-31 17:00:48 +02:00
Giacomo Vercesi c53e615fa0 Cleanup pypeline code
Remove some cruft and apply trivial changes to the existing pypeline
code, especially on the daemon side.
2026-03-31 17:00:48 +02:00
Giacomo Vercesi 773245b893 pypeline/cli: use dataclass for ctx.obj
Add typing to the `ctx.obj` object used to store pypeline-specific data
while parsing the command-line in click.
2026-03-31 17:00:48 +02:00
Ivan Krysak 754cfd57fe Model: introduce migration to version 9 2026-03-27 08:19:21 +00:00
Ivan Krysak 278b898793 llvm-to-clift -> clifter 2026-03-27 07:05:44 +00:00
Ivan Krysak addfc543c8 import-model-names -> import-descriptive-info 2026-03-26 16:28:48 +00:00
Ivan Krysak 01658cab09 import-model-names: split into two
One is module-granularity (name unchanged). The other (new) one
is function-granularity: `import-function-model-names`.
2026-03-26 16:00:49 +00:00
Andrea Gussoni 02cc6923d0 EmitFieldAccesses: implement pass
The `EmitFieldAccesses` pass transforms `clift` by taking pointer-typed
expressions computed via integerr arithmetic with type-safe field
accesses and array accesses.

The transformation is split in three main phases:
1) `PointerArithmetic` computation.
2) `BestTraversal` computation.
3) `FieldAccess` `clift` rewrite.

The high level driver is implemented in the `EmitFieldAccesses` header
and cpp, while the nested 3 phases are implemented respectively in
`PointerArithmetic`, `BestTraversal` and `FieldAccessReplacement`.

The `computerPointerArithmetic` phase is concerned with taking a
pointer-typed `ExpressionOp`, called `PointerToReplace`, and expressing
it in a `BasePointer+Offset` form.

The `computeBestTraversal` phase is concerned with computing the best
traversal of the type pointed to by `BasePointer`, that can be used to
rewrite the pointer arithmetic in `clift` with just field accesses and
array subscripts.

The `replaceFieldAccess` phase takes the `Traversal` computed at the
previous step, and actually rewrites in `clift` the `PointerToReplace`
in terms of field accesses and array accesses w.r.t. the `BasePointer`.
2026-03-18 17:25:13 +01:00
Giacomo Vercesi d0d3df4f72 Add revng2 quick analyze
Add the counterpart to `revng2 quick artifact` which allows to run the
initial auto analysis on a binary and return its model.
2026-03-05 14:23:06 +01:00
Giacomo Vercesi 161ba6e5c3 revng2 quick artifact: add --analyses option
Add the `--analyses` option which allows specifying the list of analyses
to be run before producing the artifact instead of the default initial
auto analysis.
2026-03-05 14:23:06 +01:00
Giacomo Vercesi 2663a8beb3 LocalStorageProvider: fix invalidation code
Before this commit the `invalidate` code did invalidate all the objects
but left all the rows in `dependencies` that were paired to the produced
objects except the invalidated paths.
In this commit the logic is changed to be done in 3 steps:
1. SELECT all the objects that need to be invalidated, write down their
   rowid
2. Delete all the rows in `dependencies` that were produced in
   conjunction to the objects from (1)
3. Remove the objects from the table, returning invalidation data
This guarantees that the database does not accumulate invalidation data
over time due to invalidations.
2026-03-05 14:23:06 +01:00
Giacomo Vercesi f19da8b440 pype project analyze: output invalidations
Add a command-line option to `pype project analyze` that allows
serializing the invalidated objects of an analysis to yaml on disk.
2026-03-05 14:23:06 +01:00
Giacomo Vercesi ce60d8a1e5 pypeline: integrate model migration infrastructure
When calling `Model.deserialize` the model will be automatically be
migrated if it needs to.
2026-03-05 14:23:06 +01:00
Giacomo Vercesi f4d0573017 pypeline: StorageProvider works with Model
Change the `get_model` and `set_model` interface of `StorageProvider` so
that it is responsibility of the `StorageProvider` to
serialize/deserialize the model before returning to the caller.
This is in preparation to the model migration being implemented, since
it's now a responsibility of the storage provider to deserialize it it
can trivially re-save it to disk if it is migrated.
2026-03-05 14:23:06 +01:00
Giacomo Vercesi a6a3e15e6b pypeline: add env prefixes
Add the `PYPELINE_` prefix to all the pypeline environment variables.
2026-03-05 14:23:06 +01:00
Giacomo Vercesi 6ec9f9a952 TupleTree: overhaul reference caching
Overhaul the logic and method names involved in enabling and disabling
reference caching in `TupleTree<T>`. `TupleTreeReference<T, U>` now
lazily caches the target and will traverse the path only when needed.
Also expose and use these functions in the new pipeline, which should
provide some speedup when executing a `Schedule`.
2026-03-04 14:58:02 +01:00
Giacomo Vercesi 9cd7554d71 pype project analyze: refactor code
The functions that take care of running an analysis/analysis list have a
lot of duplication, merge the two into a single function that takes care
of running both.
2026-03-04 14:58:02 +01:00
Giacomo Vercesi 4e46343960 pypeline: fix container_format handling
Fix the code that handles setting the `--format`, `--tar` and `--yaml`
command line options, which incorrectly wrote to the `format` kwargs
instead of the `container_format` one.
2026-03-04 14:58:02 +01:00
Giacomo Vercesi a2d263dfc9 pype project analyze: add output argument
Add an argument which specifies where the changed model should be
written to. This replaces the hardcoded behavior of writing the new
model to stdout.
2026-03-04 14:58:02 +01:00
Giacomo Vercesi 9287c51d27 pypeline: fix -C option
Instead of executing `chdir` when using the `-C` option, which is
fragile when other paths are involved, store the option in the click
context and propagate it to the required code paths that require knowing
what the base directory is.
2026-03-04 14:58:02 +01:00