Commit Graph

282 Commits

Author SHA1 Message Date
Giacomo Vercesi 07be2c1cae Allow the use of valgrind with python
This commit does 2 main things:
* Adds PYTHONMALLOC=1 environment variable when `--valgrind` is used
  to force python to use normal malloc instead of the custom allocator
  python normally uses that's not friendly with valgrind
* Add a suppression file to remove a couple of false-positives that
  happen consistently and generate useless noise
2023-04-20 14:43:12 +02:00
Giacomo Vercesi 4400924312 revng.cli: allow non-ELFs to be run with gdb
If needed, wrap the execution of scripts in `exec` to allow running
them with gdb. This is especially useful for running python scripts
that use cffi and being able to inspect the C/C++ side.
2023-04-20 14:43:11 +02:00
Giacomo Vercesi 59175e9925 daemon-self-test: do not fail() twice
There was a codepath in `revng-check-conventions` that would cause
`fail(e)` to be called twice. This would cause an exception on the
second invocation due to the undelying process being already terminated.
2023-04-20 14:43:11 +02:00
Giacomo Vercesi 87543f835a revng.cli._commands: drop shebangs
Remove leftover shebangs from python files in `revng.cli._commands` as
those files are no longer executable on their own
2023-04-20 14:43:11 +02:00
Alessandro Di Federico 416c59c43b support.py: rework get_command
We introduce two paths where we can hard code search prefixes
(`/additional-search-prefixes`) and additional binaries paths
(`/share/revng/additional-bin-paths`).

This enables us to add to `additional-bin-paths` the configure-time
specified path of the preferred LLVM installation, instead of relying on
`PATH` to look up, e.g., `opt` at run-time.
2023-04-13 18:11:48 +02:00
Alessandro Di Federico 1fa34fff9e revng opt: force legacy pass manager 2023-04-08 08:42:24 +02:00
Alessandro Di Federico 79bbd8b260 commands_registry.py: drop dict comprehension 2023-04-08 08:42:23 +02:00
Kacper Kołodziej d281d1fa05 Add --binary argument to llvm_pipeline.py 2023-04-04 09:30:08 +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 1f097bb46a revng.api: Fix leftover snake_case in as_dict
This commit fixes the name of the fields returned by the `as_dict`
function that were left in snake_case when the field in the schema was
camelCase
2023-03-22 17:31:46 +01:00
Ivan Krysak 3687869795 Model: make AddPrimitiveTypes a pure analysis 2023-03-15 10:19:01 +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
Ivan Krysak 0b1aaeaede Minor improvements 2023-03-15 10:19:01 +01:00
Giacomo Vercesi 7751143aad revng daemon: add timeout-keep-alive option
Add the `--timeout-keep-alive` option for all invocations of `revng
daemon`. This avoids some edge cases where connections are abruply
closed.
2023-03-14 20:50:28 +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 275e3943f7 daemon: rework starlette startup code
Rework the startup code used to boot starlette, this allows removing the
use of all globals, moreover it allow dropping the ManagerMiddleware
class as it is no longer needed.
2023-02-07 16:54:35 +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 82c3962a3c Add GZip Middleware
Add the GZip Middleware to rev.ng daemon, allowing it to handle the
`Content-Encoding: gzip` header
2023-02-07 16:54:35 +01:00
Giacomo Vercesi 23b8ed8dbe revng.daemon: allow extra middlewares
Introduce the environment variable `STARLETTE_MIDDLEWARES` that
allows adding additional middlewares at startup to the startlette
server.
2023-02-07 16:54:35 +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
Giacomo Vercesi fc93198e25 revng daemon: Fix resolve_step_artifacts
Fixes the GraphQL handler for step's artifacts as it was creating the
wrong object for the 'container' property
2023-02-07 16:54:35 +01:00
Giacomo Vercesi 52ff853d00 revng daemon: Fix CORS allowed headers
Add an option to CORSMiddleware to allow any header to be provided when
checking for CORS
2023-02-07 16:54:35 +01:00
Giacomo Vercesi 6f475d1368 revng.api: Fix signature of Target.kind 2023-02-07 16:54:35 +01:00
Giacomo Vercesi aa344d4122 revng daemon: add -b none
Add the `-b none` option to `revng daemon` that allows disabling any
automatic bind
2023-02-07 16:54:35 +01:00
Giacomo Vercesi 23cd7f871a revng daemon: fix project-id checking
Fixes the regex that's used to check if the project ID is valid
2023-02-07 16:54:35 +01:00
Antonio Frighetto ea0a06a876 revng.daemon: accept no arguments for analysis
Let GraphQL accept zero or more parameters for analyses.
2023-02-06 09:37:23 +01:00
Giacomo Vercesi b4c1cd94e1 revng-daemon: preserve more signals
Add more signals to be handled from python rather than LLVM.
2023-02-01 17:46:19 +01:00
Djordje Todorovic 22ba1800c5 idb: fix generation of empty structs and unions
There was a log message that we are creating typedef void* for empty
structs, but we have missed that piece of code. This patch adds that
logic.

In the case of unions, we completely ignored empty ones, and also
there was not handling if the type was generated by ordinal (as
in the case of structs). This patch also fixes it.
2023-01-27 17:49:11 +01:00
Alessandro Di Federico 4929f201d1 script/revng: fix detection of packages directory 2023-01-21 16:46:35 +01:00
Alessandro Di Federico 7913bf9e58 Disable LeakSanitizer 2023-01-21 16:46:35 +01:00
Alessandro Di Federico 47fd084c88 revng --verbose: shorten paths only if beneficial 2023-01-21 16:46:35 +01:00
Djordje Todorovic 0d6ffa7504 Introduce revng fetch-debuginfo 2022-12-13 11:25:36 +01:00
Antonio Frighetto b2d24875e6 override-by-name.py: compare to bytes 2022-11-30 15:06:54 +01:00
Alessandro Di Federico 838d9a5992 revng model override-by-name: fix args doc 2022-11-30 15:06:54 +01:00
Massimo Fioravanti 044071435e Fix handling of binaries with no functions
Fix various edge cases when a binary with no functions was analyzed.
2022-11-22 16:19:28 +01:00
Giacomo Vercesi 7526d72492 Kinds: exposed locations produced
Expose the locations that can be found in each kind
2022-11-11 13:43:55 +01:00
Giacomo Vercesi 48cd3aad42 revng.cli: init commands_registry once
Only init commands_registry once, this is to avoid commands being
re-registered and allow quicker execution of nested commands.
2022-11-02 11:50:40 +01:00
Giacomo Vercesi 4af389c703 daemon-self-test: fix daemon output
Fix the `fail` function, to properly capture the output of the daemon
process in case of failure.
2022-11-02 11:50:40 +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
Giacomo Vercesi a6a7a09606 daemon-self-test: fix dumping of daemon output
Fix the `fail` function, to properly capture the output of the daemon
process in case of failure.
2022-10-30 09:12:33 +01:00
Giacomo Vercesi a465e796df revng.api: explicitly declare exports 2022-10-30 09:11:53 +01:00
Giacomo Vercesi e4adbe8134 revng.support: add get_root
Add the get_root function which will return the absolute path of the
root, relatively to the file location in support
2022-10-24 09:58:55 +02: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 d18b1a9092 Drop unused Python requirement: psutil 2022-10-11 19:08:10 +02: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