Commit Graph

519 Commits

Author SHA1 Message Date
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
Giacomo Vercesi ae601f2d3c LocalStorageProvider: add inline parameter
Allow the storage provider to be initialized with `local://?inline`.
This will set the cache directory to `$PWD/.cache` instead of
`~/.cache/revng`. This is to simplify testing for pypeline.
2026-03-04 14:58:02 +01:00
Giacomo Vercesi d479438d3c Add ImportFromC analysis to pypeline 2026-03-04 14:58:02 +01:00
Giacomo Vercesi a94c6a2636 pipebox: use native runners
When running in debug mode, use the native runners where possible.
2026-02-16 10:34:38 +01:00
Giacomo Vercesi 6b40322a3c revng2: implement wrappers
Implement wrappers in the `revng2` CLI, this allows running command with
e.g. `--gdb` to allow debugging.
2026-02-16 10:34:38 +01:00
Lauri Vasama aa2597d13b model::Function: add stack frame name and comment
* StackFrameType() is removed.
* StackFrame() is introduced in its place.
* Use StackFrame().Type() to acess the stack frame type.
2026-02-13 08:41:39 +02:00
Giacomo Vercesi d7e605fe63 pypeline: add debug mode
Add the functionality the the pipeline infrastructure and CLI to run
individual pipe and analyses as subcommands instead of in-process. This
allow better debuggability of individual pipes.
2026-01-29 15:00:12 +01:00
Giacomo Vercesi 8f2d0191d7 Pipe: add needed_files functions
In preparation for debugging individual pipes add an additional method
to the `Pipe` interface, `needed_files`, which allows the pipe to
statically report which files it will request ahead of time.
2026-01-29 14:54:24 +01:00
Giacomo Vercesi 1b732501ae revng2 quick: swap artifact and binary args 2026-01-29 14:54:24 +01:00
Giacomo Vercesi 62c1b44a54 revng: allow execution while in a venv
If a venv is running, the `revng` script should re-exec to allow the
correct modules to be loaded and allow running the `main` function of
the respective modules.
2026-01-29 14:54:24 +01:00
Giacomo Vercesi 9d8845de95 revng2: do not print stacktrace on SIGINT 2026-01-29 14:54:06 +01:00
Giacomo Vercesi cda0a9e508 revng2: allow execution in build directory
Change the logic in `python/scripts/revng` to allow executing it as
`revng2`. This allows running `revng2` in the build directory.
2026-01-29 14:26:42 +01:00
Giacomo Vercesi fd14580619 pipebox: improve signal handling
Improve the handling of signals by leveraging the `Py_AtExit`
functionality to trigger cleanup when the interpreter exits.
When receiving SIGINT handle it specially because exceptions in python
are only thrown when the interpreter is running and not when C code is.
2026-01-20 12:29:12 +01:00
Giacomo Vercesi 971cea5bf1 pype-cli: better propagate pypeline errors
Convert the `RuntimeError`s emitted by the pipebox (e.g. when checking
preconditions or running analyses) into `PypelineError`s and have the
pypeline cli infrastructure handle them gracefully, without emitting
stacktraces.
2025-12-19 10:29:28 +01:00
Giacomo Vercesi 7f7f9571a8 pypeline: implement container discarding
Add infrastructure to pypeline that allows containers to be notified
when they are being used last, this allows two things:
* `Pipe`s eagerly clearing those containers once they are done reading
  their contents
* `ScheduledTask`s clearing those out at the end of their execution in
  case the pipe did not do it
This overall should improve memory usage as container no longer take up
memory if they are no longer used as part of a `Schedule`.
2025-12-19 10:29:28 +01:00
Giacomo Vercesi 265af3768f Binary importers: fix debug info detection
Fix the behavior of binary importers by propagating the path of the
input binary from revng2 downwards, allowing finding `.debug` files in
the correct paths.
2025-12-19 10:28:29 +01:00
Giacomo Vercesi eefdca934b pypeline: give better names to some attributes
Rename some attributes of pypeline objects to better-suited names:
* `TaskArgument.to_container_decl` -> `TaskArgument.declaration`
* `PipelineNode.arguments` -> `PipelineNode.argument_declarations`
* `PipelineNode.arguments_with_access` -> `PipelineNode.arguments`
2025-12-19 10:26:49 +01:00
Giacomo Vercesi a2a7e6442b pypeline: move PipelineNode.run
Inline the body of `PipelineNode.run` into `ScheduledTask.run`, making
`PipelineNode` a pure data structure. This also allows eliding all the
arguments since all of them as properties of `ScheduledTask`.
2025-12-19 10:18:10 +01:00
Giacomo Vercesi 9338ac3486 pypeline: expand ScheduledTask's constructor
Move the arguments with a longer lifetime from the arguments of
`ScheduledTask`'s `run` function to its constructor.
2025-12-19 10:17:37 +01:00
Giacomo Vercesi 12c180bfd9 pypeline: convert uses of pypeline_logger.log
The `pypeline_logger.log` functions should only be used to convey
information to the user, all other uses should fall under `debug_log`.
2025-12-17 11:58:46 +01:00
Giacomo Vercesi 94b9ecad6c mass-testing: exclude paths from flamegraph
Add a new option to the mass-testing `meta.yml` that allows skipping
some paths when generating the flamegraph. In the case of revng this
allows skipping the intermediate python frames.
2025-12-12 15:46:49 +01:00
Giacomo Vercesi 8af5e1d05c Implement revng2 quick artifact 2025-12-10 16:16:14 +01:00
Giacomo Vercesi e3b263d9da Implement revng2 project init 2025-12-10 16:16:14 +01:00
Giacomo Vercesi f7231a29da Add yield-cfg to pypeline 2025-12-10 16:16:14 +01:00