Commit Graph

63 Commits

Author SHA1 Message Date
Giacomo Vercesi 890a735610 test_docs: add ignoreoutput option for python
Sometimes the output of a command is not important, in these cases
`doctest` complains nonetheless. This commit introduces a
`IGNORE_OUTPUT` option which still allows checking that the command
executes correctly but skips the checking of the output with the
expected one. In addition to this the `test_docs` command now can parse
a `ignoreoutput` option in the python block which will:
* if numbers are specified (e.g. `ignoreoutput=1,2`): the specified
  line numbers will have `# doctest: +IGNORE_OUTPUT` added at the end
  of the specified line numbers.
* Without numbers (e.g. `{python ignoreoutput}`) then all lines will
  have a `# doctest: +IGNORE_OUTPUT` appended.
2025-05-07 10:48:54 +02:00
Giacomo Vercesi 3e3779498e Implement python interface for revng
Add a python interface (`revng.profile`) for interacting with the rev.ng
infrastructure as a whole; either through the CLI (`CLIProject`) or the
GraphQL API (`DaemonProject`).
2025-05-07 10:48:51 +02:00
Giacomo Vercesi e95ad01ff8 Implement revng llm-rename 2025-05-05 17:28:48 +02:00
Giacomo Vercesi 591107cdce Overhaul PTML functionality
The logic of the `revng ptml` command was too tightly coupled with the
parsing of the xml. Overhaul the structure of the ptml code and split it
in two locations:
* `revng.ptml`: this module contains functions that allow easy
  manipulation of PTML, both for printing it and for obtaining the split
  metadata/text version.
* `revng.internal.cli._commands.ptml`: this implements the actual `revng
  ptml` command. This leverages the new logic in the `revng.ptml` module
  while maintaining the same functionality.
2025-05-05 17:28:48 +02:00
Giacomo Vercesi bfed42ed1e Add revng.support.get_llvmcpy helper
Add the `get_llvmcpy` helper function which returns an instance of
`LLVMCPy` which uses the `llvm-config` that's present in the search
paths.
2025-05-05 16:02:40 +02:00
Khaled Ismaeel 9d80594ddc Bump model version to v3 2025-04-30 15:08:45 +02:00
Khaled Ismaeel 8b355fc896 Add primitive support for generating migrations 2025-04-30 15:08:45 +02:00
Khaled Ismaeel 9b07b3bcce Add primitive migration support to the CLI 2025-04-30 15:08:45 +02:00
Khaled Ismaeel 7156cace7b Drop multiversion support in Python model wrapper 2025-04-30 15:08:45 +02:00
Giacomo Vercesi e634861c1a Implement SyncingManager
Implement the SyncingManager class which wraps the Manager and implements
save syncing features, which comprise autosave and saving via
synchronizers.
2025-04-03 15:59:18 +02:00
Giacomo Vercesi 6a10419b69 Implement S3Synchronizer
Implement a downstream load/save handler in `revng.internal.api.Manager`
class which handles loading and saving files from a local directory to
a s3 server.
2025-03-28 14:23:10 +01:00
Alessandro Di Federico 0c7c20ad48 Introduce model, artifacts and analyses references 2024-12-11 16:15:27 +01:00
Giacomo Vercesi 3fe3a8524a Implement mass testing
Add the `revng mass-testing` commands and auxiliary executables which
simplify running revng on a huge quantity of input executables.
2024-10-01 13:38:21 +02:00
Alessandro Di Federico 99149c1b36 Drop revng lift 2024-08-07 16:07:59 +02:00
Alessandro Di Federico f8776ef8b5 Introduce revng tar-to-yaml 2024-06-20 10:24:50 +02:00
Alessandro Di Federico 757f7e21d7 Import docs 2024-02-09 10:04:24 +01:00
Massimo Fioravanti e5347b2910 Remove llvm pipeline 2024-01-02 11:14:55 +01:00
Giacomo Vercesi 942cf50735 python: create python wheels
Package revng's python code in two wheels: `revng` and `revng_internal`.
The revng wheel contains the
`revng.{pipeline_description,model,tupletree}` modules, while the
`revng_internal` one everything under `revng.internal`.
2023-12-12 14:52:22 +01:00
Giacomo Vercesi f710af9f2f Cleanup revng.daemon graphql API
Drop autogenerated queries from the GraphQL API and switch `revng.api`
to use `PipelineDescriptor`.
2023-09-14 15:44:33 +02:00
Giacomo Vercesi 2a239ddf47 Introduce PipelineDescription
Add the PipelineDescription object that describes the structure of a
pipeline. This will be used by all the downstream users instead of
pipeline accessor methods via PipelineC.
2023-09-14 15:44:33 +02:00
Giacomo Vercesi 90ea42b695 model/_util.py: move into tupletree.py
Move the contents of `model/_util.py` into `tupletree.py` as it's
model-agnostic and used by all generated Python tuple-tree wrappers.
2023-09-14 15:44:32 +02:00
Giacomo Vercesi 13ba286a9a Drop hard-coded analyses list
Remove any use of hard-coded analyses lists, relying on user interaction
(e.g. command-line arguments) to have it instead.
2023-08-23 17:45:36 +02:00
Giacomo Vercesi 9d5b6d1f34 revng cli: migrate legacy scripts to _commands
Move the remaining commands in the `scripts` to be used by the `revng`
command line driver.
2023-05-11 10:02:46 +02:00
Giacomo Vercesi 472710c100 daemon-self-test: Improve usability
Allow debugging commands (e.g. `--gdb`) to be passed through to the
invoked daemon when running `revng daemon-self-test`.
2023-05-09 17:27:00 +02:00
Giacomo Vercesi a2b7d0e0bf PipelineC: add tracing
Add support for tracing onto the PipelineC. This is done by:
1. Creating wrapper functions for each PipelineC function with the
   script in `scripts/PipelineC_add_tracing.py`. These will call a
   special function called `wrap` which will ultimately call a method
   with a `_` prepended to the name
2. Conversion of all PipelineC methods in `PipelineC.cpp` to `static`
   and their rename with a `_` in front, in order for them to work with
   the wrapper function in (1)
3. Generation of 2 additional include files, one for types and one for
   functions, to be used by users of tracing files in order to have
   introspection.

These steps allow the creation of a trace file with the use of the
`REVNG_C_API_TRACE_PATH` environment variable. The traces can then be
used in conjunction with the `revng trace run` and `revng trace
inspect` commands.
2023-04-20 14:43:13 +02:00
Giacomo Vercesi 6f3dc255cf revng.api: adopt rp_error
Change Python's API to handle the new `rp_error` and its two variations:
`DocumentError` and `SimpleError`.
2023-02-09 13:43:33 +01:00
Giacomo Vercesi 88e972c57c revng fifo events: move handling to daemon
Move all the event handling logic to the `revng.daemon` logic, since
now fifo notifications also include the JWT token (if present) of the
request.
2023-02-07 16:54:35 +01:00
Djordje Todorovic 0d6ffa7504 Introduce revng fetch-debuginfo 2022-12-13 11:25:36 +01:00
Giacomo Vercesi 81d25f9805 PipelineC: expose invalidation logic 2022-10-30 09:13:14 +01:00
Alessandro Di Federico 6fae9fc1c5 Stop checking Python requirements 2022-10-11 19:08:10 +02:00
Alessandro Di Federico 5a99154196 Put Python packages into lib/python*/site-packages 2022-10-11 19:08:10 +02:00
Giacomo Vercesi ff48b9de75 Introduce revng daemon-self-test
This new command will, given an executable, try to produce all
artifacts. By default it will run `revng daemon`, however an external
address can be provided to test remote daemons, e.g. running inside a
container.
2022-10-06 15:12:36 +02:00
Giacomo Vercesi df68b2c7c0 revng ptml: merge cat and strip
Merge the cat and strip subcommands within `revng ptml`
Refactor codebase so that both color and plaintext output are handled
in a unified manner.
2022-09-29 15:43:17 +02:00
Djordje Todorovic 753a50895c Introduce revng model import-idb 2022-09-21 18:39:10 +02:00
Massimo Fioravanti 6b099c57e8 Pipeline: introduce options for analyses 2022-08-29 14:43:25 +02:00
Massimo Fioravanti 42b623db06 Pipeline: rework CLI organization 2022-08-10 09:49:24 +02:00
Massimo Fioravanti 261a114d6d Pipeline: corner-case fix in backward deduction 2022-08-10 09:49:24 +02:00
Djordje Todorovic 1243d1061c Introduce revng model hard-purge
In addition, introduce a new model Pass:

  revng model opt -prune-unsused-types
2022-07-28 15:02:55 +02:00
Djordje Todorovic fdb12947a2 Introduce revng model download-pdb 2022-07-28 14:52:50 +02:00
Giacomo Vercesi 7a9c88e9e7 Introduce revng ptml
This Oython tool will be used to easily work with PTML.

It currently features two subcommands:

* `cat` prints a PTML to the terminal, with color formatting if
  possible;
* `strip` will strip a file of the PTML markup;
2022-07-28 08:49:09 +02:00
Giacomo Vercesi 1a7503183a revng.cli: dynamically load commands
Now `revng.cli` houses the core command-line driver while the individual
commands have been moved to `revng.cli._commands` and are dynamically
loaded.
2022-07-28 08:48:30 +02:00
Giacomo Vercesi 09009836a1 PipelineC: expose globals verification 2022-07-28 08:47:46 +02:00
Giacomo Vercesi 2fc11ab055 revng daemon: introduce notifications
Add the possibility of passing a list of FIFOs to `revng daemon`. These
can be used to notify an external program when a non-reproducible change
(binary, context) has occurred.
2022-06-29 14:50:58 +02:00
Giacomo Vercesi 93f776217d Split revng.daemon.schema
Splits the module in 2:

* static_handlers: as the name suggests this is where handlers for
  static endpoints (e.g. not dependent on the pipeline) are implemented
* schema_generator: this is where the schema is generated from a
  manager's pipeline definition, together with the handler for the
  autogenerated endpoint
2022-06-29 14:50:58 +02:00
Giacomo Vercesi 79c6086d0d revng.api: autodetect files
`revng.api` now autodetects files (libraries, pipeline yamls) for
initialization via the same mechanism used by `revng.cli`. This removes
the need to pass them via environment variables from `revng daemon`
and allows easy interaction with python's C API.
2022-06-29 14:49:29 +02:00
Giacomo Vercesi 7052f2a8a0 Support analyses and globals in Python
This commit adds the newly implemented functionality in PipelineC both
in revng.api and the graphql api, allowing:

* retrieval of global variable names
* unwrapping of a single target
* execution of analyses
2022-05-24 10:56:02 +02:00
Giacomo Vercesi 70f7337f28 Substitute Flask with Starlette
In the future we will need to use GraphQL subscriptions. This is done
via websockets and is supported in Ariadne. However this support is
limited to ASGI frameworks, which Flask isn't a part of.
Startlette is a direct depencency of Ariadne, and all of Ariadne's
features are fully integrated with Starlette, so the switch allows to
drop some Flask integration cruft and streamline the revng.daemon
package.
Starlette does not have a built-in development server, instead
Hypercorn, which is an ASGI-compliant HTTP server, is used in place of
Flask's Werkzeug/Gunicorn for both the development and production
server roles.
2022-05-06 15:04:19 +02:00
Alessandro Di Federico cafdd7c6f9 Introduce revng model override-by-name 2022-04-29 17:57:49 +02:00
Giacomo Vercesi 4f7908753e Introduce the revng-daemon command 2022-04-26 15:59:35 +02:00
Giacomo Vercesi 172faebacf Introduce the revng.daemon GraphQL API
This commit introduces the `revng.daemon` Python module, a Flask-powered
web application that exposes the functionality from `revng.api` across a
GraphQL API
2022-04-26 15:59:35 +02:00