Commit Graph

30 Commits

Author SHA1 Message Date
Giacomo Vercesi 7e96bb2189 revng.api: avoid NULL dereferencing in extract
The call to `rp_container_extract_one` can return a null pointer, add a
check that allows to avoid dereferencing it if this happens.
2023-07-31 16:05:51 +02:00
Giacomo Vercesi 0ec2fdd175 revng.daemon: prevent shutdown crash
Change the behavior of `revng daemon` to avoid a crash at shutdown
caused by `rp_shutdown` not being called due to the pointer of
`rp_manager` not being freed.
2023-07-21 09:34:00 +02:00
Giacomo Vercesi 8d89c6a318 PipelineC: rp_initialize: only use argc and argv
Switch from specifying `libraries` and `pipelines` in `rp_initialize`
and `rp_manager_create` to the use of command-line options that are to
be passed via `argc` and `argv` in `rp_initialize`.
2023-04-20 14:43:12 +02:00
Giacomo Vercesi 3bfdb95d92 revng.api: Improve Manager.run_analyses_list
Fix the case where the return of `rp_manager_run_analyses_list` returns
nullptr.
2023-04-20 14:43:12 +02:00
Giacomo Vercesi 2e96e09f63 Drop analyze-all
Drop all the uses of analyzeAll and swap its use with the invocation of
the appropriate analysesList
2023-03-22 17:50:02 +01:00
Giacomo Vercesi af237074f3 Implement AnalysesList in Python API & GraphQL
Implement the new functionality of AnalysesList on the python's side of
rev.ng and the GraphQL schema both in static and autogenerated form
2023-03-22 17:31:46 +01:00
Giacomo Vercesi 23286dc58f GraphQL: expose analysis options
Add an additional parameter that allows specifying options for analyses
as a serialized json string
2023-03-22 17:31:46 +01:00
Giacomo Vercesi 15da250710 api/daemon: fix single analysis handling
* Let GraphQL accept zero or more parameters for analyses
* Handle the general case of analyses using zero or more containers with
  a variable ammount of targets
2023-03-15 10:19:01 +01:00
Giacomo Vercesi 2b4cfafe55 revng.api: Fix file upload/buffer reading
This commit fixes file output `revng.api` in two ways:
* The buffer's size is properly reported in `PipelineC.cpp`
* The function `deserialize_container` in `revng.api.manager` no longer
  appends a `\0` to `content`, while avoiding a redundant copy
2023-02-16 15:11:00 +01: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 8a780a58aa GraphQL: return binaries in b64
This change fixes the pipeline behavior when producing targets:
* produce and extract now return rp_buffer, which has a start pointer
  and size
* the python api `revng.api` will return on produce/extract either str
  or  bytes depending on the mime type of the container
* the GraphQL api will encode bytes in base64
2023-02-07 16:54:35 +01:00
Giacomo Vercesi 2c4f5d1381 GraphQL: introduce target endpoint 2022-10-30 09:13:34 +01:00
Giacomo Vercesi 81d25f9805 PipelineC: expose invalidation logic 2022-10-30 09:13:14 +01:00
Massimo Fioravanti d55aa9b9e6 Pipeline: remove * from targets
Now * is just a pipeline frontend shorthand.
2022-10-20 14:20:12 +02:00
Alessandro Di Federico 3307fb4a46 api.Manager: use TemporaryDirectory if no workdir 2022-09-26 18:09:01 +02:00
Massimo Fioravanti 6b099c57e8 Pipeline: introduce options for analyses 2022-08-29 14:43:25 +02:00
Alessandro Di Federico f00a86d491 manager.py: check manager.produce_targets success 2022-08-26 09:50:42 +02:00
Giacomo Vercesi f281b5930b revng.daemon: rework schema_generator.py
Rework both classes in schema_generator.py, main changes:
* Drop manager.pipeline_artifact_structure as it was used exclusively
  by SchemaGenerator and is no longer needed
* Rename SchemaGen and BindableGen to SchemaGenerator and
  DynamicBindableGenerator to better express their role, add
  docstrings that explain what they do
* Decouple Artifacts and Analyses discovery, since a step can have
  analyses and no artifacts (and vice-versa)
2022-08-26 09:50:37 +02:00
Giacomo Vercesi 09009836a1 PipelineC: expose globals verification 2022-07-28 08:47:46 +02:00
Giacomo Vercesi f02aecfccb Python API: produce now returns a dict
When requesting a produce for multiple targets the result will be a
dictionary mapping "<target>:<result>". This also changes the GraphQL
API where a json-serialized string is returned.
2022-06-29 14:50:58 +02:00
Giacomo Vercesi 30ef77e6fa GraphQL: introduce queries to retrieve globals
Change the schema to allow introspection of context globals.
2022-06-29 14:50:58 +02:00
Giacomo Vercesi 2df691535d Pipeline: Make recalculateAllPossibleTargets
`recalculateAllPossibleTarget` is now a private member of
PipelineManager This was done since all calls that can trigger a change
in the target list have been isolated and the call is done implicitly.
This removes rp_manager_recompute_all_available_targets from PipelineC,
since it was added as a stopgap until the above was implemented.
2022-06-29 14:50:58 +02:00
Giacomo Vercesi 487af0f4b0 Do not pass file paths to revng from PipelineC
Allow deserializing containers from a byte string rather than pointing
to a file, this allows revng to have an opaque workdir.
2022-06-29 14:50:58 +02:00
Giacomo Vercesi 05dc27715d Improve pipeline saving capabilities
This commit introduces some changes to how the revng pipeline handles
serializing to disk. Specificaly:

* Pipeline globals (specifically model.yml) are better handled if they
  are in a subdirectory. They are now saved in the "context"
  subdirectory.
* In python:revng.api the pipeline is serialized whenever there is a
  non-reproducible change to the state (e.g. binary upload or model
  change).
  In the case of analyses this is done conservatively by checking that
  the diff produced is not empty.
* The logic for computing a step's subdirectory has been moved to the
  pipeline runner, consequently if a step is asked to serialize it
  will not create any subdirectories.
* Functionality for saving a single step/context has been exposed in
  Pipeline C.
* Finally, all path concatenations are now handled by
  llvm::sys::path::append, for extra os-agnosticism.
2022-06-29 14:50:58 +02:00
Giacomo Vercesi a03547ae66 revng.api: drop wrong exception in get_target
If a step:container does not have any targets, return an empty list
instead of raising an exception.
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 2f0519c3c5 GraphQL: Introduce run_all_analyses 2022-05-24 10:56:04 +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 7c3d9a3fcd Python API: automatically call destructors
Use the owning annotation in PipelineC/Prototypes.h to automatically
destroy resources when they go out of scope on the python side.
2022-05-24 08:59:08 +02:00
Giacomo Vercesi 7231ee607a Introduce PipelineC wrapper for Python
Add the revng.api module: a wrapper around the PipelineC API.
2022-04-26 15:59:35 +02:00